Using Choose, conditions and IF/ELSE statements in HA UI (Evolution of my Kitchen Lights)
I was scrolling through some HA groups recently and noticed a trend: a lot of users (both new and old) seem to think you need Node-RED or complex YAML templates to handle a “smart” room. It made me realize that people are sleeping on just how powerful the native Home Assistant UI and Helpers have become.
The Home assistant team has done an excellent job of modernizing HA .HA Core version 2026.2.0,
So user friendly compared the old YAML for everything. I have moved 98% of my NodeRed automations over to the HA UI… Because of the ease of tracking what automation is related to an Entity or Device is in right in the Device Information tab.
I wanted to share the evolution of my kitchen setup as an example. It didn’t start this way—it evolved over 5 years of tweaking.
The Evolution:
- Phase 1: Just standard overhead lights on Multiple smart switches talking to each other across the house.
- Phase 2: Added WLED strips under the cabinets.
- Phase 3: Added an mmWave sensor (LD2410) for presence so I didn’t have to touch switches.
- Phase 4 (The “Smart” Part): I turned the WLED under-cabinet strip above the Ultra quite dishwasher into a status light:traffic_light:
(using an energy monitoring plug) so we knew when a cycle was running. - Phase 5 (Silent Notifications): Barbara works in an office right next to the kitchen. I couldn’t have Alexa shouting notifications during work hours, so I set up the under-cabinet lights to

