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

Using input_boolean helpers in templates (configuration.yaml)

$
0
0

Hi.

I have numerous automation that make announcements over our SONOS system. Before any announcement is made, the automation checks a flag (an input_boolean flag called sonos_announcements that can be toggled on or off). If the flag is set to on, then the announcements are made; if not, then no announcements.

I’d like to change the icon for the helper based on whether it is ‘on’ or ‘off’. I’ve done this successfully with various switches in my configuration.yaml, but for some bizarre reason, can’t get it to work with a boolean ‘helper’

Can somebody point me in the right direction?

switch:
    - platform: template
      switches:

         [...other switches here that seem to work OK...]

          sonos_announce:
            friendly_name: "SONOS Announcements"
            value_template: "{{ states('input_boolean.sonos_announcments')}}"
            turn_on:
              service: input_boolean.turn_on
              target:
                  entity_id: input_boolean.sonos_annoucements
            turn_off:
              service: input_boolean.turn_off
              target:
                entity_id: input_boolean.sonos_annoucements
            icon_template: >-
              {% if states('input_boolean.sonos_annoucements') == 'on' %}
                mdi:speaker
              {% else %}
                mdi:speaker-off
              {% endif %}
            unique_id: "c7310e44-451b-11ee-be56-0242ca120199"

I have searched the forum, but can’t find a suitable answer.

3 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 106757

Trending Articles



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