fsaris / home-assistant-awox

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

Sometimes lights "miss" an update #69

Closed dom11990 closed 1 year ago

dom11990 commented 1 year ago

hey again,

I've been using the control more exhaustively and noticed that sometimes one of the lights will be skipped and require multiple calls for it to register the new values. This is particularly annoying when switching between color mods (rgb and whatever the other one is called). When controlling the lights manually it is not so critical because the user can just push the button agian, but from an automation perspective it is a real problem. What is the recommended way of dealing with this issue? Can a write/verify mode be activated somehow that ensures the light registered the update?

fsaris commented 1 year ago

@dom11990 the integration does already some verification step. It expects a response when a commands is send. When no response is received it is sent again but can take a few seconds.

Can you enable debug logging, trigger your lights and post the logs here?

I didn't encounter a "miss" myself. When I trigger multiple lights (give a group of lights a different color) it can take a few seconds but it will update the lights correctly.

dom11990 commented 1 year ago

I have 4 lights in a group and one of them seems to have switched out of rgb mode. This is one of the things that seem to randomly happen.

@fsaris thanks for looking into it!

log.txt

fsaris commented 1 year ago

Is it the front door light that behaves different? I see some setWhiteBrightness commands for that specific light. The others seem to receive setColorBrightness. Do you use a scene too enable the light's?

dom11990 commented 1 year ago

It seems to be random, which light misbehaves. I was using the default card for controlling RGB lights but with a light group instead of a single light entity. Can using a scene cause this?

dom11990 commented 1 year ago

I noticed when I call bluetoothctl my bt adapter seems to be in a hard scan loop with no waits in between, is this expected?

fsaris commented 1 year ago

It seems to be random, which light misbehaves. I was using the default card for controlling RGB lights but with a light group instead of a single light entity. Can using a scene cause this?

Will do some tests during the weekend. Are they all the same lights?

I noticed when I call bluetoothctl my bt adapter seems to be in a hard scan loop with no waits in between, is this expected?

Do you have the HA Bluetooth integration enabled?

dom11990 commented 1 year ago

They are all the same lights with the same firmware versions. Yes I do have the HA bluetooth integration enabled.

fsaris commented 1 year ago

They are all the same lights with the same firmware versions. Yes I do have the HA bluetooth integration enabled.

Could you test with HA Bluetooth integration disabled? What version of HA are you using?

dom11990 commented 1 year ago

I'm now not able to reproduce the behavior :( I deleted one of the scenes I had defined using the lights. It was not being called as far as I could tell. I also updated to the latest version of HA. I'll keep trying to stress the lights a bit this weekend. If I'm unable to produce the issue again I'll close the issue.

How does the system respond when two bluetooth controllers are present? Can I blacklist one somehow? I noticed that the BT on my Pi3 seems to get hung up and it wouldnt detect the lights at all. I added the BT Integration fort it and then disabled it. I also added a stick and it was since running more reliably (except for this strange issue I posted about).

fsaris commented 1 year ago

How does the system respond when two bluetooth controllers are present?

Currently it will connect to the first controller (hci0). Will check if this can be made configurable.

dom11990 commented 1 year ago

Unfortunately, I'm not able to test any further because the lights arent being detected anymore. The log is full of timeouts. I deleted both of the bluetooth integrations I had but this seems to not improve the situation. Any idea what could be causing this? I'm on the RPi3 and of course it would be ideal if I could just use the onboard BT instead of an external USB adapter.

