vieira / homebridge-yeelight-wifi

Homebridge plugin for Yeelight white and colored bulbs.
MIT License
129 stars 27 forks source link

Moonlight detection doesn't work for ceiling lamp #118

Closed darenegade closed 9 months ago

darenegade commented 10 months ago

First of all: thanks for the great plugin. It works pretty well overall and I really like it.

But unfortunately since version 3.0 the moonlight detection doesn't work anymore for my ceiling lamp (Yeelight JIAOYUE YLXD05YL).

I searched the log for some evidence why it's not working anymore and found a difference in the lamp initialization.

On 2.4 I get:

[12/11/2023, 19:46:40] [Yeelight] Received advertisement from ee9054. [12/11/2023, 19:46:40] [Yeelight] Device celing3-ee9054 supports moonlight mode [12/11/2023, 19:46:40] [Yeelight] Device ceiling3-ee9054 supports brightness [12/11/2023, 19:46:40] [Yeelight] Device ceiling3-ee9054 supports color temperature

On 3.0 the moonlight is missing:

[12/11/2023, 16:11:56] [Yeelight] Received advertisement from ee9054. [12/11/2023, 16:11:56] [Yeelight] Device ceiling3-ee9054 supports brightness [12/11/2023, 16:11:56] [Yeelight] Device ceiling3-ee9054 supports color temperature

I guess the active_mode is missing somehow on the Support Field of the search response, as the feature init was changed in version 3.0 to identify the moonlight ability. But I can't verify this as the multicast udp response is hard to recreate without coding. (Do you know a way to get that response from the lamp without coding?)

If this is the case the init may not use that for feature detection. But I didn't found an other simple way from the documentation to get that information.

One solution could be to override feature detection via config for specific devices.

What do you think?

vieira commented 10 months ago

Hello @darenegade,

I don't have a device with moonlight to test, can you please send me the search response for that device?

You should be able to get it by running something like (tested on a mac):

echo -ne 'M-SEARCH * HTTP/1.1\r\nMAN: "ssdp:discover"\r\nST: wifi_bulb' | nc -w1 -u -p 43210 239.255.255.250 1982 & nc -ul 43210

Example output:

HTTP/1.1 200 OK
Cache-Control: max-age=3600
Date: 
Ext: 
Location: yeelight://10.0.0.209:55443
Server: POSIX UPnP/1.0 YGLC/1
id: 0x00000000035e8d06
model: color
fw_ver: 75
support: get_prop set_default set_power toggle set_bright start_cf stop_cf set_scene cron_add cron_get cron_del set_ct_abx set_rgb set_hsv set_adjust adjust_bright adjust_ct adjust_color set_music set_name
power: on
bright: 2
color_mode: 3
ct: 4000
rgb: 8213247
hue: 255
sat: 68
name: 
darenegade commented 10 months ago

@vieira

Thank you for your help. I was able to execute the command and got the following response from my ceiling light:

HTTP/1.1 200 OK
Cache-Control: max-age=3600
Date: 
Ext: 
Location: yeelight://192.168.178.33:55443
Server: POSIX UPnP/1.0 YGLC/1
id: 0x0000000005ee9054
model: ceiling3
fw_ver: 48
support: get_prop set_default set_power toggle set_bright set_scene cron_add cron_get cron_del start_cf stop_cf set_ct_abx set_name set_adjust adjust_bright adjust_ct
power: off
bright: 100
color_mode: 2
ct: 3623
rgb: 0
hue: 0
sat: 0
name: 

As suspected, the support flag for active_mode is missing here, although the lamp supports moonlight-mode.

Mimomaj commented 10 months ago

Same problem here on my ceiling lights, I can also help with testing if needed.

vieira commented 10 months ago

Unfortunately I don't see anything in the response that could be used to detect support for the moonlight mode. I will explore some other ideas and release a beta version for you to test.

vieira commented 10 months ago

Hello @darenegade, @Mimomaj,

I (tried) to fix the issue in #119 and published a new beta version 3.0.1-beta.0 to npm.

Let me know if it fixes the issue for you. Also let me know if you find any other new issues with this release.

Thanks!

Mimomaj commented 10 months ago

Hi @vieir, issue is fixed, thank you for your work. I'll let you know in case I found any other issues.

darenegade commented 9 months ago

@vieira I just tested the beta and the issue is fixed for me too. Great work👍

alondj99 commented 9 months ago

@vieira beta works great Thank you so much 😊

vieira commented 9 months ago

Thanks for taking the time to test! Published 3.0.1 with the fix.