openhab / openhab-addons

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

[Netatmo] Room-Thing offline after restart #13403

Closed mdillmann closed 2 years ago

mdillmann commented 2 years ago

Expected Behavior

Room thing still online after restart of OH

Current Behavior

If a room-action is defined, the room-thing is initially online. But after a restart of OH it stays offline.

Possible Solution

Race condition initializing actionhandler before room-thing is initialized.

Steps to Reproduce (for Bugs)

  1. define a room-action (in my case in a .rules file)
  2. restart OH

Log-Entries:

2022-09-14 14:58:10.726 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Initializing Netatmo API bridge handler.
2022-09-14 14:58:10.766 [DEBUG] [tatmo.internal.handler.DeviceHandler] - Initializing handler for bridge netatmo:home:f1a78f54ab:59cf54c5ae4763a9f18b4fdf
2022-09-14 14:58:10.770 [DEBUG] [.netatmo.internal.action.RoomActions] - Netatmo RoomActions service created
2022-09-14 14:58:10.771 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler ModuleHandler of thing netatmo:room:aa:bb:cc tried accessing its bridge although the handler was already disposed.
2022-09-14 14:58:10.790 [DEBUG] [tatmo.internal.handler.DeviceHandler] - Initializing handler for bridge netatmo:plug:aa:bb:dd
2022-09-14 14:58:10.799 [DEBUG] [tatmo.internal.handler.ModuleHandler] - Initializing handler for thing netatmo:room:aa:bb:cc
2022-09-14 14:58:10.824 [DEBUG] [tatmo.internal.handler.ModuleHandler] - Initializing handler for thing netatmo:valve:a:b:dd:ee

If the roomaction is removed, cache-cleaned and OH restarted the problem is gone

Your Environment

Observed in OH 3.3 release OH 3.4 M2

mdillmann commented 2 years ago

@clinique : I suspect the call-chain starting here energy = commonHandler.getHomeCapability(EnergyCapability.class); in the setThingHandler to cause the race.

Code changed much with the introduction of "CommonInterface" and the capabilities and I can't figure out the flow.

clinique commented 2 years ago

@clinique : I suspect the call-chain starting here energy = commonHandler.getHomeCapability(EnergyCapability.class); in the setThingHandler to cause the race.

Code changed much with the introduction of "CommonInterface" and the capabilities and I can't figure out the flow.

You're correct, I land in the same place. Let's have a look at this.

openhab-bot commented 1 year ago

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

https://community.openhab.org/t/adding-a-bticino-smarther2-thermostat-using-the-openhab-netatmo-binding/144560/1