2022-10-17 09:45:54.861 INFO (MainThread) [custom_components.awox.awox_mesh] [SmbZcgdC][Shower][a4:c1:38:00:43:f9] Device NOT found during Bluetooth scan 2022-10-17 09:45:54.861 INFO (MainThread) [custom_components.awox.awox_mesh] [SmbZcgdC][Turn][a4:c1:38:05:9e:49] Bluetooth scan returns no RSSI value 2022-10-17 09:45:54.862 INFO (MainThread) [custom_components.awox.awox_mesh] [SmbZcgdC][Kids][a4:c1:38:01:c5:15] Bluetooth scan returns no RSSI value 2022-10-17 09:45:54.862 INFO (MainThread) [custom_components.awox.awox_mesh] [SmbZcgdC][Bear][a4:c1:38:78:b8:ac] Bluetooth scan returns no RSSI value 2022-10-17 09:45:54.862 INFO (MainThread) [custom_components.awox.awox_mesh] [SmbZcgdC][Front Door][a4:c1:38:83:e8:35] Bluetooth scan returns no RSSI value 2022-10-17 09:45:54.863 INFO (MainThread) [custom_components.awox.awox_mesh] [SmbZcgdC][Bed][a4:c1:38:24:7f:a8] Device NOT found during Bluetooth scan 2022-10-17 09:45:54.864 INFO (MainThread) [custom_components.awox.awox_mesh] [SmbZcgdC] Queue command requestStatus {'dest': 65535, 'withResponse': True} 2022-10-17 09:46:01.916 ERROR (SyncWorker_1) [custom_components.awox.awoxmeshlight] Timed out connecting to a4:c1:38:78:b8:ac after 15 seconds. 2022-10-17 09:46:01.927 INFO (MainThread) [custom_components.awox.awox_mesh] [SmbZcgdC][Bear][a4:c1:38:78:b8:ac] Failed to connect, trying next device [NotConnectedError] Timed out connecting to a4:c1:38:78:b8:ac after 15 seconds. 2022-10-17 09:46:01.928 DEBUG (MainThread) [custom_components.awox.awox_mesh] [SmbZcgdC][Bear][a4:c1:38:78:b8:ac] Setting up Bluetooth connection failed, making sure Bluetooth device stops trying 2022-10-17 09:46:01.930 DEBUG (SyncWorker_8) [custom_components.awox.awoxmeshlight] [SmbZcgdC][a4:c1:38:78:b8:ac] Force stopping ble adapter 2022-10-17 09:46:02.238 WARNING (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] Command failed, retry 2 2022-10-17 09:46:02.248 WARNING (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] Command failed, retry 3 2022-10-17 09:46:02.255 DEBUG (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] get item from queue 2022-10-17 09:46:02.256 DEBUG (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] process 0/21 - {'command': 'requestStatus', 'params': {'dest': 65535, 'withResponse': True}, 'callback': <function AwoxMesh._async_add_command_to_queue.<locals>.command_executed at 0x7f8af5c430>, 'allow_to_fail': False} 2022-10-17 09:46:02.261 WARNING (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] Command failed, retry 1 2022-10-17 09:46:02.270 WARNING (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] Command failed, retry 2 2022-10-17 09:46:02.277 WARNING (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] Command failed, retry 3 2022-10-17 09:46:02.285 DEBUG (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] get item from queue 2022-10-17 09:46:02.285 DEBUG (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] process 0/20 - {'command': 'requestStatus', 'params': {'dest': 65535, 'withResponse': True}, 'callback': <function AwoxMesh._async_add_command_to_queue.<locals>.command_executed at 0x7f8af5f880>, 'allow_to_fail': False} 2022-10-17 09:46:02.292 WARNING (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] Command failed, retry 1 2022-10-17 09:46:02.299 WARNING (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] Command failed, retry 2 2022-10-17 09:46:02.305 WARNING (AwoxMeshCommands-SmbZcgdC) [custom_components.awox.awox_mesh] [SmbZcgdC] Command failed, retry 3

fsaris commented 1 year ago

The onboard BT is probably not powerfull enough. This with the fact that HA is now also scanning for BLE devices it will probably give issues with your BLE connections.

If you get Bluetooth scan returns no RSSI value messages it implies that the BT controller isn't able to connect to you device probably because it's out-of-range. See also https://www.home-assistant.io/integrations/bluetooth/#bluetooth-interference-with-other-devices