Hello
I like to switch off (switch.dual_nano_switch_5), if nobody is at home. In this case it is not working. If i do the device tracker apart it is working well for both. If i delete the condition it working also.
There are at least 2 major issues that you need to address.
First, your automation is set up to only trigger at 23:13. If you want it to fire when everyone has left the home, you need to make that a trigger too, not just a condition.
Second, your template is not properly constructed. The second part is missing the function is_state. If you have other Zones set up, using not_home as the desired state may not work the way you want it to. It would be better to check if either of them were home, then negate that. That way other non-Home zones would be treated the same as not_home.
alias: Licht uit doen Tafellamp
trigger:
- alias: Trigger at a specific time
platform: time
at: "23:13:00"
- alias: Trigger when both phone trackers leave Home
platform: template
value_template: |
{{ not (is_state('device_tracker.iphone_13', 'home') or
is_state('device_tracker.iphone', 'home')) }}
condition:
- alias: Check that neither phone tracker is home
condition: template
value_template: |
{{ not (is_state('device_tracker.iphone_13', 'home') or
is_state('device_tracker.iphone', 'home')) }}
action:
- service: homeassistant.turn_off
target:
entity_id: switch.dual_nano_switch_5
- service: notify.homeautomation
data:
title: Licht uit
message: "De tafellamp gaat uit."