hcoohb / hass-yeelightbt

Home assistant custom component for Yeelight bluetooth
50 stars 16 forks source link

Yeelight candela #5

Closed otherguy closed 2 years ago

otherguy commented 4 years ago

Hi and thanks for your work on this component.

I was able to pair HA with my Yeelight Candela (F8:24:41:C0:3B:7E yeelight_ms).

On / Off works perfectly, and brightness can be set, but the slider always reverts to a brightness of zero. I assume the code to read back the brightness does not work with these type of lamps.

If possible, you could also disable the color temperature and hue pickers, because they are not needed or used on such a lamp.

I'm happy to help with any information you might need!

hcoohb commented 4 years ago

Hi, Thanks for reporting the issue. Yes I do not have a candela so could not try. They use a nearly identical bt protocol but it seems they expose the brightness differently. I have an idea on where the problem could be, but would you be able to enable debug, restart HA, then:

And can you please post the log (only the lines relevant to the yeelight_bt component) ? That way I can confirm, how the candela is reporting brightness. Thanks

For removing temperature and hue pickers, totally doable but I need a way to identify the model. I will add more debug messaging in next release to try to identify the model, otherwise it could be a variable in the configuration

ASNNetworks commented 4 years ago

I hope this is of any help! I do notice a lot of disconnects with the Candela's unfortunately. They will re-connect automatically, but they keep disconnecting/reconnecting. Using them in a group is kinda painful, since then one turns on/off while the other happens to be disconnected. I am running Room Assistance as well on the Pi, I don't know if that has any effect on the bluetooth connection of the Candela's. But not feeling great with 48 occurrences in the log about this in just 10 minutes.

