testing @tenly’s Places sensor,
I have this automation , which is taken from the example on the components GitHub, and added a few conditions to prevent it from triggering every 30 seconds.
Trying to prevent it form triggering who I am at home and stay home, it still triggers despite my conditions that usually work when using regulate trigger.to_state != trigger.from_state.
Also, I am not sure about the zones condition. without it it triggers constantly because it is moving. I don’t want that, and only signal when in a known zone.
since this is now using an event, I am somewhat puzzled. Plate have a look with me?
- alias: Locate M
initial_state: 'off'
trigger:
platform: event
event_type: places_state_update
condition:
- condition: template
value_template: >
{{ trigger.event.data.entity == 'M places' }}
- condition: template
value_template: >
{{ trigger.event.data.to_state is not none and
trigger.event.data.from_state is not none and
trigger.event.data.to_state != trigger.event.data.from_state }}
- condition: template
value_template: >
{% set zones = states.zone | map(attribute='name')|list %}
{{trigger.event.data.devicetracker_zone in ['home','not_home'] or
trigger.event.data.devicetracker_zone in zones }}
- condition: template
value_template: >
{{ state_attr('automation.locate_m','last_triggered') != none and
as_timestamp(now()) | int -
as_timestamp(state_attr('automation.locate_m','last_triggered'))
| default(0) | int > states('input_number.presence_timer')|int }}
- condition: template
value_template: >
{{ is_state('input_boolean.notify_presence', 'on')}}
action:
- service: notify.ios_phone
data_template:
title: >-
Locate: {{ trigger.event.data.entity }} ({{ trigger.event.data.devicetracker_zone }}) {{ trigger.event.data.place_name }}
message: |-
{{ trigger.event.data.entity }} ({{ trigger.event.data.devicetracker_zone }})
{{ trigger.event.data.place_name }}
{{ trigger.event.data.distance_from_home }} from home and traveling {{ trigger.event.data.direction }}
{{ trigger.event.data.to_state }} ({{ trigger.event.data.mtime }})
data:
attachment:
url: >
{{ trigger.event.data.map }}
hide_thumbnail: false