It would be Great to get some help from you regarding my new automation:
Enclosed you See photos of My Garden and my current automation which is not working.
Aqara contact sensor
hue Outdoor Motion Sensor
(3) Shelly 1 in Motor of the Gate
A)
If state from (1)Switches from closed to open
B)
Please Check if (2) detected Last 5 sec or Next 20 motion: of yes:
C) toggle the shelly → gate stops
D) Wait 3 sec
E) toggle the shelly again → gate will Go back to „closed“
Unfortunatelly step 1 is Not Wirkung yet, therefore I was Not trying the Next actions.
Maybe you also have Some Other ideas to automate this Secure automation?
If everything works, I would do the same automation for *door wents From Open to closed“. Here I would an additional aqara Sensor.
Unfortunatelly I am Not allowed to add More than 1 picture
alias: Schiebetor Sicherung (Duplicate)
description: >-
If the state is open, please check for the last 5 sec and the next 20 sec if
motions sensor is detecting anything. If triggered, pleas toggle shelly.
trigger:
platform: state
entity_id: switch.shelly1
to: open
from: closed
condition:
What you have above is: trigger on the lumi sensor then only perform the actions if the terasse_eingang sensor has been seeing continuous motion for 20 seconds or more.
What you could do instead is trigger on the terasse_eingang sensor detecting movement then use a wait for trigger (for at most 20 seconds) for the lumi sensor to detect movement. If the movement does not occur, do nothing. Like this:
trigger:
- platform: state
entity_id: binary_sensor.terasse_eingang_on_off
to: 'off'
from: 'on'
action:
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.lumi_lumi_sensor_magnet_df52bb01_on_off
to: 'off'
from: 'on'
timeout:
seconds: 20
continue_on_timeout: false
- service: switch.toggle
entity_id: switch.shelly1_e8db84d2f87b
- delay: 3
- service: switch.toggle
entity_id: switch.shelly1_e8db84d2f87b
I guess you need to swap around the first two entities.
Then it should trigger the automation, when the gate is moving (sensor magnet), just like you had it before.
After Wait_for you should be waiting for the motion sensor to detect any motion (Terrasse Eingang)
I copied it 1:1 and it works, but there are still some detailled parameters I need:
a) The second toggle is not working
b) As soon as the shelly gets toggled (second time - done by external control), the gate closes. For my understanding the automation should start from the beginning. Unfortunatelly it does not,…
c) I am not sure, but I think the automatation only works at the moment the sensor detects me.
What I would like to have is, that the automatation is running so long until the sensor is undetecting me.
Looking forward for more help and thank in advance!
I think you might be mistaken about what the toggle service does. It changes the state of the switch once. If the switch is off the toggle service turns it on. If the switch is on the toggle service turns it off. The toggle service does not switch off-on-off.
I have no idea what this means. You are going to have to explain it another way.
The default mode for an automation is single.
With the wait_for_trigger in your automation, it is likely, that the automation is still being active, when you activated the Shelly a second time. If you would like to trigger the automation again, you’d need to change its mode.
My automation is working well now.
Thanks a lot for your support, I think my mistake was the understanding of „toggle“. I thought it would mean change the status of device 2 time, like for example turn on and turn off.