fbacker / broadlink-mqtt-bridge

Bridge Broadlink RM Devices with MQTT and API for e.g. OpenHAB
41 stars 14 forks source link

Error TypeError: data.deviceModules[0].enterRFSweep #28

Closed ArJay60 closed 4 years ago

ArJay60 commented 4 years ago

As https://github.com/fbacker/broadlink-mqtt-bridge/issues/25

I am reopening this. Same problem with RF recording. Followed steps as by mountain-pitt (see ref at the top) but didn't solve the problem. Still error: 2019-12-11 16:11:23 [error]: Error TypeError: data.deviceModules[0].enterRFSweep is not a function Please some assistance to solve this. Running on a PI with broadlink RM2.

ArJay60 commented 4 years ago

I said I had a RM2 but this is the RM 2 Pro. It shows up as an RM2 in Devicelist. index.js in broadlink-mqtt-bridge/node_modules/broadlinkjs-rm does not have the RM2 Pro as device. Does RM2 Pro not support RF recording, or can you add it?

fbacker commented 4 years ago

If it throws an error the broadlink devices isn't setup to handle RF. Looks like RM2 Pro specs have the RF functionallity.

Please try to add more logging by settings log level to debug and post the whole found device raw output.

Update to latest version and look here to to enable debug log output: https://github.com/fbacker/broadlink-mqtt-bridge/wiki/Configuration

ArJay60 commented 4 years ago

Added lines to json to set log level to debug. Below the output after restarting service and activating RF recording:

2019-12-18 21:42:04 [info]: Starting Broadlink MQTT NodeJS Application

2019-12-18 21:42:05 [info]: Device found model: Broadlink RM2, id: b4430da130cc, ip: 192.168.1.17

2019-12-18 21:42:30 [info]: Broadlink Discovery completed. Found 1 devices.

2019-12-18 21:42:54 [info]: Prepare topic: broadlink/biosscreen/down, message: down

2019-12-18 21:42:54 [error]: Error TypeError: data.deviceModules[0].enterRFSweep is not a function

2019-12-18 21:42:54 [info]: Prepare topic: broadlink/biosscreen/down, message: down

fbacker commented 4 years ago

Please add logs with correct markdown syntax. To solve multiple lines use a text editor replace with e.g. \n\n to \n.

I dont see any [debug] output so it doesn't seem like log level is at debug. Did you make an update of the project?

Example of output with debug enabled

2019-12-18 21:50:29 [debug]:    Web a client connected 
2019-12-18 21:50:33 [debug]:    MQTT Received Message topic: broadlink/nexa/tmt-918/button1, message: ON 
2019-12-18 21:50:33 [info]:     Prepare topic: broadlink/nexa/tmt-918/button1, message: on 
2019-12-18 21:50:34 [debug]:    MQTT Received Message topic: broadlink/nexa/lkct-614-2/button1, message: ON 
2019-12-18 21:50:34 [info]:     Prepare topic: broadlink/nexa/lkct-614-2/button1, message: on 
2019-12-18 21:50:34 [error]:    Blocked call topic: broadlink/nexa/tmt-918/button1, message: on 
2019-12-18 21:50:34 [error]:    Blocked call topic: broadlink/nexa/lkct-614-2/button1, message: on 
2019-12-18 21:50:52 [info]:     Broadlink Discovery completed. Found 1 devices. 
ArJay60 commented 4 years ago

Excuse me. Set log level not correct. Here is the full output.log:

2019-12-18 22:02:50 [^[[34mdebug^[[39m]: MQTT Options { "host": "127.0.0.1", "port": 1883, "protocol": "mqtt", "subscribeBasePath": "broadlink/", "defaultProtocol": "mqtt", "keepalive": 60, "reschedulePings": true, "protocolId": "MQTT", "protocolVersion": 4, "reconnectPeriod": 1000, "connectTimeout": 30000, "clean": true, "resubscribe": true, "clientId": "mqttjs_36070ad1", "hostname": "127.0.0.1" } 2019-12-18 22:02:51 [^[[32minfo^[[39m]: Starting Broadlink MQTT NodeJS Application 2019-12-18 22:02:51 [^[[34mdebug^[[39m]: GUI Web listen on port 3000 2019-12-18 22:02:51 [^[[34mdebug^[[39m]: MQTT Connected, subscribe: broadlink/# 2019-12-18 22:02:51 [^[[34mdebug^[[39m]: Web a client connected 2019-12-18 22:02:52 [^[[32minfo^[[39m]: Device found model: Broadlink RM2, id: b4430da130cc, ip: 192.168.1.17 2019-12-18 22:02:52 [^[[34mdebug^[[39m]: Device raw { "host": { "address": "192.168.1.17", "family": "IPv4", "port": 80, "size": 128, "macAddress": "b4:43:0d:a1:30:cc", "id": "b4430da130cc", "model": "Broadlink RM2" }, "mac": "b4430da130cc", "emitter": { "domain": null, "_events": {}, "_eventsCount": 0 }, "type": 10002, "model": "Broadlink RM2", "count": 1, "key": { "type": "Buffer", "data": [ 112, 240, 193, 84, 112, 240, 193, 84, 112, 240, 193, 84, 166, 99, 56, 68, 19, 74, 37, 35 ] }, "iv": { "type": "Buffer", "data": [ 86, 46, 23, 153, 109, 9, 61, 40, 221, 179, 186, 105, 90, 46, 111, 88 ] }, "id": { "type": "Buffer", "data": [ 7, 0, 0, 0 ] }, "socket": { "domain": null, "_events": {}, "_eventsCount": 1, "type": "udp4", "fd": -42 }, "_events": {}, "_eventsCount": 2 } 2019-12-18 22:03:16 [^[[32minfo^[[39m]: Broadlink Discovery completed. Found 1 devices. 2019-12-18 22:03:18 [^[[34mdebug^[[39m]: Start to record block rec: false, block scan false 2019-12-18 22:03:18 [^[[34mdebug^[[39m]: Start to record rf, action broadlink/biosscreen/down 2019-12-18 22:03:18 [^[[34mdebug^[[39m]: Record rf 2019-12-18 22:03:18 [^[[32minfo^[[39m]: Prepare topic: broadlink/biosscreen/down, message: down 2019-12-18 22:03:18 [^[[34mdebug^[[39m]: deviceEnterLearningRFSweep 2019-12-18 22:03:18 [^[[31merror^[[39m]: Error TypeError: data.deviceModules[0].enterRFSweep is not a function 2019-12-18 22:03:18 [^[[32minfo^[[39m]: Prepare topic: broadlink/biosscreen/down, message: down 2019-12-18 22:03:18 [^[[34mdebug^[[39m]: deviceExitLearningRF

fbacker commented 4 years ago

Looking at it your type 10002 (hex 2712) looks like an RM2 (NOT PRO). rmDeviceTypes[parseInt(0x2712, 16)] = "Broadlink RM2";

Can you use the broadlink default mobile app, record and replay RF signals?

ArJay60 commented 4 years ago

Seems to be an RM2 although the bottom of the device says RM Pro on the sticker. With Broadlink bridge the device goes in RF learn mode (at least the recording light is lit). But didn't accept RF codes. I've tried the same with Broadlink manager (https://sourceforge.net/projects/broadlink-manager/ ). There when going to RF learning mode the device is not even coming in RF learning mode (no lrecording light lid). My conclusion is that with even the Pro text on the bottom on the device it is not an RM 2 Pro. Excuses for bothering with opening this Issue. Keep the good work going. Cheers. Issue closed