fsaris / home-assistant-awox

AwoX mesh light integration for Home Assistant
MIT License
83 stars 23 forks source link

Light has minimal brightness when turned on from Logitech Harmony #63

Closed Slion closed 1 year ago

Slion commented 1 year ago

Probably not an issue with this integration but still I thought I'll report that here first.

Device Info: ECeil G30 Firmware 2.2.6 home-assistant-awox v0.1.3b3

Exposed this device to Logitech Harmony through Emulated Hue when I turn on and off the light through the Web UI the brightness remains unchanged as expected. When I turn on the light through Harmony remote the brightness is reset to minimal levels.

I guess I should look at Emulated Hue see if that can be fixed from there. Hopefully Harmony itself it not responsible for that.

fsaris commented 1 year ago

Can you enable debug logging (https://github.com/fsaris/home-assistant-awox#troubleshooting) and then turn off/on the light using the remote and using the web UI and post the logs here.

Logs can be find going to Settings -> System -> Logs

Slion commented 1 year ago

Enabled the logs, restarted HA and got that:

Failed to start scan: Timeout exceeded. <pexpect.pty_spawn.spawn object at 0x7fa3b22410> command: /usr/bin/bluetoothctl args: [b'/usr/bin/bluetoothctl'] buffer (last 100 chars): '\x1b[0m\x02] Device 48:B0:2D:5D:C3:61 RSSI: -76\r\n[\x01\x1b[0;93m\x02CHG\x01\x1b[0m\x02] Device 48:B0:2D:5D:C3:61 RSSI: -75\r\n' before (last 100 chars): '\x1b[0m\x02] Device 48:B0:2D:5D:C3:61 RSSI: -76\r\n[\x01\x1b[0;93m\x02CHG\x01\x1b[0m\x02] Device 48:B0:2D:5D:C3:61 RSSI: -75\r\n' after: <class 'pexpect.exceptions.TIMEOUT'> match: None match_index: None exitstatus: None flag_eof: False pid: 99 child_fd: 50 closed: False timeout: 30 delimiter: <class 'pexpect.exceptions.EOF'> logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 searcher: searcher_re: 0: re.compile('bluetooth') 1: EOF
10:37:05 – (ERROR) AwoX MESH control (custom integration)

All devices are offline now. How can I restart the scan? Shall I restart HA?

fsaris commented 1 year ago

How can I restart the scan? Shall I restart HA?

Restart HA or only the Awox integration

Slion commented 1 year ago

Restart HA or only the Awox integration

Is that the Reload option from the integration menu? HA noob here 😁

fsaris commented 1 year ago

Use the 3 dots menu of the integration card and click reload.

IMG_20220918_111229

Slion commented 1 year ago

Here it is, it looks like the Living room brightness goes from 69 to 1 at some point. All I did was switch off that Living room light from Logitech Harmony Elite remote and trun it back on. Though the issue really is when I turn it back on. If I turn it off from the Eglo remote but then turn it back on from Harmony the brightness goes to minimal. A lot of noise in those logs because I had all devices turned on.

awox-first-logs.txt

Slion commented 1 year ago

Here is a more focused section of the above logs. I reckon that's where the we can see the Living room light was first turned off and then turned on a few seconds later with brightness set to 1, not sure which component sets that brightness, is that Emulated Hue, Harmony or this integration somehow?

2022-09-18 11:08:08.748 DEBUG (MainThread) [custom_components.awox.light] [awoxmesh-17479] turn off
2022-09-18 11:08:08.749 INFO (MainThread) [custom_components.awox.awox_mesh] Queue command off {'dest': 17479}
2022-09-18 11:08:08.752 DEBUG (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awox_mesh] process 0/0 - {'command': 'off', 'params': {'dest': 17479}, 'callback': <function AwoxMesh._async_add_command_to_queue.<locals>.command_executed at 0x7f60e22a70>, 'allow_to_fail': False}
2022-09-18 11:08:08.762 INFO (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awoxmeshlight] [a4:c1:38:6a:5e:11][17479] Writing command 208 data b'\x00'
2022-09-18 11:08:08.895 DEBUG (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awox_mesh] Command result: True
2022-09-18 11:08:08.896 DEBUG (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awox_mesh] get item from queue
2022-09-18 11:08:08.906 DEBUG (MainThread) [custom_components.awox.light] [awoxmesh-17479][Living room] mode[color_temp] Status callback: {'state': False}
2022-09-18 11:08:09.679 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] Received notification bytearray(b'\x80\xf4K\x00\x00\x17\x99\xdc`\x01G\xf8\x01E\x1d6\xff\x003D')
2022-09-18 11:08:09.680 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] parsed status {'type': 'notification', 'mesh_id': 17479, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 29, 'white_brightness': 69, 'color_brightness': 54}
2022-09-18 11:08:09.680 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [17479][Living room] mesh_status_callback({'type': 'notification', 'mesh_id': 17479, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 29, 'white_brightness': 69, 'color_brightness': 54})
2022-09-18 11:08:09.681 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [17479][Living room] skipping all non status callbacks
2022-09-18 11:08:11.205 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] Received notification bytearray(b'\xbb\x1d5\x00\x00\\|\xdc`\x01\xbc\x00)\x00\x00\x00\x00\x00\x00R')
2022-09-18 11:08:11.206 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] parsed status {'type': 'notification', 'mesh_id': 21180, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 0, 'green': 0, 'blue': 0, 'white_temperature': 0, 'white_brightness': 0, 'color_brightness': 0}
2022-09-18 11:08:11.206 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [21180][Wifi Hub] mesh_status_callback({'type': 'notification', 'mesh_id': 21180, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 0, 'green': 0, 'blue': 0, 'white_temperature': 0, 'white_brightness': 0, 'color_brightness': 0})
2022-09-18 11:08:11.207 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [21180][Wifi Hub] skipping all non status callbacks
2022-09-18 11:08:11.972 DEBUG (MainThread) [custom_components.awox.light] [awoxmesh-17479] Turn on {'brightness': 1}
2022-09-18 11:08:11.973 INFO (MainThread) [custom_components.awox.awox_mesh] Queue command setWhiteBrightness {'brightness': 1, 'dest': 17479}
2022-09-18 11:08:11.978 DEBUG (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awox_mesh] process 0/0 - {'command': 'setWhiteBrightness', 'params': {'brightness': 1, 'dest': 17479}, 'callback': <function AwoxMesh._async_add_command_to_queue.<locals>.command_executed at 0x7f60e66c20>, 'allow_to_fail': False}
2022-09-18 11:08:11.997 INFO (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awoxmeshlight] [a4:c1:38:6a:5e:11][17479] Writing command 241 data b'\x01'
2022-09-18 11:08:12.112 DEBUG (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awox_mesh] Command result: True
2022-09-18 11:08:12.113 DEBUG (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awox_mesh] get item from queue
2022-09-18 11:08:12.118 DEBUG (MainThread) [custom_components.awox.light] [awoxmesh-17479][Living room] mode[color_temp] Status callback: {'state': True, 'white_brightness': 1}
2022-09-18 11:08:12.814 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] Received notification bytearray(b'\xf4\x9eF\x00\x00W\xa7\xdc`\x01\xcf\x00\x01%Q\x1d\xff\x003c')
2022-09-18 11:08:12.815 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] parsed status {'type': 'notification', 'mesh_id': 25551, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 81, 'white_brightness': 37, 'color_brightness': 29}
2022-09-18 11:08:12.816 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [25551][Bathroom] mesh_status_callback({'type': 'notification', 'mesh_id': 25551, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 81, 'white_brightness': 37, 'color_brightness': 29})
2022-09-18 11:08:12.816 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [25551][Bathroom] skipping all non status callbacks
2022-09-18 11:08:13.928 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] Received notification bytearray(b'\x03qf\x00\x00.\x83\xdc`\x01\xcf\\\x01%Q\x1d\xff\x003c')
2022-09-18 11:08:13.929 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] parsed status {'type': 'notification', 'mesh_id': 25551, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 81, 'white_brightness': 37, 'color_brightness': 29}
2022-09-18 11:08:13.930 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [25551][Bathroom] mesh_status_callback({'type': 'notification', 'mesh_id': 25551, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 81, 'white_brightness': 37, 'color_brightness': 29})
2022-09-18 11:08:13.931 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [25551][Bathroom] skipping all non status callbacks
2022-09-18 11:08:14.341 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] Received notification bytearray(b'yx1\x00\x00$\x19\xdc`\x01\xbcP)\x00\x00\x00\x00\x00\x00R')
2022-09-18 11:08:14.342 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] parsed status {'type': 'notification', 'mesh_id': 21180, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 0, 'green': 0, 'blue': 0, 'white_temperature': 0, 'white_brightness': 0, 'color_brightness': 0}
2022-09-18 11:08:14.342 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [21180][Wifi Hub] mesh_status_callback({'type': 'notification', 'mesh_id': 21180, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 0, 'green': 0, 'blue': 0, 'white_temperature': 0, 'white_brightness': 0, 'color_brightness': 0})
2022-09-18 11:08:14.343 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [21180][Wifi Hub] skipping all non status callbacks
2022-09-18 11:08:14.959 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] Received notification bytearray(b'\xd5\xfd]\x00\x00\x7f6\xdc`\x01G\x00\x01E\x1d6\xff\x003D')
2022-09-18 11:08:14.960 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] parsed status {'type': 'notification', 'mesh_id': 17479, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 29, 'white_brightness': 69, 'color_brightness': 54}
2022-09-18 11:08:14.960 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [17479][Living room] mesh_status_callback({'type': 'notification', 'mesh_id': 17479, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 29, 'white_brightness': 69, 'color_brightness': 54})
2022-09-18 11:08:14.961 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [17479][Living room] skipping all non status callbacks
2022-09-18 11:08:17.002 INFO (MainThread) [custom_components.awox.awox_mesh] async_update: Request status
2022-09-18 11:08:17.003 INFO (MainThread) [custom_components.awox.awox_mesh] Queue command requestStatus {'dest': 65535, 'withResponse': True}
2022-09-18 11:08:17.006 DEBUG (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awox_mesh] process 0/0 - {'command': 'requestStatus', 'params': {'dest': 65535, 'withResponse': True}, 'callback': <function AwoxMesh._async_add_command_to_queue.<locals>.command_executed at 0x7f60e67520>, 'allow_to_fail': False}
2022-09-18 11:08:17.013 DEBUG (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awoxmeshlight] requestStatus(65535)
2022-09-18 11:08:17.015 INFO (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awoxmeshlight] [a4:c1:38:6a:5e:11][65535] Writing command 218 data b'\x10'
2022-09-18 11:08:17.148 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] Received notification bytearray(b'\xcc\xa0\x8b\x11^\xe8]\xdb`\x01\tDe5\xff\x003\x00\x00\x00')
2022-09-18 11:08:17.149 DEBUG (Thread-9) [custom_components.awox.awoxmeshlight] parsed status {'type': 'status', 'mesh_id': 24081, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 101, 'white_brightness': 68, 'color_brightness': 53}
2022-09-18 11:08:17.149 INFO (Thread-9) [custom_components.awox.awoxmeshlight] Update device status - mesh_id 24081
2022-09-18 11:08:17.149 DEBUG (Thread-9) [custom_components.awox.awox_mesh] [24081][Office] mesh_status_callback({'type': 'status', 'mesh_id': 24081, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 101, 'white_brightness': 68, 'color_brightness': 53})
2022-09-18 11:08:17.150 DEBUG (Thread-9) [custom_components.awox.light] [awoxmesh-24081][Office] mode[color_temp] Status callback: {'type': 'status', 'mesh_id': 24081, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 101, 'white_brightness': 68, 'color_brightness': 53}
2022-09-18 11:08:17.152 DEBUG (AwoxMeshCommands-dwTTl1TG) [custom_components.awox.awox_mesh] Command result: True
fsaris commented 1 year ago

