lprhodes / homebridge-broadlink-rm

Broadlink RM Mini and Pro plugin for homebridge: https://github.com/nfarina/homebridge
Apache License 2.0
571 stars 284 forks source link

Crash when adding learn-code accessory #400

Open duculete opened 6 years ago

duculete commented 6 years ago

I have one RM pro and one RM (no RF).

Jul 04 13:07:44 homebridge homebridge[13444]: [2018-7-4 13:07:44] [Broadlink RM Living Room] [INFO] Discovered Broadlink RM Mini (2737) at 192.168.1.CD (XX:XX:XX:XX:XX:XX)
Jul 04 13:07:44 homebridge homebridge[13444]: [2018-7-4 13:07:44] [Broadlink RM Living Room] [INFO] Discovered Broadlink RM2 Pro Plus (272a) at 192.168.1.AB (XX:XX:XX:XX:XX:XX)

If I do not add learn-code accessory then i see some messages:

Jul 04 13:07:55 homebridge homebridge[13444]: [2018-7-4 13:07:55] [Broadlink RM Living Room] Scan Frequency getSwitchState: undefined
Jul 04 13:07:55 homebridge homebridge[13444]: [2018-7-4 13:07:55] [Broadlink RM Living Room] Learn getSwitchState: undefined
Jul 04 13:08:14 homebridge homebridge[13444]: [2018-7-4 13:08:14] [Broadlink RM Living Room] Learn getSwitchState: undefined
Jul 04 13:08:14 homebridge homebridge[13444]: [2018-7-4 13:08:14] [Broadlink RM Living Room] Scan Frequency getSwitchState: undefined

If i add the accessory:

{
                    "name": " Learn",
                    "host": "XX:XX:XX:XX:XX:XX",
                    "type": "learn-code",
                    "scanFrequency": true
}

then...

Jul 04 13:04:26 homebridge homebridge[12960]: [2018-7-4 13:04:26] [Broadlink RM Living Room] [ACTION] Hold down the button that sends the RF frequency.
Jul 04 13:04:34 homebridge homebridge[12960]: [2018-7-4 13:04:34] [Broadlink RM Living Room]  Learn getSwitchState: undefined
Jul 04 13:04:36 homebridge homebridge[12960]: [2018-7-4 13:04:36] [Broadlink RM Living Room] [INFO] Scan RF (scanning)
Jul 04 13:04:36 homebridge homebridge[12960]: [2018-7-4 13:04:36] [Broadlink RM Living Room] [ACTION] Hold down the button that sends the RF frequency.
Jul 04 13:04:47 homebridge homebridge[12960]: [2018-7-4 13:04:47] [Broadlink RM Living Room] [INFO] Scan RF (stopped - 20s timeout)
Jul 04 13:04:47 homebridge homebridge[12960]: /usr/local/lib/node_modules/homebridge-broadlink-rm/helpers/learnRFData.js:135
Jul 04 13:04:47 homebridge homebridge[12960]:       closeClient();
Jul 04 13:04:47 homebridge homebridge[12960]:       ^
Jul 04 13:04:47 homebridge homebridge[12960]: TypeError: closeClient is not a function
Jul 04 13:04:47 homebridge homebridge[12960]:     at Timeout.setTimeout (/usr/local/lib/node_modules/homebridge-broadlink-rm/helpers/learnRFData.js:135:7)
Jul 04 13:04:47 homebridge homebridge[12960]:     at ontimeout (timers.js:427:11)
cubilon commented 6 years ago

in

"host": "XX:XX:XX:XX:XX:XX",

you may insert Broadlink IP, not MAC address.

duculete commented 6 years ago

Then you need to update the documentation!

cubilon commented 6 years ago

I didn't know there was the opportunity to use MAC instead of IP 😟

duculete commented 6 years ago

If you have multiple Broadlink RM devices (e.g. one in the bedroom, one in the lounge) then you can additionally specify the Broadlink RM's IP or MAC address in a "host" key/value pair on each accessory so that the accessory will use the correct device to send the IR or RF commands.

