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

Combine 2 actions into 1

$
0
0

@poudenes wrote:

Hi All,

Im struggling with Presence. Sometimes geofence or Locative are not sending the URL to turn tracker at ‘home’ or ‘away’.
So I created a input_boolean and a binary_sensor.

Binary_sensor look to state of input_boolean.

Here is the 2 scripts. When geofence tracker state home then input_boolean get state ‘on’ same for locative tracker. Individual they turn on or off the input_boolean. So when 1 of both fails to send the URL then still I have a correct ‘Presence’
Now I want combine them into 1 action based on trigger entity_id. but tried lot of things without success:

- alias: 'System - Peter Left or Arrive GeoFency Manual'
  trigger:
  - entity_id: device_tracker.geofency_peter
    platform: state

  action:
    - service_template: >-
        {% if is_state('device_tracker.geofency_peter', 'home') %} input_boolean.turn_on
        {% else %} input_boolean.turn_off
        {% endif %}
      data:
        entity_id: input_boolean.peter_home_manual

- alias: 'System - Peter Left or Arrive Locative Manual'
  trigger:
  - entity_id: device_tracker.1717fe36_3c70_4599_963c_b70b6ee95eba
    platform: state

  action:
    - service_template: >-
        {% if is_state('device_tracker.1717fe36_3c70_4599_963c_b70b6ee95eba', 'home') %} input_boolean.turn_on
        {% else %} input_boolean.turn_off
        {% endif %}
      data:
        entity_id: input_boolean.peter_home_manual

a OR statement is not the correct one, because it will check then both trackers.

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95284

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>