i tried to automate a nightlight under my bed,
alias: Bedroom Night Bedlight Motion
description: Schaltet nachts das Bettlicht bei Bewegung ein und beim Zurückkommen verzögert wieder aus.
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.bedroom_motion_occupancy
from: "off"
to: "on"
condition:
- condition: state
entity_id: sun.sun
state: "below_horizon"
action:
- choose:
# Case 1: Du stehst nachts auf → Licht ist noch aus → einschalten mit 30 %
- conditions:
- condition: state
entity_id: light.bedroom_lightstrip_bed
state: "off"
sequence:
- service: light.turn_on
target:
entity_id: light.bedroom_lightstrip_bed
data:
brightness_pct: 30
# Case 2: Du kommst zurück → Licht ist schon an → nach 15 s ausschalten
- conditions:
- condition: state
entity_id: light.bedroom_lightstrip_bed
state: "on"
sequence:
- delay: "00:00:15"
- service: light.turn_off
target:
entity_id: light.bedroom_lightstrip_bed
default: []
The problem is:
When my motion sensor detects me, the automation runs and the light physically turns on — but the state of the light in Home Assistant doesn’t update. It stays "off".
So when the sensor detects me again, the automation always goes into the "off" branch and tries to turn the light on again, instead of going into the "on" branch and waiting 15 seconds before turning it off.
I know I could build a workaround, but I really want to fix the root cause:
Why does the state of the light not change after calling light.turn_on?
The light is connected via govee2mqtt.
I’m very new to Home Assistant — this is literally my first automation — and I’m already a bit discouraged. Any clear explanation or guidance would be appreciated.