Currently in Tuya ecosystem it is possible to automate changes in the lights, even if they are turned off.
One simple example is to set the color temperature to “warm/yellow” after sunset, and back to “cold/white” at the sunrise.
So if you have any other time-based schedule to turn it on or off, or if someone at home already turn it on, it will be in the correct color temperature based on the time of the day.
By checking at homeassistant source code, at Tuya components, it is clear that the methods turn_on()
and turn_off()
are very different, with turn_off()
simple ignoring other properties to the device, and only turning it off.
And because state
is a required field in HomeAssistant, I ended up with these scripts below, that only works properly while the device is on
, but when is off
the color does not change.
sequence:
- action: scene.apply
data:
entities:
light.abajur:
color_mode: color_temp
color_temp_kelvin: 2000
brightness: 192
state: "{{ states('light.abajur') }}"
alias: "Light: yellow mode after sunset 🟡"
description: "Change the color temperature, but do not change state"
sequence:
- action: scene.apply
data:
entities:
light.abajur:
color_mode: color_temp
brightness: 255
color_temp_kelvin: 6500
state: "{{ states('light.abajur') }}"
alias: "Light: white mode after sunrise ⚪"
description: "Change the color temperature, but do not change state"