[deconz] Issues with automatic discovery of bridge and sensors and timeouts (all things go OFFLINE and ONLINE again)

Hi

I am running openhab2 SNAPSHOT in order to put some improvements to the [deconz] binding devloped by @David_Graeff

Actually I have some issues running it with the SNAPSHOP version. First of all here is my setup:

  1. Raspberry Pi 3 with openhabian stable and RaspBee hardware module with deconz (2.05.51) and Firmware 26300500. Additionally here is running my production openhab enviroment without deconz support.
  2. Raspberry Pi 3 with raspbian and OpenHAB SNAPSHOT with deconz Binding installed
  3. Between 1. and 2. there is a Gigbit network and no issues withit.

Auto-Discovery Issues:

  1. After installing the deconz binding and searching for the deconz bridge it was not found, also not after activating the pairn functionality in deconz.
  2. Manual installation with IP (of 1.) and with exsisting API key or the pairng function in deconz is successfully.
  3. Adding thing is not working automatically, nothing will be found.
  4. Manually adding integrated Daylight and Light Sensor and paired Xiaomi Temperature sensor is successfull after entering INT number.

Does anyone uses a network between OpenHAB and deCONZ Bridge and optains the same behaviour?

Actually I also get every 5 Minutes a communication timeout with the deconz bridge, which causes everthing goes OFFLINE and back ONLINE a second later, in case that no sensor changes its value in these 5 minutes:

2018-12-19 09:56:29.535 [hingStatusInfoChangedEvent] - ‘deconz:deconz:5a8d2cbc’ changed from OFFLINE (COMMUNICATION_ERROR): Idle Timeout to ONLINE
2018-12-19 09:56:29.542 [hingStatusInfoChangedEvent] - ‘deconz:temperaturesensor:799377a6’ changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (CONFIGURATION_PENDING)
2018-12-19 09:56:29.551 [hingStatusInfoChangedEvent] - ‘deconz:daylightsensor:92dfc1eb’ changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (CONFIGURATION_PENDING)
2018-12-19 09:56:29.555 [hingStatusInfoChangedEvent] - ‘deconz:lightsensor:1039a055’ changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (CONFIGURATION_PENDING)
2018-12-19 09:56:29.576 [hingStatusInfoChangedEvent] - ‘deconz:daylightsensor:92dfc1eb’ changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE
2018-12-19 09:56:29.583 [hingStatusInfoChangedEvent] - ‘deconz:temperaturesensor:799377a6’ changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE
2018-12-19 09:56:29.593 [hingStatusInfoChangedEvent] - ‘deconz:lightsensor:1039a055’ changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE
2018-12-19 10:02:33.266 [hingStatusInfoChangedEvent] - ‘deconz:deconz:5a8d2cbc’ changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Idle timeout expired: 300000/300000 ms
2018-12-19 10:02:33.281 [hingStatusInfoChangedEvent] - ‘deconz:temperaturesensor:799377a6’ changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2018-12-19 10:02:33.290 [hingStatusInfoChangedEvent] - ‘deconz:lightsensor:1039a055’ changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2018-12-19 10:02:33.295 [hingStatusInfoChangedEvent] - ‘deconz:daylightsensor:92dfc1eb’ changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2018-12-19 10:02:33.313 [hingStatusInfoChangedEvent] - ‘deconz:deconz:5a8d2cbc’ changed from OFFLINE (COMMUNICATION_ERROR): Idle timeout expired: 300000/300000 ms to OFFLINE (COMMUNICATION_ERROR): Idle Timeout
2018-12-19 10:02:33.318 [hingStatusInfoChangedEvent] - ‘deconz:deconz:5a8d2cbc’ changed from OFFLINE (COMMUNICATION_ERROR): Idle Timeout to ONLINE
2018-12-19 10:02:33.325 [hingStatusInfoChangedEvent] - ‘deconz:daylightsensor:92dfc1eb’ changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (CONFIGURATION_PENDING)
2018-12-19 10:02:33.329 [hingStatusInfoChangedEvent] - ‘deconz:temperaturesensor:799377a6’ changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (CONFIGURATION_PENDING)
2018-12-19 10:02:33.360 [hingStatusInfoChangedEvent] - ‘deconz:lightsensor:1039a055’ changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (CONFIGURATION_PENDING)
2018-12-19 10:02:33.374 [hingStatusInfoChangedEvent] - ‘deconz:daylightsensor:92dfc1eb’ changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE
2018-12-19 10:02:33.387 [hingStatusInfoChangedEvent] - ‘deconz:temperaturesensor:799377a6’ changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE
2018-12-19 10:02:33.395 [hingStatusInfoChangedEvent] - ‘deconz:lightsensor:1039a055’ changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE
2018-12-19 10:02:58.239 [vent.ItemStateChangedEvent] - TemperatureSensor_Temperature changed from 1187.0 °C to 1170.0 °C
2018-12-19 10:06:49.995 [vent.ItemStateChangedEvent] - TemperatureSensor_Temperature changed from 1170.0 °C to 1173.0 °C
2018-12-19 10:11:50.033 [hingStatusInfoChangedEvent] - ‘deconz:deconz:5a8d2cbc’ changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Idle timeout expired: 300000/300000 ms
2018-12-19 10:11:50.044 [hingStatusInfoChangedEvent] - ‘deconz:temperaturesensor:799377a6’ changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2018-12-19 10:11:50.055 [hingStatusInfoChangedEvent] - ‘deconz:daylightsensor:92dfc1eb’ changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2018-12-19 10:11:50.061 [hingStatusInfoChangedEvent] - ‘deconz:lightsensor:1039a055’ changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2018-12-19 10:11:50.080 [hingStatusInfoChangedEvent] - ‘deconz:deconz:5a8d2cbc’ changed from OFFLINE (COMMUNICATION_ERROR): Idle timeout expired: 300000/300000 ms to OFFLINE (COMMUNICATION_ERROR): Idle Timeout
2018-12-19 10:11:50.088 [hingStatusInfoChangedEvent] - ‘deconz:deconz:5a8d2cbc’ changed from OFFLINE (COMMUNICATION_ERROR): Idle Timeout to ONLINE
2018-12-19 10:11:50.107 [hingStatusInfoChangedEvent] - ‘deconz:temperaturesensor:799377a6’ changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (CONFIGURATION_PENDING)
2018-12-19 10:11:50.115 [hingStatusInfoChangedEvent] - ‘deconz:daylightsensor:92dfc1eb’ changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (CONFIGURATION_PENDING)
2018-12-19 10:11:50.121 [hingStatusInfoChangedEvent] - ‘deconz:lightsensor:1039a055’ changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (CONFIGURATION_PENDING)
2018-12-19 10:11:50.131 [hingStatusInfoChangedEvent] - ‘deconz:temperaturesensor:799377a6’ changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE
2018-12-19 10:11:50.136 [hingStatusInfoChangedEvent] - ‘deconz:daylightsensor:92dfc1eb’ changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE
2018-12-19 10:11:50.143 [hingStatusInfoChangedEvent] - ‘deconz:lightsensor:1039a055’ changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE

