Hi All,
I have HA running on a synology NAS, with homebridge connecting to Homekit.
As mediaplayers I have 3 Google Home devices.
I wanted a button in Homekit that plays a specific radio stream (URL) to a specific Google Home device.
I got this working by creating a script that is pushed to homekit as a dumb button:
'1546443759261':
alias: QMusic_keuken
sequence:
- service: media_player.play_media
data_template:
entity_id: media_player.keuken
media_content_id: http://icecast-qmusic.cdp.triple-it.nl/Qmusic_be_live_128.mp3
media_content_type: audio/mp4
Now I was wondering,
How could I make a switch, that runs this script, but the button state is polled by the status of media_player.keuken.
And when switched off, it runs another script:
'1546444354459':
alias: Radio_OFF
sequence:
- data: {}
service: media_player.media_stop
Can this be done?
Many thanks