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

Template to include entity (or not)

$
0
0

@belowe wrote:

This seems so simple to me that I think I may be thinking about it wrong. I have a ‘Christmas Time’ input boolean that we turn on when we get all the Christmas decorations out. I have a ‘lights out’ automation that turns some specific lights off at night. If the boolean is on, I want an entity included in the automation. Otherwise, I want it left out.
The below code will work when the boolean is on BUT not when it’s off. I get that. My question is how do I do what I want in THIS automation?

- alias: Nighttime lights off
  trigger:
    platform: template
    value_template: "{{ states('sensor.time') == (state_attr('input_datetime.outside_lights_off_time', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
  action:
    - data_template:
        entity_id:
          - group.front_yard
          - group.back_yard
          - >-
            {% if states('input_boolean.christmas_time') == 'on' %}
            switch.christmas_tree
            {% endif %}
      service: homeassistant.turn_off

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95541

Trending Articles



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