Hello! How should I make this condition:
sensor is being off for n minutes
Here is what I tried, but got invalid code:
- id: '2837334233492'
alias: WC lights off with open door
trigger:
- entity_id: binary_sensor.door_window_sensor_158d0001e5d691
for:
minutes: 1
platform: state
to: 'on'
condition:
- condition: state
entity_id: switch.wall_switch_right_158d000245c5ca
state: 'on'
- condition:
entity_id: binary_sensor.motion_sensor_158d000224aa83
for:
minutes: 1
platform: state
to: 'off'
action:
- entity_id: switch.wall_switch_right_158d000245c5ca
service: switch.turn_off
HA says:
Invalid config for [automation]: extra keys not allowed @ data['condition'][1]['for']. Got None
extra keys not allowed @ data['condition'][1]['platform']. Got None
extra keys not allowed @ data['condition'][1]['to']. Got None
not a valid value for dictionary value @ data['condition'][1]['condition']. Got None. (See /config/configuration.yaml, line 79). Please check the docs at https://home-assistant.io/components/automation/
I have new question with trigger.
There are 3 known devices and I want alarm to turn on when last person leaves house. Is there a nice way to do that? Do not want to make 3 different automations with different conditions.
And also, I would like alarm to turn off, when somebody comes back home.
If someone knows an easy way to set this up - please help. For now I see only 6 automations with different triggers and conditions to solve this. This way seems not to be the best at all.
Typically that is done by using a group. And for device_trackers, there’s an automatically maintained group named group.all_devices that you could use (if you want to do this for all device_trackers.)
Basically, for a group of device_trackers, it will be 'home' if anyone in the group is 'home', and it will be 'not_home' when eveyone is not 'home'. The same thing goes for a group of binary_sensor’s. I.e., it will be 'on' when any entity in the group is 'on', and it will be 'off' when all of the entities in the group are not 'on'.
Then you just use the group in the trigger instead of the individual entities. Does that make sense?