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

Template Switch

$
0
0

@Auto101 wrote:

Hi
I am new to HA .I am trying to create a template switch . With the below code, I am able to get the switch in UI but when I toggle it to ON , it turns on the soundbar and toggle icon just goes back to its previous state (off) . The soundbar doesn’t turn off though .

Any help is appreciated .

   - platform: template
    switches:
      bose:
        value_template: "{% if is_state('media_player.bose', 'on') %}on{% else %}off{% endif %}"
        turn_on:
          service: media_player.turn_on
          data:
            entity_id: media_player.bose
        turn_off:
          service: media_player.turn_off
          data:
            entity_id: media_player.bose

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95397

Trending Articles



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