File
Home made webradio on Toniebox is the ultimate thing. We have different music playlists on one stream, and also a concurrent stream with audio book. While on music playlists it is just fine to have it runing 24/7, on audio books it would be very annoying to not start over where you have stopped last time.
So why not just force pausing the mpd-stream when Tonie is taken away from Toniebox and (re)start playback again when Tonie is back on top of the box…?! No problem with home assistant and its automation feature.
Setup
- teddycloud up and runing with mqtt enabled
- some mpd streams
- working home assistant
Automation
When you have made the above setup…boom…you are good to go
So this is my automation to toggle start playing the mpd stream when Tonie is put on specific Boxes:
alias: mpd to start playback the audio book playlist
description: ""
trigger:
- platform: mqtt
topic: teddyCloud/box/<boxid>/TagValid
payload: <tag id>
- platform: mqtt
topic: teddyCloud/box/<another_boxid>/TagValid
payload: <tag id>
condition: []
action:
- service: media_player.media_play
entity_id: media_player.audio_books
mode: single
And here is the pause event:
alias: mpd to pause audio book playlist
description: ""
trigger:
- platform: state
entity_id:
- sensor.<some_box_entity_name>_tag_valid
from: <tag id>
to: ""
- platform: state
entity_id:
- sensor.<another_box_entity_name>_tag_valid
from: <tag id>
to: ""
condition: []
action:
- service: media_player.media_pause
entity_id: media_player.audio_books
mode: single
Conclusion
As we use a lot of audio books…its great to never miss a part of the story and no need of skip or seek the story. Also on music based webradio it safes some traffic. Why streaming when nobody consumes the stream.
Also: just imageine what other thing would be possible…slap the box to play next title of playlist? Or just switch through list of webstream by tilt the box? No need for work arounds like mentioned here (although i like that thing).
Have fun