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

On/Off scripts launched from single service call

$
0
0

@nasgul wrote:

HA 0.106.1
I have several media player scenes. In the example below the current active scene SRF3 plays over 3 Sound (media players) zones.


with the entities in the Sound Zone section, I want to toggle off one or the other zones from the current scene.
I created the necessary scripts. mediazone_xyz_on and mediazone_xyz_off.
### test
mediazone_living_off:
  alias: MZ Living Off
  sequence:
    - service: media_player.media_stop
      entity_id: group.living_players

mediazone_living_on:
  alias: MZ Living On
  sequence:
    - service: media_player.media_play
      entity_id: group.living_players

To control the zone from the glance Card I created an input boolean entity.

input_boolean:
  mediazone_living:

From the UI Sound Zones Card I am trying to toggle the zone on and off by activating one of the scripts as follows but I am getting a code error for a missing service data.

             - type: glance                                    # SOUND   ZONES  CARDS
                style: |
                  ha-card {
                    color: white;
                    font-variant: small-caps;
                    border-top: 3px double grey;
                    border-left: 1px dotted grey;
                  }
                  .card-header {
                    font-size: 23px;
                    color: white;
                    text-align: center;
                title: Sound Zones
                columns: 5
                show_state: false
                show_name: true
                entities:
                  - entity: input_boolean.mediazone_living
                    name: Living
                    icon: mdi:sofa
                    tap_action: 
                      action: call-service
                      service: script.turn_on
                      data_template:
                        entity_id: >
                          script.mediazone_living_{{states('input_boolean.mediazone_living')}}

something is wrong in there but can’t figure where.
Erik

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles



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