Hi Folks, I’m struggling to pass hs_color when calling homeassistant.service light.turn_on from ESPHome:
- homeassistant.service:
service: light.turn_on
data:
entity_id: light.my_light
brightness: "255"
hs_color: "??????"
Home Assistant expects a list for hs_color, but I can’t for the life of me figure out how to convert a float vector to a list. If anyone has been successful, I would value your input so much.
In Home Assistant I can use the following:
service: light.turn_on
data:
brightness: 255
hs_color: [120.0,50.0]
or
service: light.turn_on
data:
brightness: 255
hs_color:
- 120.0
- 50.0
Context: I have a regular light switch converted to momentary switch with an esp8266 attached. Trying to control brightness and color of a wifi bulb e.g. lifx mini with the switch.
Concept:
- Single click = on/off
- Press and hold = dim/brighten
- Double click = switch to color change mode
- Press and hold = cycle slowly through the color wheel
- Double click = return to brightness control
Any suggestions or solutions will be much appreciated. At the moment I have a script in Home Assistant that I am calling from ESPHome to perform the action, but it’s a really clunky solution
service: light.turn_on
data_template:
entity_id: '{{ target_entity_id }}'
transition: '{{ target_transition|float }}'
hs_color:
- '{{ target_hue|float }}'
- '{{ target_sat|float }}'
TiA, D.