I have an automation that uses my wife and I’s phone device trackers to switch on the outdoor light when we arrive in the pre-configured home zone and then switch it back off again after 10 mins. There are a couple of conditions, one for sun/sunset and the other that the light isn’t already on.
alias: Front Door Light (Home Zone)
description: >-
Turn on front door light when Jo or Ryan arrives in home zone and switch off
after 10 mins.
trigger:
- platform: device
device_id: 8f0df0742263f7a7cd9be9ded9af9d3f
domain: device_tracker
entity_id: device_tracker.jo
type: enters
zone: zone.home
- platform: device
device_id: 130ce7df6b2b9ba08500bb9d47086ee5
domain: device_tracker
entity_id: device_tracker.ryan
type: enters
zone: zone.home
condition:
- condition: or
conditions:
- condition: sun
after: sunset
- condition: sun
before: sunrise
- condition: state
state: 'off'
entity_id: light.front_door
action:
- type: turn_on
device_id: fe4692e03625aa556aed9df5e1b93fff
entity_id: light.front_door
domain: light
brightness_pct: 100
- delay:
hours: 0
minutes: 10
seconds: 0
milliseconds: 0
- type: turn_off
device_id: fe4692e03625aa556aed9df5e1b93fff
entity_id: light.front_door
domain: light
mode: single
This works perfectly unless we take longer than 10 mins between entering the home zone and getting to the house, i.e. stopped for a chat etc
I would like to exchange the wait time for a wi-fi connection time where either of us have been connected to the home network (SSID: “ASUS”) for 10 mins, therefore ensuring we’ve made it to the house.
The sensors for the SSID are:
sensor.ryan_wifi_connection
sensor.jo_wifi_connection
I’m sure this should be easy, but for the life of me I cannot work out how to do it.
My presumption is that it’s a wait template but those seem to be set to pause an automation rather than shut it off.
I guess if I could set up a couple of boolean helpers and then write automations for both of us.
i.e.
input_boolean.wi_fi_connected_ryan
input_boolean.wi_fi_connected_jo
and then automations:
alias: Connected to ASUS for 10 mins (jo)
description: ''
mode: single
trigger:
- platform: state
entity_id: binary_sensor.jo_wifi_state
to: ASUS
for:
hours: 0
minutes: 10
seconds: 0
condition: []
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.wi_fi_connected_jo
alias: Connected to ASUS for 10 mins (ryan)
description: ''
mode: single
trigger:
- platform: state
entity_id: binary_sensor.ryan_wifi_state
to: ASUS
for:
hours: 0
minutes: 10
seconds: 0
condition: []
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.wi_fi_connected_ryan```
Then use the output of the boolean connector as a trigger to turn off the light.
However I’m then stuck on the logic thinking that’s not going to work if one of us is already in the house.