fbacker / broadlink-mqtt-bridge

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

Broadlink device is not recognized #30

Closed Majestry closed 4 years ago

Majestry commented 4 years ago

A device broadlink rm3 mini is present in network and is found by bridge. But it's type and ID aren't recognized and are set as undefined, which makes it's usage absolutely impossible. Service restart, device restart and rescan gives no results. Used the latest bridge version from github. Openhabian on Rpi3B. Screen of web page:

Screenshot 2019-12-17 at 18 46 56
fbacker commented 4 years ago

Looking at the code RM Mini should be found. It seems it finds your device but something not getting the mac address correctly. Project used (https://github.com/fbacker/broadlinkjs-rm)

rmDeviceTypes[parseInt(0x2737, 16)] = "Broadlink RM Mini";
rmDeviceTypes[parseInt(0x27c2, 16)] = "Broadlink RM Mini 3";
rmDeviceTypes[parseInt(0x27de, 16)] = "Broadlink RM Mini 3 v2";

When running a scan, What does the output say? Example for me,.

2019-12-18 19:27:33 [info]:     Clear current devicelist and rescan 
2019-12-18 19:27:33 [info]:     Device found model: Broadlink RM3 Pro Plus, id: 780f7717ea86, ip: 192.168.90.4 

If you update to the latest version, I've added the possibility to change logg level.

/config/local.json
{
  "logging":{
    "level": "debug"
  }
}

Running with debug mode. Check the log output for Device found model. Please paste the result and the next Device raw log.

Majestry commented 4 years ago

After i reset the device twice, it appeared on the list with IP and mac address. In logs yesterday i saw next:

Dec 17 18:28:30 openHABianPi npm[8571]: 2019-12-17 17:28:30 [#033[31merror#033[39m]: #011MQTT Closed Dec 17 18:28:31 openHABianPi npm[8571]: 2019-12-17 17:28:31 [#033[32minfo#033[39m]: #011MQTT Reconnected Dec 17 18:28:49 openHABianPi npm[8571]: 2019-12-17 17:28:49 [#033[32minfo#033[39m]: #011Broadlink Discovery completed. Found 1 devices. Dec 17 18:29:01 openHABianPi npm[8571]: 2019-12-17 17:29:01 [#033[31merror#033[39m]: #011MQTT Closed Dec 17 18:29:02 openHABianPi npm[8571]: 2019-12-17 17:29:02 [#033[32minfo#033[39m]: #011MQTT Reconnected Dec 17 18:29:11 openHABianPi npm[8571]: 2019-12-17 17:29:11 [#033[32minfo#033[39m]: #011Clear current devicelist and rescan Dec 17 18:29:32 openHABianPi npm[8571]: 2019-12-17 17:29:32 [#033[31merror#033[39m]: #011MQTT Closed Dec 17 18:29:33 openHABianPi npm[8571]: 2019-12-17 17:29:33 [#033[32minfo#033[39m]: #011MQTT Reconnected Dec 17 18:29:36 openHABianPi npm[8571]: 2019-12-17 17:29:36 [#033[32minfo#033[39m]: #011Broadlink Discovery completed. Found 1 devices. Dec 17 18:29:50 openHABianPi npm[8571]: 2019-12-17 17:29:50 [#033[32minfo#033[39m]: #011Ask for temperatures. Dec 17 18:30:03 openHABianPi npm[8571]: 2019-12-17 17:30:03 [#033[32minfo#033[39m]: #011Clear current devicelist and rescan

fbacker commented 4 years ago

You are getting Discovery Complete but I can't see Device found model:. Can you update to latest. Run a 'debug' level log. Then please post the log with correct markdown syntax. The logs are looking wrong. Noticed when I copied from web gui I needed to replace \n\n with \n to remove blank lines.

Example from my output.

2019-12-18 20:28:06 [debug]:    Web a client connected 
2019-12-18 20:28:11 [info]:     Clear current devicelist and rescan 
2019-12-18 20:28:11 [info]:     Device found model: Broadlink RM3 Pro Plus, id: 780f7717ea86, ip: 192.168.90.4 
2019-12-18 20:28:11 [debug]:    Device raw 
{
  "host": {
    "address": "192.168.90.4",
    "family": "IPv4",
    "port": 80,
    "size": 128,
    "macAddress": "78:0f:77:17:ea:86",
    "id": "780f7717ea86",
    "model": "Broadlink RM3 Pro Plus"
  },
  "mac": "780f7717ea86",
  "emitter": {
    "_events": {},
    "_eventsCount": 0
  },
  "type": 10141,
  "model": "Broadlink RM3 Pro Plus",
  "count": 1,
  "key": {
    "type": "Buffer",
    "data": [
      79,
      105,
      181,
      96,
      79,
      105,
      181,
      96,
      134,
      220,
      43,
      80,
      188,
      79,
      162,
      63
    ]
  },
  "iv": {
    "type": "Buffer",
    "data": [
      86,
      46,
      23,
      153,
      109,
      9,
      61,
      40,
      221,
      179,
      186,
      105,
      90,
      46,
      111,
      88
    ]
  },
  "id": {
    "type": "Buffer",
    "data": [
      2,
      0,
      0,
      0
    ]
  },
  "socket": {
    "_events": {},
    "_eventsCount": 1,
    "type": "udp4"
  },
  "_events": {},
  "_eventsCount": 2
}
2019-12-18 20:28:36 [info]:     Broadlink Discovery completed. Found 1 devices. 
Majestry commented 4 years ago

After i resetted the device and configured it once, it appeared and started to work. I cannot reproduce this issue any more. Sorry for disturbing you, will close it now.