Outstanding @123! Thank you. Your commitment to grammar is unparalleled and appreciated. Mods done!
Any chance you could hope over here and comment? Trying to get my head around sending TTS messages to devices that arenāt playing music using placeholders like '{{volume}}' and '{{tts}}' so I can refer to one script all the time but Iāve never done that before. Wife is going spare when my HA notifications interrupt her music.
I donāt have any media players which makes it impossible for me to test templates for them (or understand why a group of media players doesnāt report being on when one of them is playing). I have helped other people with their media player issues but I had a difficult time because I was mostly āflying blindā. All this to say that I canāt be very effective in this case.
Thanks, understood. I got the following to work but not quite sure about the '{{volume}}' and '{{tts}}' stuff but Iāll refer the other thread to see if I can work that out.
This probably isnāt powerful enough for what you want but something I use to prevent my media players from trying to push out TTS messages at the wrong time is to include the following in my automation just before the TTS action:
wait_template: "{{ is_state('media_player.lounge_mini', 'off' or 'idle') }}"
which then makes the TTS wait until the media player isnāt actively playing something already
Thanks Dave. I need the notifications to happen instantly and just to ignore the GH devices that are actually playing music. Iām half way there so Iāll keep chipping on.
Letās assume you have a group containing all your media_players. To get a list of which ones in the group are currently not playing, you can use this template:
Thanks, but doesnāt appear to work. Running 0.98.5. Running the code below in the template editor when one of the two speakers in the group is playing produces media_player.upstairs_homes. I would have thought this should have reported media_player.lounge_home in my case, the speaker that was not playing.
In my use scenario though it might not be needed. The only time we invoke a group media call is for TTS notifications so it is unlikely, at least in our house, that the group would be playing music. If we do listen to music it tends to be just the GH in the zone weāre in.
{% set x = (as_timestamp(now())
- state_attr('input_datetime.soldering_iron_start', 'timestamp'))
|timestamp_custom('%M', false) | int %}
{{x}} minute{{'' if x == 1 else 's'}}