Fairly new to Home Assistant and especially to the automation part, I’m encountering a problem that I can solve theoretically but can’t apply.
To be as informative as possible, here are the devices concerned:
1 Hue motion detector
1 Hue Wall Switch
1. Hue motion detector
It performs an automation when it detects movement: turning on the light for 1 minute on a particular scene.
2. The Hue Wall Switch
Turns the light on or off in another specific scene. Simple ON/OFF switch
3. The Goal
When it’s dark, the motion detector turns the lights on at low brightness for one minute (repeatable in the event of movement). However, if I need more light, I use the Wall Switch to switch the lights on as normal.
4. The problem
If the motion detector turns on the lights, if I turn them off with the Wall Switch and then turn them on to get full brightness, the lights cut out at the end of the motion detector automation. Which is logical…
How can I stop the automation when this change of state occurs? I’ve read a lot about scene persistence and the problems associated with it. I’ve also read about the possibility of using a helper to set the current status, but I don’t have a concrete example.
Any help ?
alias: "Bathroom"
description: >-
Formatted
trigger:
- platform: state
entity_id:
- binary_sensor.hue_motion_sensor_1_move
to: "on"
enabled: true
id: Move
condition:
- condition: state
entity_id: light.bathroom
state: "off"
for:
hours: 0
minutes: 0
seconds: 1
action:
- if:
- condition: trigger
id: Move
then:
- if:
- condition: or
conditions:
- condition: sun
before: sunrise
before_offset: "01:00:00"
- condition: sun
after: sunset
after_offset: "-01:00:00"
then:
- alias: Scene Switch
service: scene.turn_on
target:
entity_id: scene.bathroom_chill
- alias: Trigger part
wait_for_trigger:
platform: state
entity_id: binary_sensor.hue_motion_sensor_1_move
from: "on"
to: "off"
continue_on_timeout: true
- alias: Waiting Zone
delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- alias: Turn Off
service: light.turn_off
target:
entity_id: light.bathroom
mode: restart
max_exceeded: silent
My easiest theory would be to take a snapshot before and after to compare them but i’m aware the created scenes doens’t persist so it a no go.
Second is : If there is a change of state while the automation, don’t apply the Turn Off function…
The Hue Wall Switch don’t return an On/Off position. When pressed, the hue bridge switch from state On to Off (and vice versa) so i can’t rely on this on since he don’t have a status as his own.
Right Now i’m trying to create an automation to get the status of the wall switch based on the lights status.
BATHROOM éteint 11:01:10
HUEWALLSWITCH a détecté un événement 11:01:10
STATUS déclenché par l'état de Hue wall switch SdB Button 1 11:01:09
HUEWALLSWITCH a détecté un événement 11:01:09
STATUS déclenché par l'état de Hue wall switch SdB Button 1 11:00:57
BATHROOM allumé 11:00:57
HUEWALLSWITCH a détecté un événement 11:00:57
HUEWALLSWITCH a détecté un événement 11:00:56
HUEWALLSWITCH is the Hue Wall
BATHROOM is the Hue Lights Group
STATUS is an automation where i try to get the current status of the switch.
I looked at the custom sensor github but i would try to keep it as simple as possible whitout installing and interfering in my global HA installation if possible. Still, seems a great tools. Maybe when i’ll be more experienced
Edit : and i really don’t know why state is send 2 times…