cubilon commented 6 years ago

I know it. I'm using it, but with IP, not MAC address.

Cappe77 commented 5 years ago

I don't understand.. I have only one Broadlink (RM Mini 3) that works on IHC or e-Control app. When I launch homebridge in the app #Home we find Learn button but the message is: Learn getSwitchState: undefined So it doesn't possible to learn IR code I have try to add the accessory but I have this messages: `[2018-12-8 16:01:14] Loading 1 accessories...

/usr/lib/node_modules/homebridge/lib/api.js:50 if (name.indexOf('.') == -1) { ^ TypeError: Cannot read property 'indexOf' of undefined at API.accessory (/usr/lib/node_modules/homebridge/lib/api.js:50:12) at Server._loadAccessories (/usr/lib/node_modules/homebridge/lib/server.js:286:42) at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:87:38) at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:45:10) at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Function.Module.runMain (module.js:694:10) at startup (bootstrap_node.js:204:16) at bootstrap_node.js:625:3 ` Can someone help me?

duculete commented 5 years ago

a new crash

            {
                "name": "Learn IR [Living]",
                "host": "192.168.1.13",
                "type": "learn-code"
            },
            {
                "name": "Learn IR Code [Bedroom]",
                "host": "192.168.1.8",
                "type": "learn-code"
            },
            {
                "name": "Learn RF [Living]",
                "host": "192.168.1.13",
                "type": "learn-code",
                "scanFrequency": true
            },

Jul 15 21:09:11 homebridge homebridge[14961]: [2019-7-15 21:09:11] [Broadlink RM Living Room] [INFO] Scan RF (scanning) Jul 15 21:09:11 homebridge homebridge[14961]: [2019-7-15 21:09:11] [Broadlink RM Living Room] [ACTION] Hold down the button that sends the RF frequency. Jul 15 21:09:18 homebridge homebridge[14961]: [2019-7-15 21:09:18] TypeError: log is not a function Jul 15 21:09:18 homebridge homebridge[14961]: at stop (/usr/local/lib/node_modules/homebridge-broadlink-rm/helpers/learnData.js:14:3) Jul 15 21:09:18 homebridge homebridge[14961]: at Object.start (/usr/local/lib/node_modules/homebridge-broadlink-rm/helpers/learnData.js:18:3) Jul 15 21:09:18 homebridge homebridge[14961]: at LearnIRAccessory.toggleLearning (/usr/local/lib/node_modules/homebridge-broadlink-rm/accessories/learnCode.js:41:17) Jul 15 21:09:18 homebridge homebridge[14961]: at Characteristic.On.emit (events.js:182:13) Jul 15 21:09:18 homebridge homebridge[14961]: at Characteristic.On.Characteristic.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js: Jul 15 21:09:18 homebridge homebridge[14961]: at Bridge. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:882:22) Jul 15 21:09:18 homebridge homebridge[14961]: at Array.forEach (:null:null) Jul 15 21:09:18 homebridge homebridge[14961]: at Bridge.Accessory._handleSetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:822: Jul 15 21:09:18 homebridge homebridge[14961]: at HAPServer.emit (events.js:182:13) Jul 15 21:09:18 homebridge homebridge[14961]: at HAPServer._handleCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:974:10) Jul 15 21:09:18 homebridge homebridge[14961]: at HAPServer. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:209:39) Jul 15 21:09:18 homebridge homebridge[14961]: at IncomingMessage.emit (events.js:182:13) Jul 15 21:09:18 homebridge homebridge[14961]: at endReadableNT (_stream_readable.js:1090:12) Jul 15 21:09:18 homebridge homebridge[14961]: at process._tickCallback (internal/process/next_tick.js:63:19) Jul 15 21:09:18 homebridge homebridge[14961]: [2019-7-15 21:09:18] Got SIGTERM, shutting down Homebridge...