Perhaps this timeout has the same reason that nothing is automatically detected by the binding? Here you can also see that the changes of the temperature sensor extends the timeout… I am not sure if the behaviour is wanted?

  1. Perhaps it makes sense to extend the timeout to an hour or more?
  2. It is a little bit confusing to see the log file full of connections errors and timeout without having any issue.

I definately want to clarfiy these issue before I start developing this binding…

Thanks and best regards.

I have openHAB and deconz on the same system and do not experience those timeouts.

But I guess, that the websocket connection need a keep-alive packet every now and then, I already
wondered how they detect stale connections. The documentation of deconz does not mention such
a keep-alive packet though. Maybe just sending a random value helps.

Auto discovery uses upnp which uses udp broadcasts so only works in one network segment. If there is a router between those two devices, broadcast already doesn’t work, nothing that can be done here. (Except if deconz support “cloud” upnp like the newer hue bridges).

Discovery of the Things should work. Another user reported this already but I have no idea why it doesn’t work for you, it does for me. Could you maybe investigate yourself a bit? If the deconz API response is correct, if the packet gets received by openHab (check via Wireshark or so) or debug the binding in Eclipse.

Thanks,
David

Hi @David_Graeff

thanks for your reply… I will take a closer look on this with some additional networking tools.

Generally both Raspberries are in the same network and are connected by a netgear gigabit switch. I can access the REST API from everywhere in my home network without any problems. I actually use Insomnia for checking the deconz REST API from my notebook over WLAN. Perhaps its the network inbetween…
As soon as my production openhabian supports the deconz binding I will activate it there, too. But I want to seperate my development verions of the binding from my production enviroment for testing. :wink: I think I can live with both, the timeout and non auto discovery during the development… but will keep it in mind.

I will document my results here…

Thanks and best regards,
Jens

Hi all,

I have the same Issue.
System: OH 2.4, Deconz Version 2.05.50 / 8.12.2018 and RaspBee with Firmware 26050500 all running on a single RPi3+.

In OH 2.4:
Auto discovery of bridge does not work.
Manually adding the bridge with IP 127.0.0.1 was successful.
API Key was automatically assinged, after opening the deconz software for 3rd party apps.
Auto discovery of things does not work.
Manually adding things using ID optained from deconz rest API worked, but sensor data is not updated.

openhab.log does not show any erros or warnings

But you are not using the hue binding at the same time? Because that setup is highly broken at the moment. (Fault of the hue binding.)

The Thing is online, but no sensors are detected? Omg, there is something seriously broken in the deconz binding then. I have approved some pull requests recently, but could not test them myself. I will have a look, but busy rn, unfortunately.

Hi David,

thx for the quick reply.

Yes, i have the hue binding also runnig! I will deinstall the hue binding and try to determine whether this has some impact onto the deconz binding problem i am experiencing.
Will be back later with some hopefully useful information.

Quick updated.

I deinstalled the hue and deconz binding and removed all associated things. After that, i restarted OH2 and installed the deconz binding. unfortunately, the problem described above is still present.

no openhab.log entries were made :frowning:

the event.log contains the following information:

Blockquote
2018-12-22 14:40:50.896 [hingStatusInfoChangedEvent] - ‘deconz:deconz:db923232’ changed from UNINITIALIZED to INITIALIZING
2018-12-22 14:40:50.915 [hingStatusInfoChangedEvent] - ‘deconz:deconz:db923232’ changed from INITIALIZING to OFFLINE (CONFIGURATION_PENDING): Requesting API Key
2018-12-22 14:40:51.005 [me.event.ThingUpdatedEvent] - Thing ‘deconz:deconz:db923232’ has been updated.
2018-12-22 14:40:51.015 [hingStatusInfoChangedEvent] - ‘deconz:deconz:db923232’ changed from OFFLINE (CONFIGURATION_PENDING): Requesting API Key to OFFLINE (CONFIGURATION_PENDING): Waiting for configuration
2018-12-22 14:40:51.119 [me.event.ThingUpdatedEvent] - Thing ‘deconz:deconz:db923232’ has been updated.
2018-12-22 14:40:51.527 [hingStatusInfoChangedEvent] - ‘deconz:deconz:db923232’ changed from OFFLINE (CONFIGURATION_PENDING): Waiting for configuration to ONLINE

Ok I will have a look after holidays :slight_smile:

I’m currently running deconz and OH2 on the same host.
OH2 REST API is on port 8080 and so is deconz by default, but I have moved it to 8090.
How can one tune the Hue binding to port 8090?
How often does the deconz binding poll?

I’m currently just using the HTTP binding for polling sensors every 500ms and sendHttpPutRequest for controlling lights. Works quite well, but not as neat as native OH channels.

I think this question should be moved to a sperate thread since it concerns the hue binding.

Really bad idea. The hue binding has a bug and can’t store a port permanently. I was working on a bug fix, but the hue sensor update got in my way. For now you need to set the port every now and then again in paper UI. Thing files will not work at all.

The deconz binding is not polling at all. It gets the state once on start and uses the update values via the websocket connection from there on.

Hi David,

The deconz binding is not polling at all. It gets the state once on start and uses the update values via the websocket connection from there on.

Your last statement provides some more evidence that something related with the deconz binding’s websocket connection is not working on my RPI3+.

Any progress in fixing the issue?

Thany your for your efforts!

The oh 2.4 release version is broken in this regard. I thought you are on 2.5 snapshot.

Nope. But i am going to test the 2.5. snapshot binding in the next days and provide feedback.

Thanks for the info

I switched openhab to the latest 2.5. snapshot and installed the deconz binding.
unfortunately the erroneous behavior described above is still present.

anybody else experiencing the same issue ??

Please check if you still have an old jar in your addons directory etc. Because the websocket support is confirmed to work by multiple users. The binding Things should go offline if the websocket connection drops.

addon folder is empty. the binding’s version is binding-deconz - 2.5.0.SNAPSHOT.

The deconz websocket port is 443 on my RPi3+.

Could that be the problem?

can i provide any futher information which might help to identify the problem?

Hm deconz tells the binding about the websocket port. If you route it to another port that will indeed not work.