2020-09-22 23:20:34 DEBUG (SyncWorker_30) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:20:34 DEBUG (SyncWorker_30) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:20:34 DEBUG (SyncWorker_30) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:20:34 DEBUG (SyncWorker_30) [custom_components.yeelight_bt.yeelightbt] Received 0x4345025f0207080000000000000000000000 fron handle=34
2020-09-22 23:20:34 DEBUG (SyncWorker_30) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:38 DEBUG (SyncWorker_35) [custom_components.yeelight_bt.light] Trying to turn on. with ATTR:{}
2020-09-22 23:20:38 DEBUG (SyncWorker_35) [custom_components.yeelight_bt.yeelightbt] Turn_on
2020-09-22 23:20:38 DEBUG (SyncWorker_35) [custom_components.yeelight_bt.yeelightbt] Writing  0x434001000000000000000000000000000000 on handle 31
2020-09-22 23:20:38 DEBUG (SyncWorker_29) [custom_components.yeelight_bt.light] Trying to turn on. with ATTR:{}
2020-09-22 23:20:38 DEBUG (SyncWorker_29) [custom_components.yeelight_bt.yeelightbt] Turn_on
2020-09-22 23:20:38 DEBUG (SyncWorker_29) [custom_components.yeelight_bt.yeelightbt] Writing  0x434001000000000000000000000000000000 on handle 31
2020-09-22 23:20:38 DEBUG (SyncWorker_35) [custom_components.yeelight_bt.yeelightbt] Received 0x4345015f0207080000000000000000000000 fron handle=34
2020-09-22 23:20:38 DEBUG (SyncWorker_35) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:38 DEBUG (SyncWorker_29) [custom_components.yeelight_bt.yeelightbt] Received 0x4345015f0207080000000000000000000000 fron handle=34
2020-09-22 23:20:38 DEBUG (SyncWorker_29) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:40 DEBUG (SyncWorker_2) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:20:40 DEBUG (SyncWorker_2) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:20:40 DEBUG (SyncWorker_2) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:20:40 DEBUG (SyncWorker_24) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:20:40 DEBUG (SyncWorker_24) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:20:40 DEBUG (SyncWorker_24) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:20:40 DEBUG (SyncWorker_2) [custom_components.yeelight_bt.yeelightbt] Received 0x4345015f0207080000000000000000000000 fron handle=34
2020-09-22 23:20:40 DEBUG (SyncWorker_2) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:40 DEBUG (SyncWorker_24) [custom_components.yeelight_bt.yeelightbt] Received 0x4345015f0207080000000000000000000000 fron handle=34
2020-09-22 23:20:40 DEBUG (SyncWorker_24) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:45 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.light] Trying to turn on. with ATTR:{'brightness': 26}
2020-09-22 23:20:45 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.light] Trying to set brightness: 10
2020-09-22 23:20:45 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Set_brightness 10
2020-09-22 23:20:45 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Writing  0x43420a000000000000000000000000000000 on handle 31
2020-09-22 23:20:45 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.light] Trying to turn on. with ATTR:{'brightness': 26}
2020-09-22 23:20:45 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.light] Trying to set brightness: 10
2020-09-22 23:20:45 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.yeelightbt] Set_brightness 10
2020-09-22 23:20:45 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.yeelightbt] Writing  0x43420a000000000000000000000000000000 on handle 31
2020-09-22 23:20:45 WARNING (SyncWorker_5) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Device disconnected), Retrying now...
2020-09-22 23:20:45 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:45 WARNING (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Device disconnected), Retrying now...
2020-09-22 23:20:45 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:46 WARNING (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Could not connect to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Failed to connect to peripheral F8:24:41:C1:FB:48 yeelight_ms, addr type: public), Retrying in 0.1 seconds...
2020-09-22 23:20:47 WARNING (SyncWorker_5) [custom_components.yeelight_bt.yeelightbt] Could not connect to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Failed to connect to peripheral F8:24:41:C2:1E:D1 yeelight_ms, addr type: public), Retrying in 0.1 seconds...
2020-09-22 23:20:47 WARNING (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Could not connect to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Failed to connect to peripheral F8:24:41:C1:FB:48 yeelight_ms, addr type: public), Retrying in 0.1 seconds...
2020-09-22 23:20:47 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.yeelightbt] Writing  0x0100 on handle 35
2020-09-22 23:20:47 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.yeelightbt] Writing  0x436702000000000000000000000000000000 on handle 31
2020-09-22 23:20:48 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.yeelightbt] Received 0x436302000000000000000000000000000000 fron handle=34
2020-09-22 23:20:48 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.yeelightbt] Yeelight pairing was successful!
2020-09-22 23:20:48 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.yeelightbt] Writing  0x43420a000000000000000000000000000000 on handle 31
2020-09-22 23:20:48 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.yeelightbt] Received 0x4345010a0207080000000000000000000000 fron handle=34
2020-09-22 23:20:48 DEBUG (SyncWorker_5) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:48 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Writing  0x0100 on handle 35
2020-09-22 23:20:48 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Writing  0x436702000000000000000000000000000000 on handle 31
2020-09-22 23:20:48 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Received 0x436302000000000000000000000000000000 fron handle=34
2020-09-22 23:20:48 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Yeelight pairing was successful!
2020-09-22 23:20:48 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Writing  0x43420a000000000000000000000000000000 on handle 31
2020-09-22 23:20:48 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.yeelightbt] Received 0x4345010a0207080000000000000000000000 fron handle=34
2020-09-22 23:20:48 DEBUG (SyncWorker_11) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:48 DEBUG (SyncWorker_42) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:20:48 DEBUG (SyncWorker_42) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:20:48 DEBUG (SyncWorker_42) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:20:48 DEBUG (SyncWorker_12) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:20:48 DEBUG (SyncWorker_12) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:20:48 DEBUG (SyncWorker_12) [custom_components.yeelight_bt.yeelightbt] WAITING before next command
2020-09-22 23:20:48 DEBUG (SyncWorker_42) [custom_components.yeelight_bt.yeelightbt] Received 0x4345010a0207080000000000000000000000 fron handle=34
2020-09-22 23:20:48 DEBUG (SyncWorker_42) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:49 DEBUG (SyncWorker_12) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:20:49 DEBUG (SyncWorker_12) [custom_components.yeelight_bt.yeelightbt] Received 0x4345010a0207080000000000000000000000 fron handle=34
2020-09-22 23:20:49 DEBUG (SyncWorker_12) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:55 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.light] Trying to turn on. with ATTR:{'color_temp': 533}
2020-09-22 23:20:55 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.light] Trying to set temp: 2103
2020-09-22 23:20:55 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Set_temperature 2103, 0
2020-09-22 23:20:55 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Writing  0x434308370000000000000000000000000000 on handle 31
2020-09-22 23:20:55 DEBUG (SyncWorker_27) [custom_components.yeelight_bt.light] Trying to turn on. with ATTR:{'color_temp': 533}
2020-09-22 23:20:55 DEBUG (SyncWorker_27) [custom_components.yeelight_bt.light] Trying to set temp: 2103
2020-09-22 23:20:55 DEBUG (SyncWorker_27) [custom_components.yeelight_bt.yeelightbt] Set_temperature 2103, 0
2020-09-22 23:20:55 DEBUG (SyncWorker_27) [custom_components.yeelight_bt.yeelightbt] Writing  0x434308370000000000000000000000000000 on handle 31
2020-09-22 23:20:55 WARNING (SyncWorker_27) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Device disconnected), Retrying now...
2020-09-22 23:20:55 DEBUG (SyncWorker_27) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:55 WARNING (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Device disconnected), Retrying now...
2020-09-22 23:20:55 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:56 DEBUG (SyncWorker_27) [custom_components.yeelight_bt.yeelightbt] Writing  0x0100 on handle 35
2020-09-22 23:20:56 WARNING (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Could not connect to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Failed to connect to peripheral F8:24:41:C1:FB:48 yeelight_ms, addr type: public), Retrying in 0.1 seconds...
2020-09-22 23:20:56 DEBUG (SyncWorker_27) [custom_components.yeelight_bt.yeelightbt] Writing  0x436702000000000000000000000000000000 on handle 31
2020-09-22 23:20:56 DEBUG (SyncWorker_27) [custom_components.yeelight_bt.yeelightbt] Received 0x436302000000000000000000000000000000 fron handle=34
2020-09-22 23:20:56 DEBUG (SyncWorker_27) [custom_components.yeelight_bt.yeelightbt] Yeelight pairing was successful!
2020-09-22 23:20:56 DEBUG (SyncWorker_27) [custom_components.yeelight_bt.yeelightbt] Writing  0x434308370000000000000000000000000000 on handle 31
2020-09-22 23:20:56 WARNING (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Could not connect to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Failed to connect to peripheral F8:24:41:C1:FB:48 yeelight_ms, addr type: public), Retrying in 0.1 seconds...
2020-09-22 23:20:57 ERROR (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Could not connect to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Failed to connect to peripheral F8:24:41:C1:FB:48 yeelight_ms, addr type: public)
2020-09-22 23:20:57 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Writing  0x434308370000000000000000000000000000 on handle 31
2020-09-22 23:20:57 WARNING (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEInternalError'>(Helper not started (did you call connect()?)), Retrying now...
2020-09-22 23:20:57 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:58 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Writing  0x0100 on handle 35
2020-09-22 23:20:58 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Writing  0x436702000000000000000000000000000000 on handle 31
2020-09-22 23:20:59 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Received 0x436302000000000000000000000000000000 fron handle=34
2020-09-22 23:20:59 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Yeelight pairing was successful!
2020-09-22 23:20:59 DEBUG (SyncWorker_33) [custom_components.yeelight_bt.yeelightbt] Writing  0x434308370000000000000000000000000000 on handle 31
2020-09-22 23:20:59 DEBUG (SyncWorker_14) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:20:59 DEBUG (SyncWorker_14) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:20:59 DEBUG (SyncWorker_14) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:20:59 DEBUG (SyncWorker_36) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:20:59 DEBUG (SyncWorker_36) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:20:59 DEBUG (SyncWorker_36) [custom_components.yeelight_bt.yeelightbt] WAITING before next command
2020-09-22 23:20:59 DEBUG (SyncWorker_14) [custom_components.yeelight_bt.yeelightbt] Received 0x4345010a0207080000000000000000000000 fron handle=34
2020-09-22 23:20:59 DEBUG (SyncWorker_14) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:20:59 DEBUG (SyncWorker_36) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:20:59 DEBUG (SyncWorker_36) [custom_components.yeelight_bt.yeelightbt] Received 0x4345010a0207080000000000000000000000 fron handle=34
2020-09-22 23:20:59 DEBUG (SyncWorker_36) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:00 DEBUG (SyncWorker_56) [custom_components.yeelight_bt.light] Trying to turn on. with ATTR:{'brightness': 197}
2020-09-22 23:21:00 DEBUG (SyncWorker_56) [custom_components.yeelight_bt.light] Trying to set brightness: 77
2020-09-22 23:21:00 DEBUG (SyncWorker_56) [custom_components.yeelight_bt.yeelightbt] Set_brightness 77
2020-09-22 23:21:00 DEBUG (SyncWorker_56) [custom_components.yeelight_bt.yeelightbt] Writing  0x43424d000000000000000000000000000000 on handle 31
2020-09-22 23:21:00 DEBUG (SyncWorker_25) [custom_components.yeelight_bt.light] Trying to turn on. with ATTR:{'brightness': 197}
2020-09-22 23:21:00 DEBUG (SyncWorker_25) [custom_components.yeelight_bt.light] Trying to set brightness: 77
2020-09-22 23:21:00 DEBUG (SyncWorker_25) [custom_components.yeelight_bt.yeelightbt] Set_brightness 77
2020-09-22 23:21:00 DEBUG (SyncWorker_25) [custom_components.yeelight_bt.yeelightbt] Writing  0x43424d000000000000000000000000000000 on handle 31
2020-09-22 23:21:00 DEBUG (SyncWorker_56) [custom_components.yeelight_bt.yeelightbt] Received 0x4345014d0207080000000000000000000000 fron handle=34
2020-09-22 23:21:00 DEBUG (SyncWorker_56) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:00 DEBUG (SyncWorker_25) [custom_components.yeelight_bt.yeelightbt] Received 0x4345014d0207080000000000000000000000 fron handle=34
2020-09-22 23:21:00 DEBUG (SyncWorker_25) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:00 DEBUG (SyncWorker_52) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:21:00 DEBUG (SyncWorker_52) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:21:00 DEBUG (SyncWorker_52) [custom_components.yeelight_bt.yeelightbt] WAITING before next command
2020-09-22 23:21:00 DEBUG (SyncWorker_40) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:21:00 DEBUG (SyncWorker_40) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:21:00 DEBUG (SyncWorker_40) [custom_components.yeelight_bt.yeelightbt] WAITING before next command
2020-09-22 23:21:01 DEBUG (SyncWorker_52) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:21:01 DEBUG (SyncWorker_40) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:21:01 DEBUG (SyncWorker_52) [custom_components.yeelight_bt.yeelightbt] Received 0x4345014d0207080000000000000000000000 fron handle=34
2020-09-22 23:21:01 DEBUG (SyncWorker_52) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:04 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:21:04 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:21:04 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:21:04 WARNING (SyncWorker_63) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Device disconnected), Retrying now...
2020-09-22 23:21:04 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:05 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.yeelightbt] Writing  0x0100 on handle 35
2020-09-22 23:21:05 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.yeelightbt] Writing  0x436702000000000000000000000000000000 on handle 31
2020-09-22 23:21:05 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.yeelightbt] Received 0x436302000000000000000000000000000000 fron handle=34
2020-09-22 23:21:05 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.yeelightbt] Yeelight pairing was successful!
2020-09-22 23:21:05 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:21:05 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.yeelightbt] Received 0x4345014d0207080000000000000000000000 fron handle=34
2020-09-22 23:21:05 DEBUG (SyncWorker_63) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:13 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Turn_off
2020-09-22 23:21:13 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Writing  0x434002000000000000000000000000000000 on handle 31
2020-09-22 23:21:13 DEBUG (SyncWorker_35) [custom_components.yeelight_bt.yeelightbt] Turn_off
2020-09-22 23:21:13 DEBUG (SyncWorker_35) [custom_components.yeelight_bt.yeelightbt] Writing  0x434002000000000000000000000000000000 on handle 31
2020-09-22 23:21:13 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Received 0x4345014d0207080000000000000000000000 fron handle=34
2020-09-22 23:21:13 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:13 WARNING (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Device disconnected), Retrying now...
2020-09-22 23:21:13 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:13 DEBUG (SyncWorker_35) [custom_components.yeelight_bt.yeelightbt] Received 0x4345024d0207080000000000000000000000 fron handle=34
2020-09-22 23:21:13 DEBUG (SyncWorker_35) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:14 WARNING (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Could not connect to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Failed to connect to peripheral F8:24:41:C1:FB:48 yeelight_ms, addr type: public), Retrying in 0.1 seconds...
2020-09-22 23:21:14 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Writing  0x0100 on handle 35
2020-09-22 23:21:14 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Writing  0x436702000000000000000000000000000000 on handle 31
2020-09-22 23:21:15 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Received 0x436302000000000000000000000000000000 fron handle=34
2020-09-22 23:21:15 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Yeelight pairing was successful!
2020-09-22 23:21:15 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Writing  0x434002000000000000000000000000000000 on handle 31
2020-09-22 23:21:15 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.yeelightbt] Received 0x4345024d0207080000000000000000000000 fron handle=34
2020-09-22 23:21:15 DEBUG (SyncWorker_54) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:16 DEBUG (SyncWorker_22) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:21:16 DEBUG (SyncWorker_22) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:21:16 DEBUG (SyncWorker_22) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:21:16 DEBUG (SyncWorker_2) [custom_components.yeelight_bt.light] Requesting an update of the lamp status
2020-09-22 23:21:16 DEBUG (SyncWorker_2) [custom_components.yeelight_bt.yeelightbt] Get_state
2020-09-22 23:21:16 DEBUG (SyncWorker_2) [custom_components.yeelight_bt.yeelightbt] Writing  0x434402000000000000000000000000000000 on handle 31
2020-09-22 23:21:16 DEBUG (SyncWorker_22) [custom_components.yeelight_bt.yeelightbt] Received 0x4345024d0207080000000000000000000000 fron handle=34
2020-09-22 23:21:16 DEBUG (SyncWorker_22) [custom_components.yeelight_bt.light] Got state notification from the lamp
2020-09-22 23:21:16 DEBUG (SyncWorker_2) [custom_components.yeelight_bt.yeelightbt] Received 0x4345024d0207080000000000000000000000 fron handle=34
2020-09-22 23:21:16 DEBUG (SyncWorker_2) [custom_components.yeelight_bt.light] Got state notification from the lamp
hcoohb commented 4 years ago

