So I have this best buddy, and we watch our “home” presence, respectively, to know when it’s appropriate to call each other. We’ve set up Home Zones for each other, and monitor those via a status LED. I now introduced TTS alerts, and we found, due to a smartphone’s wildly varying GPS accuracy, we get a lot of “… is at home”/"… is away" messages when crossing the Home Zone boundary.
So I thought we make a simple “for:” 5 minute delay for the “at home” triggers. This works fine for a trigger to:
combined with for:
:
# Frank presence
- alias: "Frank zuhause"
initial_state: True
trigger:
- platform: state
entity_id: person.frank
to: 'Home Frank & Hedwig'
# 5 min delay because it flatters at zone boundary
for: '00:05:00'
action:
- service: mqtt.publish
data_template:
topic: "weather/1/status/uv"
payload: 0
retain: true
- service: script.audio_alert
data_template:
audiofile: "frank-home.mp3"
but not for a trigger from:
combined with for:
:
# Frank presence in UV light (UV 0=green=present, UV 8=red=absent)
- alias: "Frank nicht zuhause"
initial_state: True
trigger:
- platform: state
entity_id: person.frank
from: 'Home Frank & Hedwig'
# 5 min delay because it flatters at zone boundary
for: '00:05:00'
action:
- service: mqtt.publish
data_template:
topic: "weather/1/status/uv"
payload: 8
retain: true
- service: script.audio_alert
data_template:
audiofile: "frank-not-home.mp3"
The error message from config checker is:
Invalid config for [automation]: dependency violation - key "for" requires key "to" to exist @ data['trigger'][0]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 740).
The problem is that I can’t simply use to: "not_home"
instead, because we both have other zones defined as well, and are only interested in the event that the other one enters/leaves his home zone.
N.B.: If anyone’s interested: We both use Owntracks, and have set up a secure MQTT bridge between our MQTT brokers to share some data we’re both interested in, because we live several hundred kilometers apart. Placing the green/red presence LED into the—currently defunct—UV indicator was just a convenience option.
Any good ideas? Or maybe the devs can consider making from:
work with for:
?
1 post - 1 participant
Read full topic