a bit of a long winded one this…and maybe I’m trying too hard…but here goes
Ive set up some templates, which show me how many TVs or speakers are on in the house.
These in turn populate some popups when I wasn’t to see what speakers or TVs are on so I can turn them off (if needed)
I do so using, for example:-
- platform: template
sensors:
audio_players_on:
friendly_name: Speakers on
value_template: >-
{{ states.media_player
| rejectattr(‘entity_id’, ‘eq’, ‘media_player.plexipadpro129’)
| rejectattr(‘entity_id’, ‘eq’, ‘media_player.gardenroomsonos’)
| selectattr(‘state’, ‘eq’, ‘playing’)
| list | count}}
So the above will give a number of speakers that are on but will ignore the media_player plexipadpro129 even if it has the state playing.
My issue is this
I do want the speaker in bold (GardenRoomSonos) to show up when it’s playing any source other than TV…but as it is fed by the TV itself…if the TV is not on I do want to see that it is playing audio as a speaker
I tried using
I’ve tried to add the following instead, but this just doesn’t work
| rejectattr(‘entity_id’, ‘eq’, ‘media_player.gardenroomsonos.source’, ‘TV’)
but this doesn’t seem to work, the template returns unavailable…is what I want even possible??
I wont lie, its pretty specialist
TIA