Hi,

Thanks for that log! It definitely shows that the candela is reporting the state differently, so I need to make the proper mapping for this, but we need to have a way to know what model it is.

The state response from the lamp seems to report other values too. What is changeable on the candela? Is it just the brightness or can you change something else? And is there different modes? I will push a new version soon that help reports versions which will help us confirm hopefully.

For the bt, connection, I have read that the candela shut the connections by itself in some cases to save battery. And the long part is establishing the connection (especially the bluepy library seems to take a long time to retry once there is an error). I am not sure as well if bluepy plays well with several devices to be controlled with this library.

otherguy commented 4 years ago

Great and thanks @ASNNetworks because I didn’t get around to it yet ;)

On the candela, only the brightness is changeable. There is a “candle” mode in which it flickers like a candle. That’s all.

I can confirm that it shuts down the BT connections, even when it’s permanently connected to power.

hcoohb commented 4 years ago

Hi guys,

I have released a version that should detect the candela by querying the device version (from what I could find online). If a Candela is detected, it should then let HA know that only brightness is supported, as well as read the brightness correclty from the lamp. Could one of you could use v0.10.5 and get similar log as above? Also, if you can change the mode to candle with a physiscal button while the lamp is connected, I would be interested to know if that change the byte that I assume was the mode of the lamp in its status notification.

