Hello Community,
I have an issue with my automations in Home Assistant and I just can’t seem to figure it out. I’ve tried many things, but one scenario still doesn’t work as intended. Here’s my current situation:
Setup:
- A motion sensor (
binary_sensor.flur_og_bewegungssensor_gruppe
) that should dim the light to 5% when motion is detected. - A Shelly switch (
shelly.click
) that should turn the light to 100% when pressed. - An input boolean (
input_boolean.flur_og_licht_manuell
) that is used to block the motion sensor as soon as the switch is pressed.
Requirements:
- When the motion sensor detects motion, the light should be set to 5% and turn off after no motion is detected.
- When the switch is pressed, the light should turn to 100%, the motion sensor should be blocked (Input Boolean = on), and the light should only turn off when the switch is pressed again.
- The light should also be manually controllable via the switch without activating the motion sensor.
- If the switch is activated, the motion sensor should not perform any further actions until the switch turns off the light again (Input Boolean = off).
Current Configuration:
Motion Sensor Automation
alias: "Flur OG: Bewegungsmelder Licht auf 5% - überarbeitet"
description: ""
triggers:
- entity_id: binary_sensor.flur_og_bewegungssensor_gruppe
to: "on"
trigger: state
- entity_id: binary_sensor.flur_og_bewegungssensor_gruppe
to: "off"
trigger: state
conditions:
- condition: state
entity_id: input_boolean.flur_og_licht_manuell
state: "off"
actions:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.flur_og_bewegungssensor_gruppe
state: "on"
sequence:
- target:
entity_id: light.flur_og_shelly_dimmer_1_light_0
data:
brightness_pct: 5
action: light.turn_on
- conditions:
- condition: state
entity_id: binary_sensor.flur_og_bewegungssensor_gruppe
state: "off"
sequence:
- delay: "00:00:01"
- target:
entity_id: light.flur_og_shelly_dimmer_1_light_0
action: light.turn_off
data: {}
default: []
mode: restart
Switch Automation
alias: "Flur OG: Schalter Licht auf 100% - überarbeitet"
description: ""
triggers:
- event_type: shelly.click
event_data:
click_type: single_push
device: shellyprodm1pm-34987aa933b8
trigger: event
conditions: []
actions:
- choose:
- conditions:
- condition: state
entity_id: light.flur_og_shelly_dimmer_1_light_0
state: "on"
- condition: template
value_template: >
{{ state_attr('light.flur_og_shelly_dimmer_1_light_0',
'brightness') < 80 }}
sequence:
- target:
entity_id: input_boolean.flur_og_licht_manuell
action: input_boolean.turn_on
data: {}
- target:
entity_id: light.flur_og_shelly_dimmer_1_light_0
data:
brightness_pct: 100
action: light.turn_on
- conditions:
- condition: state
entity_id: light.flur_og_shelly_dimmer_1_light_0
state: "on"
- condition: state
entity_id: input_boolean.flur_og_licht_manuell
state: "on"
sequence:
- target:
entity_id: light.flur_og_shelly_dimmer_1_light_0
action: light.turn_off
data: {}
- target:
entity_id: input_boolean.flur_og_licht_manuell
action: input_boolean.turn_off
data: {}
- conditions:
- condition: state
entity_id: light.flur_og_shelly_dimmer_1_light_0
state: "off"
sequence:
- target:
entity_id: input_boolean.flur_og_licht_manuell
action: input_boolean.turn_on
data: {}
- target:
entity_id: light.flur_og_shelly_dimmer_1_light_0
data:
brightness_pct: 100
action: light.turn_on
mode: single
Helper Reset Automation
alias: "Flur OG: Helfer zurücksetzen - überarbeitet"
description: ""
triggers:
- entity_id: light.flur_og_shelly_dimmer_1_light_0
to: "off"
trigger: state
conditions:
- condition: state
entity_id: input_boolean.flur_og_licht_manuell
state: "on"
actions:
- target:
entity_id: input_boolean.flur_og_licht_manuell
action: input_boolean.turn_off
data: {}
mode: single
Test Scenarios:
- Motion sensor detects motion, light turns on to 5%, turns off after one second when no motion is detected: Works correctly.
- Motion sensor detects motion (light to 5%), switch is pressed (light to 100%), motion sensor turns off the light, even though the helper should be active: Does not work correctly.
- Switch is pressed without motion sensor being involved, light turns on/off, motion sensor does not interfere: Works correctly.
- Switch is pressed, light remains at 100%, motion sensor detects motion, light remains untouched: Works correctly.
Problem:
- In scenario 2, the input boolean (
input_boolean.flur_og_licht_manuell
) remains “off”, even though the switch automation activates it. - As a result, the motion sensor automation takes over and turns off the light.
Question:
- Why does the input boolean remain “off”?
- How can I adjust the automations so that scenario 2 works correctly?
Thank you very much for your help!