home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.24k stars 30.59k forks source link

Error When Setting Mired Color Temperature - TP Link Kasa #58114

Closed pnichols77 closed 3 years ago

pnichols77 commented 3 years ago

The problem

When trying to set a color_temp greater than 400 with and less than or equal to 500 the error below is shown (i had set it to 450). This is a TP Link Kasa Bulb

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Temperature should be between 2500 and 9000, was 2222

The slider in the GUI for testing a service call in developer tools allows you to choose between 153 and 500 - but any value over 400 produces the error above. I think this must be new behaviour as I first noticed it when a script that had worked started failing - it generates a random value for this color temperature between 400 and 500.

What is version of Home Assistant Core has the issue?

core-2021.10.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

TP-Link Kasa Smart

Link to integration documentation on our website

No response

Example YAML snippet

service: light.turn_on
target:
  entity_id: light.ball_lamp
data:
  color_temp: 450

Anything in the logs that might be useful for us?

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Temperature should be between 2500 and 9000, was 2222

Additional information

No response

probot-home-assistant[bot] commented 3 years ago

Hey there @rytilahti, @thegardenmonkey, mind taking a look at this issue as it has been labeled with an integration (tplink) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


tplink documentation tplink source (message by IssueLinks)

rytilahti commented 3 years ago

As the error implies, that bulb (nor any tplink bulb that I know of) do support <2500 kelvin values. How did it work previously and which model bulb is it? I'm not sure but maybe the earlier implementation used to clamp to the lowest/highest kelvin values earlier.. The values shown in the developer tool are not what the bulb in reality supports, or that's what I think.

pnichols77 commented 3 years ago

As the error implies, that bulb (nor any tplink bulb that I know of) do support <2500 kelvin values. How did it work previously and which model bulb is it? I'm not sure but maybe the earlier implementation used to clamp to the lowest/highest kelvin values earlier.. The values shown in the developer tool are not what the bulb in reality supports, or that's what I think.

They're KL130B bulbs and looking again i can see the supported mired range is 111 to 400 so yeah my issue isn't actually an issue. Weird how it worked before but I guess anything outside of that range would have just been ignored? Anyway thanks for setting me straight.

rytilahti commented 3 years ago

Without digging into the old code, I think they were simply forced to the lowest/highest value of the accepted range :-)