For the bt disconnection, if it is the lamp constantly disconnecting, I am afraid there is probably not that much that can be done. It will need to reconnect everytime a command is sent and everytime we are polling for status. We could lower the frequency of polling for the candela maybe...

EDIT: For the log, please give me the initialization bit as well, as the version of device is only queried once during first connection of the lamp!

otherguy commented 4 years ago

Hey!

Thanks for the new version! I can confirm that the candela seems to be detected correctly. Only the brightness slider is shown and it does indeed reflect the brightness, at least if set from HA.

I noticed a few things. First of all, the (non-debug) log is flooded with messages like this:

2020-09-25 10:50:37 ERROR (SyncWorker_9) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'TypeError'>('<' not supported between instances of 'NoneType' and 'int')
2020-09-25 10:51:06 WARNING (SyncWorker_52) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'TypeError'>('<' not supported between instances of 'NoneType' and 'int'), Retrying now...
2020-09-25 10:51:07 WARNING (SyncWorker_52) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'TypeError'>('<' not supported between instances of 'NoneType' and 'int'), Retrying now...
2020-09-25 10:51:07 ERROR (SyncWorker_52) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'TypeError'>('<' not supported between instances of 'NoneType' and 'int')
2020-09-25 10:51:36 WARNING (SyncWorker_19) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'TypeError'>('<' not supported between instances of 'NoneType' and 'int'), Retrying now...
2020-09-25 10:51:37 WARNING (SyncWorker_19) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'TypeError'>('<' not supported between instances of 'NoneType' and 'int'), Retrying now...
2020-09-25 10:51:37 ERROR (SyncWorker_19) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'TypeError'>('<' not supported between instances of 'NoneType' and 'int')

