Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Merging trackers statuses with automation templating

$
0
0

@Wim_L wrote:

In my early spring code cleaning, I tried to combine the device_tracker.see service to do both home/not_home in one automation, but I fail somewhere with yaml.
Is it possible to send the dev_id and location name from inside the statement?

# trackers onoff
- alias: any tracker home/away
  trigger:
    - platform: state
      entity_id: 
        - sensor.rtagme
        - sensor.rtaghoney
        - sensor.rtag3
  action:
    - service: device_tracker.see
      data_template: >
        {% if trigger.entity_id' == 'home') %}
            dev_id: "{{ trigger.from_state.name }}"
            location_name: home
        {% else %}
            dev_id: "{{ trigger.from_state.name }}"
            location_name: not_home
        {% elif %}

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles