openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[deconz] Gateway stays offline after OH restart: Error while connecting: Destroyed container cannot be restarted #13141

Closed MHerbst closed 1 year ago

MHerbst commented 2 years ago

After I have updated OH to version 3.3 the deCONZ binding hast start problems. After OH is restarted the gateway stays offline and the log file contains logs of these messages.

2022-07-18 19:27:12.654 [WARN ] [nternal.netutils.WebSocketConnection] - Websocket$1658164761230-1 trying to re-connect while still disconnecting

After manually stopping and starting the gateway thing the binding works fine again and the Websocket message no longer appears.

There are also some these interesting messages in openhab.log (maybe not related to the problem):

[DEBUG] [ding.deconz.internal.types.GroupType] - Unknown group type 'Luminaire' found. This should be reported.
[DEBUG] [rnal.discovery.ThingDiscoveryService] - Found group: 2 (FLS-PP3 helper1 for group 1), type UNKNOWN but no thing type defined for that type. This should be reported.

There were not problems with OH 3.2

Steps to Reproduce (for Bugs)

Stop and start openHAB

Your Environment

I have attached a log file with DEBUG messages openhab.log

MattSty commented 2 years ago

Faced this night the same issue. Running OH 3.3 on Windows with Zulu and Conbee 2 on Raspberry 4. Before update to 3.3 never had this issue.

openhab-bot commented 2 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/deconz-binding-show-error-after-oh-3-3-restart/137699/1

openhab-bot commented 2 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/communication-error-with-conbee-2-since-upgrading-to-openhab-3-3-0/138324/4

Novanic commented 2 years ago

I got this problem last night without restarting OpenHAB (for months). I don't find a log message but the deconz bridge thing was offline with COMMUNICATION ERROR and "Error while connecting: Destroyed container cannot be restarted". Deactivating and activating the bridge thing solved that problem (so an automatic reconnect should also be possible... ;-)).

I hope this can get improved/fixed soon. It's very annoying when the lights randomly aren't working anymore...

nilleiz commented 2 years ago

Hi, just noticed that de-/activating helps, how do you automate this?

Sven Strohschein @.***> schrieb am Sa., 3. Sept. 2022, 21:39:

I got this problem last night without restarting OpenHAB (for months). I don't find a log message but the deconz bridge thing was offline with COMMUNICATION ERROR and "Error while connecting: Destroyed container cannot be restarted". Deactivating and activating the bridge thing solved that problem (so an automatic reconnect should also be possible... ;-)).

I hope this can get improved/fixed soon. It's very annoying when the lights randomly aren't working anymore...

— Reply to this email directly, view it on GitHub https://github.com/openhab/openhab-addons/issues/13141#issuecomment-1236187864, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFDAWAHCBI4RBRTYKUSJ2QLV4OSQFANCNFSM535BJQZQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Novanic commented 2 years ago

I haven't automated it. I mean it should be possible to fix the binding, that the binding do the reconnect automatically. Unfortunately the binding seem to have no maintainer, therefore this ticket isn't assigned and nobody seems to fix that... :-(

Novanic commented 2 years ago

13132 reports that there are more issues which have currently solved manually by deactivating/activating the binding... :-(

nilleiz commented 2 years ago

I haven't automated it. I mean it should be possible to fix the binding, that the binding do the reconnect automatically. Unfortunately the binding seem to have no maintainer, therefore this ticket isn't assigned and nobody seems to fix that... :-(

image

Script should look like this:

Thread::sleep(45000)

sendHttpPutRequest("http://user:password@openhabhost:8080/rest/things/deconz%3Adeconz%3A00212E06B3E4/enable", "text/plain", 'false')

Thread::sleep(10000)  

sendHttpPutRequest("http://user:password@openhabhost:8080/rest/things/deconz%3Adeconz%3A00212E06B3E4/enable", "text/plain", 'true')

Just replace the thing path with your UID and "user" and "password" with your admin user. This will de- and reactivate the deconz bridge thing on startup and on thing becoming offline.

msandres13 commented 2 years ago

I am using this script which I started in a screen session for now. I am trying to get this working also as a systemd service but wasnt successful sofar.

#!/usr/bin/env bash
set -x
set -e
export COMPOSE_INTERACTIVE_NO_CLI=1
while :
  do read line
     echo "==> found error pattern ${line}"
     docker-compose exec -T openhab /openhab/runtime/bin/client -p habopen bundle:restart org.openhab.binding.deconz
done < <(tail -F /srv/openhab3/openhab_userdata/logs/openhab.log | grep --line-buffered -F "Get full state failed")
waywit commented 1 year ago

I have exactly the same issue here, after a reboot the conee gateway is offline, clicking on "Pause" and "Play" it goes immediately online. But additionally all my sensors (Xiaomi OpenClose, Presence, Temperature, Pressure, Humidity, ...) stay offline too. After some minutes/hours of waiting to go online again sometimes the OpenClose and Presence sensors are back online, but the rest need also a click on "Pause" and "Play" in PaperUI to get back online immediately.

Any idea how to workaround till a bugfix is available? I am pretty new to scripting in openhab, and did not get how and where to put them and to run them, perhaps there is a good tutorial?

waywit commented 1 year ago

Hi, clearing the openhanded cache has helped me and the issue is gone now.

  1. Stop openhab
  2. openhab-cli clean-cache
  3. Start openhab
MattSty commented 1 year ago

On my setup this didn't help. Error came also after clearing cache :(

jlaur commented 1 year ago

@MHerbst - are you planning on back porting the smarthomej fixes? I'd be happy to review.

MHerbst commented 1 year ago

@jlaur Please excuse my late answer. I am a bit busy at the moment. I will try to find allocate time in the next days to compare both source version. As far as I remember, the SmarthomeJ implementation contains not only fixes but only some enhanced settings with regard to the websocket handling.

Redsandro commented 1 year ago

13368 might be a duplicate. #13740 seems the exact opposite: gateway stays offline after DeCONZ restart, but is fixed after OH restart. Am curious if the latter and similar issues would be solved by this just the same.

J-N-K commented 1 year ago

Fixed with #14622

Redsandro commented 1 year ago

Sweet! :+1: Thank you.