The second thing I noticed is that the light state will switch to Unavailable for just a second, every time the brightness is adjusted, before then showing the correct value.

2020-09-25 11-03-49 2020-09-25 11_06_00

Manually adjusting the light (twisting the lamp to adjust brightness, not using HA) instantly causes it to go to Unavailable state which will then show this in the log:

2020-09-25 11:00:00 WARNING (MainThread) [homeassistant.helpers.entity] Update of light.candela is taking over 10 seconds
2020-09-25 11:00:01 WARNING (SyncWorker_8) [custom_components.yeelight_bt.yeelightbt] Could not connect to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Failed to connect to peripheral F8:24:41:C0:3B:7E, addr type: public), Retrying in 0.1 seconds...
2020-09-25 11:07:20 WARNING (MainThread) [homeassistant.components.light] Updating yeelight_bt light took longer than the scheduled update interval 0:00:30
2020-09-25 11:07:50 WARNING (MainThread) [homeassistant.components.light] Updating yeelight_bt light took longer than the scheduled update interval 0:00:30
2020-09-25 11:08:20 WARNING (MainThread) [homeassistant.components.light] Updating yeelight_bt light took longer than the scheduled update interval 0:00:30

I can post full logs tomorrow.

hcoohb commented 4 years ago

Oh, my bad, I have pushed 0.10.6 that hopefully fixes the TypeError for Candela.

