The LMS Notify TTS platform lets you use the TTS integration Service Say and a LMS media_player to alert you of important events. This integration provides a simple interface to use in your automations and alerts.
restores the state, volume, sync group, playlist and media position after playing the notify message
queue messages for each player so new messages do not interrupt the current playing one
option alert sound before the message
option how many times to repeat the tts message
option volume for the tts message
Default options can be set in the configuration file or overridden with each message
This is great, exactly what I was looking for! Thanks for your work.
Installed and running without a hitch other than forgetting to set the device_group. Maybe this could be optional? I plan to announce a warning throughout the house when the alarm is triggered to give a visitor time to disarm it before the siren goes off, in which case no entity would be set to ‘home’.
Also playback always resumes at the start of the song rather than picking up where it left off. Is that a bug?
You can use the option force_play to skip the check if the device group is set to home
Playback where left of is a bug and will be fixed in the next update
This is only going to be enabled for players not in an sync group because with me the players are out of sync when I use it
You can try if you experience the same problem by uncommenting line 174 in init.py: #self.restore_media_possition(player)
I tried the component but I get an error after the message was played and the component tries to resync the players. The media_player in the error message is not the player used for the TTS but it is synced with it.
2021-07-16 16:45:48 ERROR (Coordinator) [root] Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/config/custom_components/lms_tts_notify/__init__.py", line 143, in run
if self.check_done():
File "/config/custom_components/lms_tts_notify/__init__.py", line 171, in check_done
if self._queue_listener[player].state_save['state'] == 'playing':
KeyError: 'media_player.radio_kueche'
Also I got an error when I left out the volume for the notify configuration.
For now the best thing is configure every LMS player.
I have some partial code to auto configure all LMS players but do not know when I’ll have the time to finish it
entity_registry = hass.helpers.entity_registry.async_get_registry()
lms_players = {}
for entity_id in hass.states.async_entity_ids():
entity_domain = entity_id.split('.')[0]
if entity_domain == 'media_player':
if entity_registry.async_get(entity_id).platform == 'squeezebox':
lms_players[entity_id] = entity_registry.async_get(entity_id).platform
Works great (also with Google Cloud TTS). However, I notice this component conflicts if you have ‘replay playlist’ as default. It will replay the message non-stop. Since I always use ‘replay playlist’, is there a way to have the action in this component that saves states, also saves repeat state, then:
turns off repeat > send message> and then restore all states including repeat state?
Also somehow it doesn’t restore the media position, but starts the song over again. (ninja edit, I see now: Playback where left of is a bug and will be fixed in the next update)
One last thing: would it be possible for the non-targeted players to keep playing and just re-sync the targeted player? So if all players that are playing are targeted, they just resume where they left off. But if you target player A in a group of 3, then B and C should keep playing. After the message player A should just resync to the group. Currently when targeting a player inside a synced group, all players will stop when the targeted player plays a message.
Playback where left of is only for players not in a sync group because when I try it with players in a sync group they are not in sync anymore
uncomment line 175 #self.restore_media_possition(player) and try if you have the same
Non targeted players in a sync group that stop playing I already noticed but it is not consistent, I do only unsync targeted players and not the whole sync group
Forgot about the replay option because I never use it, looking in to it I see that media_player.repeat_set service is not working with the squeezebox integration
I believe Squeezebox integration needs to use the service call_query. According to the page, this would be the CLI command:
<playerid> playlist repeat <0|1|2|?|>
The "playlist repeat" command is used to indicate or query if the player will stop playing at the end of the playlist, repeat the current song indefinitely, or repeat the current playlist indefinitely. A value of "0" indicates that the player will stop at the end of the playlist, "1" indicates that the player will repeat the current song indefinitely and a value of "2" indicates that the player will repeat the entire playlist indefinitely. Used with no parameter, the command toggles the repeat state.
Example:
Request: "04:20:00:12:23:45 playlist repeat ?<LF>"
Response: "04:20:00:12:23:45 playlist repeat 2<LF>"
Request: "04:20:00:12:23:45 playlist repeat 0<LF>"
Response: "04:20:00:12:23:45 playlist repeat 0<LF>"
Though if I’m being honest, I have never used query commands and this all looks abracadabra to me at the moment lol.
edit: you can use a service call_method and use this as a service call:
What parameter do you use to unsync a target player? I notice that when I use squeezebox service call to unsync a player, there is no interruption and the group continues te play.
This works great for me apart from the same problem I’ve always had with TTS on LMS: It does not resume playing after the announcement. I have tried it with a playlist, or a radio station and it fails every time.
I’m running Logitech Media Server Version: 8.1.2. Any ideas?
The Playlist folder was empty, but I was also getting an error in the LMS logs - bad server config. I realised that it wasn’t able to access the playlist folder, despite the docker-compose.yml entry being correct.
That led me to the LMS Server setting under Basic Settings. The entry there for the Playlists Folder was empty! Setting this to /playlist fixed the problem and now it works perfectly!
Many thanks for your help!
I have a feature request if you have the time (or perhaps you can think of another solution).
I have two networks, the first is for laptops, phones etc and the second is isolated so that my cameras and smart devices can’t access the internet or be accessed directly. My home assistant server can access both of these networks and has a different IP for each.
My LMS and Squeezelite players are on the isolated network and can be accessed by home assistant but when I use the LMS TTS notify queue, the playlist entry for the tts mp3 points to the IP of home assistant on the main network, not the IP of home assistant on the isolated network, so LMS can’t access the mp3 to play it.
My suggestion is an optional setting to specify the home assistant IP/hostname used when adding a tts entry in the LMS playlist. Alternatively, an even nicer solution would be to specify the network adapter to use and pick up the IP/hostname from the HA configuration.
This is great! Now running Sonos, Nest and my ancient SB Radios on LMS. It is probably my yaml capabilities but how to ensure that I can tts multiple mediaplayers at once? Below is not working.