
No time to read the whole article?
You can find my Home Assistant automation configurations at the bottom of this article in YAML format. Simply copy and paste them into your system, then make the necessary adjustments.
Click HERE to jump directly to the full YAML versions of the automations.
Why did I want solve it?
I have a lamp on my desk that directs light onto the ceiling, evenly illuminating my entire workspace. It stays on for most of the day. A few years ago, I chose a dual-temperature Osram light bulb, which had two modes – warm and neutral light – that could be easily switched. Changing the temperature was as simple as turning the lamp off and on again. With each power cycle, the bulb’s internal electronics toggled the light temperature to the opposite mode. However, after years of service, the electronics controlling the modes eventually failed. To make matters worse, I discovered that Osram no longer manufactures these bulbs, so I had to find an alternative solution.
I also have a home-lab server built for experimenting with Docker containers. One of these containers runs Home Assistant, which serves as the home automation system in my place. While I already have many Zigbee devices connected to it, I hadn’t yet used a Zigbee-controlled light bulb. So, why not give it a try?
After a quick search for available options on the market, I found what seemed to be the perfect solution. I came across a suitable Zigbee-controlled light bulb with adjustable color temperature, which allowed me to fully automate light temperature adjustments based on the time of day.
I needed the following functionalities:
- Whenever I turn the bulb on, its light temperature should be set to a specific value based on the time of day.
- While the bulb is on, an automated system should adjust the light temperature at predefined times, ensuring smooth transitions between settings.
Hardware & Software
Here are the hardware and software components I use:

Remember: The setup shown above is just one example of how Home Assistant can be installed and used. To explore more options, visit: https://www.home-assistant.io/installation/
Hardware used in this setup:
– IKEA RODRET and SOMRIG Zigbee switches
– slaesh CC2652RB Zigbee coordinator
– innr comfort 1100 Zigbee Light Bulb 1190lm 2000K-6500K
Automations in Home Assistant
I created three automations in total:
- Turning the lamp on when a trigger event is detected from connected Zigbee remote buttons. When triggered, the automation checks the current time and sets the bulb to the appropriate temperature.
- Adjusting the light temperature at specific times of the day.
- Turning the lamp off when a trigger event is detected from connected Zigbee remote buttons.