For your second point: For the bedside lamp, the component basically always maintain a connection to the lamp to be able to send command quickly and read new state quickly. So if there is a disconnection, I make the lamp unavailable since we cannot send cmd in that time. I believe that makes sense. In case of the candela however it seems to always terminate the bt connection. So when the command for a different brightness is sent, the component realize then that it can't write and must reconnect. At that time, the status of the lamp is set to unavailable until we have made the new connection write value for brightness and get the status back from the lamp. So it all comes from the fact the candela is stopping the bt connection. We could try a different approach for the candela which is to only show the light as unavailable once we failed 3 attempted connections? Which I believe should remove this temporary unavailable when a command is sent (at least most of the time). I'll try to experiment with that on my bedside lamp over the weekend...

hcoohb commented 4 years ago

Any luck with those new version?

I'd be keen if you could give me a log with all the info for the candela. And maybe try a bluetooth scan from the integration menu? And if you can change the mode manually on the lamp, cuz I assumed a few things on the values reported by the lamp, but not entirely certain as I can't test directly...

Thanks

bluefoxlee commented 4 years ago

I have been trying to add Candela with HA for awhile. Appreciate for the hardworking. Add component 0.10.7, managed to get pair done for couple time. it Works great at first night and lost connection from second days.

Removed and use 0.11.1 with scan function. everything works great so far. (Pair, manual adjust lamp with status update - Slow but working). Will report back few days later.