The integration just passes the command to the light/device.

It gets the command to turn the light on with a specific brightness.

[custom_components.awox.light] [awoxmesh-17479] Turn on {'brightness': 1}

The state of the light has a different white_brightness before this comment (just after it was turned off)

[custom_components.awox.awox_mesh] [17479][Living room] mesh_status_callback({'type': 'notification', 'mesh_id': 17479, 'state': True, 'color_mode': False, 'transition_mode': False, 'red': 255, 'green': 0, 'blue': 51, 'white_temperature': 29, 'white_brightness': 69, 'color_brightness': 54})

So probably it's the HUE emulator if you used that to turn on the light that sets the brightness to 1.

Slion commented 1 year ago

Yeah that was my guess too that's why I already reported that issue to Emulated Hue. Let's see if they can do something about it.

Slion commented 1 year ago

Though sometimes it works. I'm wonder how Emulated Hue decides which brightness to set. Is it relying on what this integration is reporting as brightness before hand?

Slion commented 1 year ago

Could we have an option to not set the brightness when turning on a device? It looks like the brightness setting is part of the turn on device command. Could we have an option to ignore that initial brightness and just turn on the device? Assuming the device would just use whatever brightness it had before. That could workaround the issue.

Slion commented 1 year ago

I commented out the code that sets the brightness in async_turn_on from light.py and after restarting HA it seems to have fixed the issue. Having this as an option should definitely workaround that issue then. I don't have a use case that needs it anyway.

BTW just reloading the integration did not recompile the module it seems. I needed to restart HA for the code changes to apply. Is that the expected behaviour?

Slion commented 1 year ago

I commented out the code that sets the brightness in async_turn_on from light.py and after restarting HA it seems to have fixed the issue. Having this as an option should definitely workaround that issue then. I don't have a use case that needs it anyway.

Actually it breaks the setting of brightness in general not just the setting of brightness when the light is turned on. That would only work if we could use different code path for those two use cases.

fsaris commented 1 year ago

The method async_turn_on is what HA call's to turn on the light and adjust the brightness and color.

You see in the debug logging that HA is passing the brightness value 1. So first we need to determine where this value comes from.

Slion commented 1 year ago

The method async_turn_on is what HA call's to turn on the light and adjust the brightness and color.

You see in the debug logging that HA is passing the brightness value 1. So first we need to determine where this value comes from.

You are absolutely correct. I was just trying to find a cheap workaround. Made a few guesses about what could be going on but really someone would need to look into the Emulated Hue code. There was a similar bug that was reported back in February and the Emulated Hue code owner never bothered commenting then it got automatically closed by bots. It is fair to assume we won't get support on that side 😁

fsaris commented 1 year ago

closed as this is out-of-range for this integration