As my coding skills aren’t that gooe, I’m hoping someone can help me with the following:
The usecase: my garden is a point of entrence to our house, but is rather dark at night. So when we come home and it is dark, I would like to turn on a lamp that is installed in the garden and have it turned off after 5 minutes. I own a Asus RT-AC88U, and I would like to use that for tracking devices. In my configuration.yaml I have this:
device_tracker:
- platform: asuswrt
interval_seconds: 10
track_new_devices: yes
In my atomations.yaml I have this:
alias: lamp tuinkast aan bij thuiskomst
- id: '1582974603397'
alias: Lamp tuinkast aan
description: ''
trigger:
- entity_id: device_tracker.galaxy_a40
platform: state
from: not_home
to: home
condition: []
action:
- entity_id: light.lamp_tuinkast
service: light.turn_on
- id: '005'
alias: Lamp tuinkast aan
description: ''
trigger:
- entity_id: device_tracker.galaxy_a70
platform: state
from: not_home
to: home
condition: []
action:
- entity_id: light.lamp_tuinkast
service: light.turn_on
- id: '004'
alias: lamp tuinkast uit na 5 minuten
trigger:
- platform: state
entity_id: device_tracker.galaxy_a70
to: home
for: 00:05:00
- platform: state
entity_id: device_tracker.galaxy_a40
to: home
for: 00:05:00
action:
service: homeassistant.turn_off
entity_id: light.lamp_tuinkast
This works -sortof…
When I turn the wifi of my Phone (Galaxy A70) off and on, the lamp is turned on. Sometimes. Dito for my wife’s a40. When it is turned on, it is turned off after 5 minutes - that part seems to work. But I cannot get it to work as reliable as I would hope it would, and this is getting beyond my present coding skills. I assume there is a far better way to make the magic happen, and I would realy like to learn from the pros…