Not sure if this log helps.

2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.light] Requesting an update of the lamp status 2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.yeelightbt] Get_state 2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.yeelightbt] Trying to write 0x434402000000000000000000000000000000 on handle 31 2020-09-28 22:13:20 WARNING (SyncWorker_32) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Device disconnected), Retrying now... 2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.yeelightbt] Trying to write 0x0100 on handle 35 2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.yeelightbt] Trying to write 0x436702000000000000000000000000000000 on handle 31 2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.yeelightbt] Received 0x436302000000000000000000000000000000 fron handle=34 2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.yeelightbt] Yeelight pairing was successful! 2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.yeelightbt] Trying to write 0x434402000000000000000000000000000000 on handle 31 2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.yeelightbt] Received 0x434501640207080000000000000000000000 fron handle=34 2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.yeelightbt] <Lamp f8:24:41:c0:0a:34 ON mode_White > 2020-09-28 22:13:20 DEBUG (SyncWorker_32) [custom_components.yeelight_bt.light] Got state notification from the lamp

Again, Thanks.

otherguy commented 4 years ago

On the latest version I get:

2020-10-04 14:44:02 WARNING (SyncWorker_9) [custom_components.yeelight_bt.yeelightbt] Could not connect to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Failed to connect to peripheral F8:24:41:C0:3B:7E, addr type: public), Retrying in 0.1 seconds...
2020-10-04 14:44:02 ERROR (SyncWorker_9) [custom_components.yeelight_bt.yeelightbt] Could not connect to lamp: error<class 'bluepy.btle.BTLEDisconnectError'>(Failed to connect to peripheral F8:24:41:C0:3B:7E, addr type: public)
2020-10-04 14:44:32 WARNING (SyncWorker_4) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEInternalError'>(Helper not started (did you call connect()?)), Retrying now...
2020-10-04 14:44:37 WARNING (SyncWorker_4) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEException'>(Error from bluepy-helper (badparam)), Retrying now...
2020-10-04 14:44:37 ERROR (SyncWorker_4) [custom_components.yeelight_bt.yeelightbt] Could not write to lamp: error<class 'bluepy.btle.BTLEException'>(Error from bluepy-helper (badparam))

Or, if I reset hci0:

2020-10-04 14:48:40 WARNING (MainThread) [homeassistant.components.light] Setup of light platform yeelight_bt is taking over 10 seconds.
2020-10-04 14:49:30 ERROR (MainThread) [homeassistant.components.light] Setup of platform yeelight_bt is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2020-10-04 14:53:40 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for bootstrap - moving forward

Is this an issue with my bluetooth adapter?

tcheronneau commented 4 years ago

I tried to add some of my new bulbs (not candela but still yeelight bt). And I've got the same issue as @otherguy.

otherguy commented 4 years ago

Let us know how we can help you here!

matteos1 commented 3 years ago

Not work with candela.

nightscout515 commented 3 years ago

Thx candela works without any issues! One thing is so wanted : candle effect. If you can please add it. Thank you again.

joshuavandermeulen commented 2 years ago

Thx candela works without any issues! One thing is so wanted : candle effect. If you can please add it. Thank you again.

Hello @nightscout515, how did you manage to get the candela working? ha finds the candela but it is not possible to turn it on or off here...

JunghaJungha commented 2 years ago

Hi all,

I managed to get the Candela working. After connecting and turning off and on the light (switch @ bottom), it was operational.

Very happy.

nunokaneco commented 2 years ago

Hello To all

I'm trying to adding the Yeelight candela to my home Assistant , i discover this but I not able to add the device with the scan or even if manual adding the mac address and the name

image

I Change the switch to the Bluetooth position when I try to add this devices and also after the adding manual I try to turn off tur on without sucess

Can anyone please help me in order to solve this issue ?

Thank you and best regards

hcoohb commented 2 years ago

Duplicate of #29

Let's keep only one active