Repeatable bug in wait_template

You need to add an entity list inside the sonos_master_state. Every entity_id that pops up as a state for states(‘input_text.sonos_group_master’) needs to be in that list otherwise it will not work. Templates cannot create listeners if it doesn’t know what to listen to and that is the root cause of the problem. This is the same issue that now() has. No entity_id, no updates.

      sonos_master_state:
        friendly_name: Sonos Master state
        entity_id:
          - media_player.one
          - media_player.two
          - media_player.three
        value_template: >
          {{ states(states('input_text.sonos_group_master')) }}

Templates have been like this since the begining of HA. It’s why the entity_id attribute exists.

1 Like

Yep… my bad. I have got so used to not including them that it didn’t occur to me that it wouldn’t be able to work out what entity to listen to.

Thanks, as usual.

it’s a pain in the ass but you gotta think about it this way:

If we added dynamic listeners the following flow would still not work for you.

  1. media_player.one turns to playing
  2. input_text.one populates with media_player.one
  3. template creates listener to listen to state change on media_player.one
  4. your stuff doesn’t fire until the next media_player.one state change.

Then you’d have to change your crap around. Also just imagine the support issues that it would create. Bah.

1 Like