This is the schedule I decided to implement:
Time of Day | Expected Light Temperature |
3am – 4pm | 6000K |
4pm – 6pm | 4000K |
6pm-10pm | 2700K |
10pm-3am | 2300K |
It is not my intention to explain how Home Assistant Automations work in general in this article. If you need to learn more, please visit: https://www.home-assistant.io/docs/automation. However, let’s briefly recall that every automation follows this structure:
If TRIGGER
under CONDITION
then ACTION
Let’s go over the key aspects of each deployed automation.
Deep dive into [Buttons (SOMRIG1 & RODRET2) -> Desk Lamp ON]
In this automation, the TRIGGER is always an event from one of my Zigbee remote buttons. The CONDITION that allows the automation to run is that the light bulb must be in the OFF state. The real “magic” happens in the ACTIONS section.
I used the CHOOSE action, which acts as a powerful switch that can incorporate additional conditions. You can read more about it here: https://www.home-assistant.io/docs/scripts/#choose-a-group-of-actions
Each CHOOSE action branch follows this structure:
actions:
- choose:
- conditions:
- condition: time
after: "03:00:00"
before: "16:00:00"
sequence:
- action: light.turn_on
data:
color_temp_kelvin: 6000
brightness: 255
transition: 1
target:
device_id: 138bbb31fb35e82586c067c5b743471d
- conditions:
- condition: time
after: "16:00:00"
before: "18:00:00"
sequence:
- action: light.turn_on
target:
device_id: 138bbb31fb35e82586c067c5b743471d
data:
color_temp_kelvin: 4000
brightness: 255
transition: 1
Notice that each CHOOSE list element has a CONDITIONS section containing a time-based condition with a specified hour range. Additionally, each CHOOSE list element includes a SEQUENCE action, which groups a list of actions to execute when the condition is met.
To control my light bulb, I used the standard LIGHT integration. You can learn more about it here: https://www.home-assistant.io/integrations/light. To adjust the bulb’s behavior, you can use the LIGHT.TURN_ON action, which accepts various DATA attributes such as color_temp_kelvin, brightness, transition, etc.
This is exactly what I used in my automation. While color_temp_kelvin alone would be sufficient, I also ensure that the automation fully resets any previous brightness adjustments by setting it to 255 (100%). The transition parameter (in seconds) ensures a smooth change.
To increase the chances of catching any accidental mistakes, I added a default section to the CHOOSE list with the coolest possible light temperature, which is not used in any other action.
default:
- action: light.turn_on
data:
color_temp_kelvin: 6500
brightness: 255
target:
device_id: 138bbb31fb35e82586c067c5b743471d
Deep dive into [Desk Lamp TEMPERATURE adjustment -> ALL-in-ONE]
This automation is not triggered by any remote switch but runs automatically at specific times, which are outlined in the schedule presented above (at the start of each time period). The key here is defining the triggers correctly:
alias: Desk Lamp TEMPERATURE adjustment -> ALL-in-ONE
description: ""
triggers:
- trigger: time
at: "03:00:00"
- trigger: time
at: "16:00:00"
- trigger: time
at: "18:00:00"
- trigger: time
at: "22:00:00"
conditions:
- condition: device
type: is_on
device_id: 138bbb31fb35e82586c067c5b743471d
entity_id: 025693a26b26909612d6abeb8620f35b
domain: light
Notice that in this automation, I’ve used a condition that prevents it from running when the light bulb is not in the ON state.
The actions in this automation are defined similarly to the ones in the Buttons (SOMRIG1 & RODRET2) -> Desk Lamp ON automation. The key difference is that here, the brightness is not auto-adjusted (it only auto-adjusts the light temperature).
Not so deep dive into [Buttons (SOMRIG1 & RODRET2) -> Desk Lamp OFF]
The third automation is straightforward. It takes remote switch events as triggers and uses the LIGHT.TURN_OFF action unconditionally to switch the bulb OFF. You can examine the code for this automation in the relevant section below.
Full YAML Versions of the Automations Discussed Above
When copying & pasting, make sure to replace my device_id and entity_id with the the correct values for your system.
Buttons (SOMRIG1 & RODRET2) -> Desk Lamp ON
alias: Buttons (SOMRIG1 & RODRET2) -> Desk Lamp ON
description: ""
triggers:
- domain: mqtt
device_id: 668b333fd51e879d66c0497710013a1c
type: action
subtype: 1_initial_press
trigger: device
- domain: mqtt
device_id: 47d77c11c90886e34cc429fe38a0af60
type: action
subtype: "on"
trigger: device
conditions:
- condition: device
type: is_off
device_id: 138bbb31fb35e82586c067c5b743471d
entity_id: 025693a26b26909612d6abeb8620f35b
domain: light
actions:
- choose:
- conditions:
- condition: time
after: "03:00:00"
before: "16:00:00"
sequence:
- action: light.turn_on
data:
color_temp_kelvin: 6000
brightness: 255
transition: 1
target:
device_id: 138bbb31fb35e82586c067c5b743471d
- conditions:
- condition: time
after: "16:00:00"
before: "18:00:00"
sequence:
- action: light.turn_on
target:
device_id: 138bbb31fb35e82586c067c5b743471d
data:
color_temp_kelvin: 4000
brightness: 255
transition: 1
- conditions:
- condition: time
after: "18:00:00"
before: "22:00:00"
sequence:
- action: light.turn_on
target:
device_id: 138bbb31fb35e82586c067c5b743471d
data:
color_temp_kelvin: 2700
brightness: 255
transition: 1
- conditions:
- condition: time
after: "22:00:00"
before: "03:00:00"
sequence:
- action: light.turn_on
target:
device_id: 138bbb31fb35e82586c067c5b743471d
data:
color_temp_kelvin: 2300
brightness: 255
transition: 1
default:
- action: light.turn_on
data:
color_temp_kelvin: 6500
brightness: 255
target:
device_id: 138bbb31fb35e82586c067c5b743471d
mode: single
Desk Lamp TEMPERATURE adjustment -> ALL-in-ONE
alias: Desk Lamp TEMPERATURE adjustment -> ALL-in-ONE
description: ""
triggers:
- trigger: time
at: "03:00:00"
- trigger: time
at: "16:00:00"
- trigger: time
at: "18:00:00"
- trigger: time
at: "22:00:00"
conditions:
- condition: device
type: is_on
device_id: 138bbb31fb35e82586c067c5b743471d
entity_id: 025693a26b26909612d6abeb8620f35b
domain: light
actions:
- choose:
- conditions:
- condition: time
after: "03:00:00"
before: "16:00:00"
sequence:
- action: light.turn_on
data:
transition: 1
color_temp_kelvin: 6000
target:
device_id: 138bbb31fb35e82586c067c5b743471d
- conditions:
- condition: time
after: "16:00:00"
before: "18:00:00"
sequence:
- action: light.turn_on
data:
transition: 1
color_temp_kelvin: 4000
target:
device_id: 138bbb31fb35e82586c067c5b743471d
- conditions:
- condition: time
after: "18:00:00"
before: "22:00:00"
sequence:
- action: light.turn_on
data:
transition: 1
color_temp_kelvin: 2700
target:
device_id: 138bbb31fb35e82586c067c5b743471d
- conditions:
- condition: time
after: "22:00:00"
before: "03:00:00"
sequence:
- action: light.turn_on
data:
transition: 1
color_temp_kelvin: 2300
target:
device_id: 138bbb31fb35e82586c067c5b743471d
mode: single
Buttons (SOMRIG1 & RODRET2) -> Desk Lamp OFF
alias: Buttons (SOMRIG1 & RODRET2) -> Desk Lamp OFF
description: ""
triggers:
- domain: mqtt
device_id: 668b333fd51e879d66c0497710013a1c
type: action
subtype: 2_initial_press
trigger: device
- domain: mqtt
device_id: 47d77c11c90886e34cc429fe38a0af60
type: action
subtype: "off"
trigger: device
conditions: []
actions:
- action: light.turn_off
metadata: {}
data:
transition: 1
target:
device_id: 138bbb31fb35e82586c067c5b743471d
mode: single