ok. can people maybe post what their things and items files look like ? i mean how they forced the items. i have a guess but not entirely sure.

as for now i am posting my finds…
My System : Openhab 2.4.0 with addons 2.4.0-1 installed, using the testing release, but not using snapshot

Openhab is on one raspi and i have the RaspBee on another raspi, both are Model 3B+
I have the hue binding installed as well because we got loads of philips hue lamps.
but i will try testing without the hue binding and just deconz alone

My Deconz and Phoscon-GW work well and discover my sensors. I am trying to include Aqara Temp/humidity sensors and openclose sensors into openhab, they work perfectly on deconz.

If i remove the hue binding nothing gets discovered and nothing works, not even deconz. if i put hue back in it finds my hue bridge of course, but also discovers the Phoscon-GW as a hue bridge, which is i guess obviously a mistake … sind its discover as hue:bridge:idxxxxxxx and it should be discovered as ```
Bridge deconz:deconz:idxxxx or :homeserver or whatever.

{
  "UTC": "2019-01-07T09:42:21",
  "apiversion": "1.16.0",
  "backup": {
    "errorcode": 0,
    "status": "idle"
  },
  "bridgeid": "0021202F47B",
  "datastoreversion": "60",
  "devicename": "RaspBee",
  "dhcp": true,
  "factorynew": false,
  "fwversion": "0x262f0500",
  "gateway": "192.168.178.1",
  "internetservices": {
    "remoteaccess": "disconnected"
  },
  "ipaddress": "192.168.178.213",
  "linkbutton": false,
  "localtime": "2019-01-07T10:42:21",
  "mac": "b8:27:eb:2e:7a:f1",
  "modelid": "deCONZ",
  "name": "Phoscon-GW",
  "netmask": "255.255.255.0",
  "networkopenduration": 60,
  "panid": 51206,
  "portalconnection": "disconnected",
  "portalservices": false,
  "portalstate": {
    "communication": "disconnected",
    "incoming": false,
    "outgoing": false,
    "signedon": false
  },
  "proxyaddress": "none",
  "proxyport": 0,
  "replacesbridgeid": null,
  "rfconnected": true,
  "starterkitid": "",
  "swupdate": {
    "checkforupdate": false,
    "devicetypes": {
      "bridge": false,
      "lights": [],
      "sensors": []
    },
    "notify": false,
    "text": "",
    "updatestate": 0,
    "url": ""
  },
  "swupdate2": {
    "autoinstall": {
      "on": false,
      "updatetime": ""
    },
    "bridge": {
      "lastinstall": "%cI",
      "state": "allreadytoinstall"
    },
    "checkforupdate": false,
    "install": false,
    "lastchange": "",
    "lastinstall": "",
    "state": "allreadytoinstall"
  },
  "swversion": "2.5.54",
  "timeformat": "24h",
  "timezone": "Etc/GMT-1",
  "uuid": "xxxxxxxxxxxxxxxxxx",
  "websocketnotifyall": true,
  "websocketport": 443,
  }
  "zigbeechannel": 25
......
}

this is my Rest Api result from the bridge, removed some unimportant stuff at the end

— “websocketport”: 443,

{
  "1": {
    "config": {
      "configured": true,
      "on": true,
      "sunriseoffset": 30,
      "sunsetoffset": -30
    },
    "etag": "417172b8fd5603e6f4b44a50888519f4",
    "manufacturername": "Philips",
    "modelid": "PHDL00",
    "name": "Daylight",
    "state": {
      "dark": false,
      "daylight": true,
      "lastupdated": "2019-01-07T08:00:05",
      "status": 160
    },
    "swversion": "1.0",
    "type": "Daylight",
    "uniqueid": "00:21:2e:ff:ff:02:f4:7b-01"
  },
  "2": {
    "config": {
      "battery": 91,
      "offset": 0,
      "on": true,
      "reachable": true
    },
    "ep": 1,
    "etag": "58815aa15a9ee348bb7b072b56d3ea58",
    "manufacturername": "LUMI",
    "modelid": "lumi.weather",
    "name": "MultiTemp 1",
    "state": {
      "lastupdated": "2019-01-07T09:41:39",
      "temperature": 1904
    },
    "swversion": "20161129",
    "type": "ZHATemperature",
    "uniqueid": "00:15:8d:00:02:c8:d2:68-01-0402"
  },
  "3": {
    "config": {
      "battery": 91,
      "offset": 0,
      "on": true,
      "reachable": true
    },
    "ep": 1,
    "etag": "58815aa15a9ee348bb7b072b56d3ea58",
    "manufacturername": "LUMI",
    "modelid": "lumi.weather",
    "name": "MultiTemp 1",
    "state": {
      "humidity": 5960,
      "lastupdated": "2019-01-07T09:41:39"
    },
    "swversion": "20161129",
    "type": "ZHAHumidity",
    "uniqueid": "00:15:8d:00:02:c8:d2:68-01-0405"
  },
  "4": {
    "config": {
      "battery": 91,
      "on": true,
      "reachable": true
    },
    "ep": 1,
    "etag": "58815aa15a9ee348bb7b072b56d3ea58",
    "manufacturername": "LUMI",
    "modelid": "lumi.weather",
    "name": "MultiTemp 1",
    "state": {
      "lastupdated": "2019-01-07T09:41:39",
      "pressure": 987
    },
    "swversion": "20161129",
    "type": "ZHAPressure",
    "uniqueid": "00:15:8d:00:02:c8:d2:68-01-0403"
  },
  "5": {
    "config": {
      "battery": 100,
      "on": true,
      "reachable": true,
      "temperature": 2400
    },
    "ep": 1,
    "etag": "fe14624c1ea72f54861ebf785eb82fe5",
    "manufacturername": "LUMI",
    "modelid": "lumi.sensor_magnet.aq2",
    "name": "OpenClose 1",
    "state": {
      "lastupdated": "2019-01-07T09:02:39",
      "open": false
    },
    "swversion": "20161128",
    "type": "ZHAOpenClose",
    "uniqueid": "00:15:8d:00:02:c9:4a:7f-01-0006"
  }
}

this is a rest api call to my sensors…

i can program java and c++ but havent gotten a deeper look into the source code of the binding since i have no clue how to program bindings for openhab2, just checked all files and the structure of the things to discover looks ok to me

i disabled the hue binding now, and forced my things and items files as i assume it should be correct. Those items do not appear in the Paper UI for me whatsoever, neither the bridge nor the sensors.i stopped openhab2 service, cleared the cache and restarted it, still no change for me. i see the changes in deconz and the Phoscon-GW, but not in openhab.

Bridge deconz:deconz:00212E02F47B                  "Phoscon Bridge BĂźro"   [ ipAddress="192.168.178.213", userName="08xxxxxx17"] {        
    temperaturesensor   livingroom-temperature  "Livingroom Temperature"    [ id="2" ]
    humiditysensor      livingroom-humidity     "Livingroom Humidity"       [ id="3" ]
    openclosesensor     livingroom-window       "Livingroom Window"         [ id="5" ]
}

and

Number:Temperature      Livingroom_Temperature  "Temperature Livingroom [%.1f °C]"  <temperature>   { channel="deconz:temperaturesensor:00212E02F47B:livingroom-temperature:temperature" }
Number:Dimensionless    Livingroom_Humidity     "Humidity Livingroom [%.1f %%]"     <humidity>      { channel="deconz:humiditysensor:00212E02F47B:livingroom-humidity:humidity" }
Contact                 Livingroom_Window       "Window Livingroom [%s]"            <door>          { channel="deconz:openclosesensor:00212E02F47B:livingroom-window:open" }

those dont report any values or anything to me.

and here is the log from the openhab 2.5 snapshot … addons folder says 2.5.0-SNAPSHOT

2019-01-07 12:13:48.122 [hingStatusInfoChangedEvent] - 'deconz:deconz:00212E02F47B' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_CONFIGURATION_PENDING)

2019-01-07 12:13:48.134 [hingStatusInfoChangedEvent] - 'deconz:temperaturesensor:00212E02F47B:livingroom-temperature' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)

2019-01-07 12:13:48.142 [hingStatusInfoChangedEvent] - 'deconz:humiditysensor:00212E02F47B:livingroom-humidity' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)

2019-01-07 12:13:48.149 [hingStatusInfoChangedEvent] - 'deconz:openclosesensor:00212E02F47B:livingroom-window' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)

I have no time to read your post in detail, but you should know this:

The hue binding and Deconz binding are independent. They can run alone or together.

A Deconz software instance is like a real hue bridge and will be found by the hue emulation and also android apps etc. The Webinterface of Deconz will also find openHAB If it is using the hue emulation.

So you need both, the hue binding and Deconz binding if you want lamps and real time sensors from Deconz.