krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
387 stars 46 forks source link

5.1.0 breaks color_temp with MSL120 light bulbs #440

Closed markus-korbel closed 3 weeks ago

markus-korbel commented 1 month ago

When using the service light.turn_on from my automations for hallways I pass along the color_temp during the day (setting it to dark red in the middle of the night).

When updating to 5.1.0 the lights do not turn on when the color_temp parameter is present. If I remove it and only have brightness (those are the only two settings passed), the light turns on fine.

Example from on of my automations:

service: light.turn_on
data:
  brightness_pct: 70
  color_temp: 475
target:
  entity_id: light.landing_light

I reverted back to 5.0.4 and the automations work fine again. I didn't see any errors when using 5.1.0, the actions performed fine, the lights just won't turn on. If you require a debug run let me know and I will update to the new version again, for now I will remain on the older.

krahabb commented 1 month ago

I'm going to inspect this but I might suspect the issue lies in the fact that I've now supported the color_temp_kelvin and removed the 'saturation' to device temperature parameter limits of incoming service parameters.

It looks as if the 475 mireds are beyond the capabilities of the device and I see this log warning when trying to issue your same call:

Protocol error: namespace:Appliance.Control.Light payload:{'error': {'code': 5000, 'detail': 'Out of range. rgb value range: 0X0~0XFFFFFF, temperature range : 1~100, luminance range:1~100'}}

I'll surely patch this in order to coerce the provided mired/kelvin parameter in the service call to what the device might support

markus-korbel commented 1 month ago

Yeah a saw it in the interfaces of the devices that kelvin is available there, but when editing the automation and using the service that parameter isn't available. And I just used the slider of the graphical editor, not quite sure what a "mired" even is tbh, but it's shifting the color temperature of the light bulbs matching the color of the slider.

krahabb commented 1 month ago

Yeah..I've come to know mired with HA..it looks as if it was the original light temp unit (likely based off Philips Hue parameters) It is just another scale and the service interface tool allows you to set either of the parameters (kelvin or mired).

After you raised the issue I've tried the service interface tool in HA and see that it doesn't clamp the sent values (while the lamp entity card instead does and everything works fine there)