as visual notifications instead.
The Problem:
As I added more “smarts,” my automations started fighting. I’d walk out of the room, and the motion sensor would turn everything off—killing my dishwasher status light in the middle of a cycle. Or I’d walk in for a glass of water at night, and the overheads would blind me.
I needed the room to ask four questions before acting:
- What time is it? (Bedtime? Morning?)
- Is it Work Time? (If Barbara is working, don’t shout—use lights only).
- Is the dishwasher busy? (If yes, don’t touch that light!)
- Did he just leave? (If it’s night, don’t turn off… go back to “nightlight” mode).
The “Aha!” Moment: Triggers vs. Conditions
This was the biggest lesson I learned early on.
The issue with using normal triggers for everything is that an automation only fires at the exact moment a state changes.
- Example: If I have a trigger “At 10 PM → Turn on Night Mode,” but I’m not in the room, it runs and finishes. If I walk in at 10:05 PM, the automation is “asleep” and doesn’t know what to do.
Unlike Python scripts(like Schedy scheduler) that are “always watching,” standard automations are reactive.
The Fix: I stopped trying to trigger on the time, and started using the time as a Condition.
Now, the trigger is Motion (which happens constantly). Every time I move, the automation wakes up and checks the current status of my helpers (“Is it Night? Is it Work Time?”). This makes the system infinitely more reliable because it adapts to the current reality every single time I enter the room.
Step 1: The “Master Clock” (Times of the Day Sensors)
I use the Times of the Day helper (Settings > Devices & Services > Helpers > Create Helper > Times of the Day).
binary_sensor.do_not_disturb_time_block(My “Night” switch)binary_sensor.morning_time_block(My “Wake Up” switch)binary_sensor.work_time_block(The “Quiet Mode” switch for office hours)
The Big Benefit:
I use these same sensors across every automation in the house.
- Notification Volume: If
do_not_disturbis On, Alexa whispers. - WLED Matrixes: My pixel clocks automatically dim to 5% brightness when this sensor trips.
- Kitchen Lights: As shown below, they switch to “Nightlight” mode.
If I ever decide to change my bedtime, I update one helper, and my entire house adjusts instantly.
Step 2: The Logic
I utilized “Conditions” the “Choose” and “If/Else” actions in the visual automation editor.
- Logic A (State Manager Automation): This watches the Helpers. When “Night” starts, it sets the WLEDs to Nightlight mode.
- Logic B (Motion Master Automation): This watches me. When I walk in, it checks the Helper.
- If Helper is ON (Night): Keep the Main Overhead Light OFF. Only turn the two cabinet lights to “Dim White.”
- If Helper is OFF (Day): Turn everything to “Full White” and turn on the Main Overhead Light.
The Dishwasher Trick:
Inside the visual editor, I added an “If” action before the dishwasher light changes.
- If Dishwasher is Off: Go ahead and change the color.
- Else: Do Nothing.
This acts as a safety lock. If the dishwasher is running, the automation skips that step and protects the status light.
Pro Tip: Don’t use “Devices” (The ‘Dumb ID’ Trap)
One final tip that saved me a massive headache: Never use “Device” triggers.
When you select “Device” in the visual editor, Home Assistant writes a specific, gibberish ID into your code (something like device_id: 39485739485739).
If that light switch dies and you replace it, that ID changes. Your automation breaks, and you have to go edit every single file to find the new ID.
Instead, always use Entities (Call Service → Light Turn On → light.kitchen_main).
If I replace the switch, I just name the new one light.kitchen_main, and boom—every automation in the house works instantly without me touching a single line of code.
The “Code” (That the UI built for me)
I built this using the visual dropdown menus, but I’ve pasted the YAML below so you can see the logic flow.
NOTE: If you copy and paste this into the Home Assistant UI YAML editor, make sure to delete any
# commentsfirst, as the UI editor sometimes struggles with them.
Automation 1: Setting the Mood (The State Manager)
This runs purely on schedule. DND starts → Nightlights come on.
description: "Adjust mood of kitchen WLED lights by time block with conditions to Not change some of the lights IF dishwasher Running Preset is running "
triggers:
- entity_id:
- binary_sensor.do_not_disturb_time_block
to: "on"
for:
hours: 0
minutes: 0
seconds: 0
id: "on"
trigger: state
- entity_id:
- binary_sensor.morning_time_block
to: "on"
for:
hours: 0
minutes: 0
seconds: 0
id: morning
trigger: state
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id: "on"
sequence:
- action: select.select_option
target:
entity_id: select.counter_preset
data:
option: nightlight
- if:
- condition: state
entity_id: binary_sensor.dishwasher_is_running_with_delay
state: "off"
then:
- action: select.select_option
target:
entity_id: select.dishwasher_led_preset
data:
option: night
- conditions:
- condition: trigger
id: morning
sequence:
- action: light.turn_off`
Automation 2: The Motion Logic (The “Smart” Part) This handles presence. Notice the specific logic that keeps the overhead light OFF during Night Mode.
alias: Kitchen Motion LD (Master)
description: Unified Motion trigger logic for Kitchen Motion with Conditions to NOT override other automations such as dishwasher running. Do not turn on main light at Night time block
triggers:
- trigger: state
entity_id: binary_sensor.kitchen_ld_radar_target
to: "on"
id: "on"
- trigger: state
entity_id: binary_sensor.kitchen_ld_radar_target
to: "off"
from: "on"
for:
seconds: 5
id: "off"
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id: "on"
sequence:
# Bed time mode
- if:
- condition: state
entity_id: binary_sensor.do_not_disturb_time_block
state: "on"
# sets only the under counter lights to come on at a Dim preset.
then:
- action: select.select_option
target:
entity_id: select.counter_preset
data:
option: Dim white
# Look for Dishwahser automation to be off.
- if:
- condition: state
entity_id: binary_sensor.dishwasher_is_running_with_delay
state: "off"
# If not running then set the LED over dishwasher to dim
then:
- action: select.select_option
target:
entity_id: select.dishwasher_led_preset
data:
option: Dim white
# This action turns off the Main over head light OFF for Night mode if light was already on.
- action: light.turn_off
target:
entity_id: light.kitchen_light
# if the above "if" conditions dont match then change counter to full white
else:
- action: select.select_option
target:
entity_id: select.counter_preset
data:
option: Full white
# but make sure the dishwasher running Preset is not active
- if:
- condition: state
entity_id: binary_sensor.dishwasher_is_running_with_delay
state: "off"
# if not running then Change Light over dishwasher to full white.
then:
- action: select.select_option
target:
entity_id: select.dishwasher_led_preset
data:
option: Solid
# and turn on the main overhead light
- action: light.turn_on
target:
entity_id: light.kitchen_light
data: {}
- conditions:
- condition: trigger
id: "off"
sequence:
- if:
- condition: state
entity_id: binary_sensor.do_not_disturb_time_block
state: "on"
then:
- action: light.turn_off
target:
entity_id: light.kitchen_light
data:
transition: 15
- action: select.select_option
target:
entity_id: select.counter_preset
data:
option: nightlight
- if:
- condition: state
entity_id: binary_sensor.dishwasher_is_running_with_delay
state: "off"
then:
- action: select.select_option
target:
entity_id: select.dishwasher_led_preset
data:
option: night
else:
- action: light.turn_off
target:
entity_id:
- light.kitchen_light
- light.counter
data:
transition: 5
- if:
- condition: state
entity_id: binary_sensor.dishwasher_is_running_with_delay
state: "off"
then:
- action: light.turn_off
target:
entity_id: light.dishwasher_led
data:
transition: 5
mode: single
It took a little trial and error, but it works perfectly. Hopefully, this helps anyone else who thinks they need Node-RED to handle a busy room!
I will add screen shots of the UI Later. BUt feel free to past the yaml into a new Automation in the UI in yaml mode to see what it looks like.
Just dont forget to remove any comments I may have.