openhab / openhab-addons

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

[miio] Bedside lamp channels not initialized after OH startup #8045

Closed lkxnon closed 4 years ago

lkxnon commented 4 years ago

Expected Behavior

Mi Bedside Lamp (yeelink.light.bslamp2) after OpenHAB startup expected to bring on all defined items for control

Current Behavior

Once OH is restarted (maintenance or power cycle) there is specific problem with Lamp as it is not possible for control, Channels are not being initialized correctly and there are Network and Actions channels only.

Thing defined: Thing miio:basic:bedside "Bedside Lamp" [ host="XXX", token="XXX", deviceId="XXX" ]

8 Items defined: Switch bedside_power "Bedside Power" (G_light) {channel="miio:basic:bedside:power"} Dimmer bedside_brightness "BedsideBrightness" (G_light) {channel="miio:basic:bedside:brightness"} String bedside_delayoff "Bedside Shutdown Timer" (G_light) {channel="miio:basic:bedside:delayoff"} Number bedside_colorTemperature "Bedside Color Temperature" (G_light) {channel="miio:basic:bedside:colorTemperature"} String bedside_colorMode "Bedside Color Mode" (G_light) {channel="miio:basic:bedside:colorMode"} Switch bedside_toggle "Bedside toggle" (G_light) {channel="miio:basic:bedside:toggle"} Color bedside_rgbColor "Bedside RGB Color" (G_light) {channel="miio:basic:bedside:rgbColor"} String bedside_name "Bedside Name" (G_light) {channel="miio:basic:bedside:name"}

Log after startup:

2020-06-30 13:43:21.320 [hingStatusInfoChangedEvent] - 'miio:basic:bedside' changed from UNINITIALIZED to INITIALIZING 2020-06-30 13:43:21.342 [hingStatusInfoChangedEvent] - 'miio:basic:bedside' changed from INITIALIZING to OFFLINE 2020-06-30 13:43:31.369 [hingStatusInfoChangedEvent] - 'miio:basic:bedside' changed from OFFLINE to ONLINE 2020-06-30 13:43:31.452 [me.event.ThingUpdatedEvent] - Thing 'miio:basic:bedside' has been updated. 2020-06-30 13:43:31.455 [me.event.ThingUpdatedEvent] - Thing 'miio:basic:bedside' has been updated.

Possible Solution

Only solution is to go to Paper UI, find "Bedside Lamp" thing and disable/enable. After this re-cycle, all items are loaded correctly.

Log after re-enable: 2020-06-30 13:50:27.221 [hingStatusInfoChangedEvent] - 'miio:basic:bedside' changed from ONLINE to UNINITIALIZED 2020-06-30 13:50:27.269 [hingStatusInfoChangedEvent] - 'miio:basic:bedside' changed from UNINITIALIZED to UNINITIALIZED (DISABLED) 2020-06-30 13:50:31.803 [hingStatusInfoChangedEvent] - 'miio:basic:bedside' changed from UNINITIALIZED (DISABLED) to INITIALIZING 2020-06-30 13:50:31.827 [hingStatusInfoChangedEvent] - 'miio:basic:bedside' changed from INITIALIZING to OFFLINE 2020-06-30 13:50:41.844 [me.event.ThingUpdatedEvent] - Thing 'miio:basic:bedside' has been updated. 2020-06-30 13:50:41.856 [hingStatusInfoChangedEvent] - 'miio:basic:bedside' changed from OFFLINE to ONLINE 2020-06-30 13:50:41.968 [vent.ItemStateChangedEvent] - bedside_power changed from NULL to OFF 2020-06-30 13:50:41.974 [vent.ItemStateChangedEvent] - bedside_brightness changed from NULL to 1 2020-06-30 13:50:41.982 [vent.ItemStateChangedEvent] - bedside_delayoff changed from NULL to 1970-01-01T00:00:00.000+0000 2020-06-30 13:50:41.984 [vent.ItemStateChangedEvent] - bedside_colorTemperature changed from NULL to 3000 2020-06-30 13:50:41.985 [vent.ItemStateChangedEvent] - bedside_colorMode changed from NULL to 2 2020-06-30 13:50:41.987 [vent.ItemStateChangedEvent] - bedside_rgbColor changed from NULL to 45,69,69 2020-06-30 13:50:41.988 [vent.ItemStateChangedEvent] - bedside_name changed from NULL to

Steps to Reproduce (for Bugs)

  1. Restart OH
  2. Check Thing "Bedside Lamp" for channels, and there are only few non-lamp related (RSSI, signal)

Context

Manual activity always needed after unexpected reboot or power outage.

Your Environment

marcelrv commented 4 years ago

Try to include the model to see if fixes the issue at hand. Is this right after restarting OH. You may need to give it a bit of time to settle (2-3 min should be more than sufficient assuming your refresh is set to default 30s), many devices have not strong network connectivity and may need few tries before the connection is there.

Thing miio:vacuum:s50 "vacuum" @ "livingroom" [ host="192.168.15.20", token="xxxxxxx", deviceId=“0470DDAA”, model="roborock.vacuum.s5" ]

I added this line docu for future reference #8046

lkxnon commented 4 years ago

Thanks Marcel, I have included model and seems this is working as expected now. Restared OH and lamp channels are loading immediately during startup. So I think this can be closed, no bug :)