Skip to content

Commit

Permalink
Updated learn-ir to learn-code and kept backward compatibility with l…
Browse files Browse the repository at this point in the history
…earn-ir
  • Loading branch information
lprhodes committed Apr 26, 2017
1 parent eb1b79b commit a55d19f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions accessories/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const AirCon = require('./aircon');
const Channel = require('./channel');
const LearnIR = require('./learnIR');
const LearnCode = require('./learnCode');
const Switch = require('./switch');
const SwitchMulti = require('./switchMulti');
const SwitchMultiRepeat = require('./switchMultiRepeat');
Expand All @@ -14,7 +14,7 @@ const WindowCovering = require('./windowCovering');
module.exports = {
AirCon,
Channel,
LearnIR,
LearnCode,
Switch,
SwitchMulti,
SwitchMultiRepeat,
Expand Down
File renamed without changes.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class BroadlinkRMPlatform {
const accessories = [];

// Add a Learn Code accessory if none exist in the config
const learnIRAccessories = config.accessories ? config.accessories.filter((accessory) => accessory.type === 'learn-ir') : [];
const learnIRAccessories = config.accessories ? config.accessories.filter((accessory) => (accessory.type === 'learn-ir' || accessory.type === 'learn-code')) : [];

if (learnIRAccessories.length === 0) {
const learnIRAccessory = new Accessory.LearnIR(log);
accessories.push(learnIRAccessory);
const learnCodeAccessory = new Accessory.LearnCode(log);
accessories.push(learnCodeAccessory);
}

// Check for no accessories
Expand All @@ -42,7 +42,8 @@ class BroadlinkRMPlatform {

const classTypes = {
'air-conditioner': Accessory.AirCon,
'learn-ir': Accessory.LearnIR,
'learn-ir': Accessory.LearnCode,
'learn-code': Accessory.LearnCode,
'switch': Accessory.Switch,
'garage-door-opener': Accessory.GarageDoorOpener,
'switch-multi': Accessory.SwitchMulti,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-broadlink-rm",
"version": "2.0.9",
"version": "2.0.10",
"description": "Broadlink RM plugin (including the mini and pro) for homebridge: https://github.com/nfarina/homebridge",
"license": "ISC",
"keywords": [
Expand Down

0 comments on commit a55d19f

Please sign in to comment.