Logitech Media Server TTS Notify Queue

Thank you…

Any way to find out why volume is not changing as per the service call ?

Seems to me because you use a Chromecast-player.
I can recommend a squeezelite esp32 based player, wich you can build yourself, or a readymade one like the espMuse.

THANK you @floris-b for this!!! :bowing_man: :+1:

Have tried to get it working some time ago without success…
Bit the bullet now and it works. :star_struck:

@floris-b (or anyone else), is this normal behavior:

  1. if a playlist is loaded with shuffle setting, this setting is lost after resuming playback?
  2. you can only use 1 player that should be predefined in the configuration.yaml?
    EDIT
  3. I have configured 2 TTS voices, changed the preferred one but still keep getting the same
  - service: squeezebox.call_method
    target:
      entity_id: media_player.bedroom_speaker
    data:
      command: mixer
      parameters:
        - volume
        - 6
  - service: lms_tts_notify.queue
    metadata: {}
    data:
      volume: 0.4
      message: Testing volume levels
      entity_id: media_player.bedroom_speaker
  - service: squeezebox.call_method
    target:
      entity_id: media_player.bedroom_speaker
    data:
      command: mixer
      parameters:
        - volume
        - 3
  1. If I run the above automation. Before the announcement even starts the volume is set to “3”. Shouldn’t the service calls execute once the previous once is finished???

  2. Does LMS NOTIFY QUEUE remembers the state of shuffle and repeat ?

  1. Yes
  2. Yes

TTS works fine but restoring the playlist doesn’t work, some playlist is restored everytime that is not created by me so I don’t understand where this comes from.
I have the ‘Playlists Folder’ configured in LMS and in HA I also can see the contents of that folder, this folder has 777 as permissions on the LMS server.

Try if deleting the playlist “Save-media_player.YOUR_MEDIAPLAYER” in lms solves your problem.

1 Like

It’s the same for me. I have a config with 4 players. When I run the service, tts is bein announced, playlists are created/updated but player don’t get resumed. Also, subsequent lms tts calls don’t work. Here’s my config:

  - platform: lms_tts_notify
    name: gabinetpod
    tts_service: tts.google_say
    media_player: media_player.lms_gabinetpod
    device_group: group.all_persons
    alert_sound: Alert
    volume: 0.4
  - platform: lms_tts_notify
    name: denon
    tts_service: tts.google_say
    media_player: media_player.denon_avc_x4800h_3
    device_group: group.all_persons
    alert_sound: Alert
    volume: 0.4
  - platform: lms_tts_notify
    name: sypialnia
    tts_service: tts.google_say
    media_player: media_player.denonpi
    device_group: group.all_persons
    alert_sound: Alert
    volume: 0.4
  - platform: lms_tts_notify
    name: lazienka
    tts_service: tts.google_say
    media_player: media_player.dietpi_squeezelite_2
    device_group: group.all_persons
    alert_sound: Alert
    volume: 0.4

Hi Cadster, thanks for replying. :bowing_man:
Deleting those files (did not notice that they were created, or think of it) helped. :+1:

One thing though: sometimes the position in the current song is not stored and the track starts from the beginning, of course in sync on all players.
It’s not a biggy, just curious if this is something in my setup or just happens sometimes?

I have seen this behaviour as well. I gues it has something to do with playing local or streaming music.

2 Likes

Well, it was with the same local playlist that I was testing this so I was wondering if this inconsistency has a cause.
You have replied in this topic that the playback mode (shuffle, repeat…) should be maintained after the TTS.
Only tested this now and it’s not… :angry:

Could this be related to also not going back to exact playing position in a track every time?

I want to use messages in different languages. I have the integration working with Google translate and the Google say service (I couldn’t get it going with tts.speak). In the configuration.yaml setup I can add a language in the tts section (e.g. language: “es-es”) but that then sets a language for all my messages. When I call a service with an automation there doesn’t seem to be an option to specify a different language.
Does anyone do this or at least know how to do it?

This is absolutely fabulous! Just what I was looking for. Thanks for this integration!

I was cheering too soon, unfortunately. I can’t get the notifications to work on my squeezelite devices. The only device that works, is my Nvidia Shield (android) with SB Player. The rest are raspberry pi’s with Max2Play and squeezelite.

I get the following from the log:

2024-05-14 16:44:31.205 DEBUG (MainThread) [custom_components.lms_tts_notify] Received on event bus: {'repeat': 1, 'entity_id': 'media_player.muziekgarage', 'device_group': 'group.phones', 'message': 'Tessa, de wasmachine is klaar.'}
2024-05-14 16:44:31.419 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save state: media_player.muziek_woonkamer -> {'state': 'playing', 'attributes': {'group_members': [], 'volume_level': 0.34, 'is_volume_muted': False, 'media_content_id': 'http://icecast.omroep.nl/radio2-bb-aac', 'media_content_type': <MediaType.MUSIC: 'music'>, 'media_position': 3536, 'media_position_updated_at': datetime.datetime(2024, 5, 14, 14, 44, 31, 229919, tzinfo=datetime.timezone.utc), 'media_title': 'I Just Died In Your Arms Tonight', 'media_artist': 'Cutting Crew', 'media_channel': 'NPO Radio 2 92.6 (Pop)', 'shuffle': False, 'repeat': <RepeatMode.OFF: 'off'>, 'query_result': {'_p2': '0'}, 'sync_group': [], 'entity_picture': '/api/media_player_proxy/media_player.muziek_woonkamer?token=ba0b8dcd970839bd8c02af75948932593833cc3cae6a86d1c4dbe729055b8310&cache=878ae75a0b97bb14', 'friendly_name': 'Muziek Woonkamer', 'supported_features': <MediaPlayerEntityFeature.PAUSE|SEEK|VOLUME_SET|VOLUME_MUTE|PREVIOUS_TRACK|NEXT_TRACK|TURN_ON|TURN_OFF|PLAY_MEDIA|STOP|CLEAR_PLAYLIST|PLAY|SHUFFLE_SET|BROWSE_MEDIA|REPEAT_SET|GROUPING|MEDIA_ENQUEUE: 3077055>}}
2024-05-14 16:44:31.621 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save state: media_player.muziek_kantoor -> {'state': 'off', 'attributes': {'group_members': [], 'query_result': {'_p2': '0'}, 'sync_group': [], 'friendly_name': 'Muziek Kantoor', 'supported_features': <MediaPlayerEntityFeature.PAUSE|SEEK|VOLUME_SET|VOLUME_MUTE|PREVIOUS_TRACK|NEXT_TRACK|TURN_ON|TURN_OFF|PLAY_MEDIA|STOP|CLEAR_PLAYLIST|PLAY|SHUFFLE_SET|BROWSE_MEDIA|REPEAT_SET|GROUPING|MEDIA_ENQUEUE: 3077055>}}
2024-05-14 16:44:31.824 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save state: media_player.muziek_boudoir -> {'state': 'off', 'attributes': {'group_members': [], 'query_result': {'_p2': '0'}, 'sync_group': [], 'friendly_name': 'Muziek Boudoir', 'supported_features': <MediaPlayerEntityFeature.PAUSE|SEEK|VOLUME_SET|VOLUME_MUTE|PREVIOUS_TRACK|NEXT_TRACK|TURN_ON|TURN_OFF|PLAY_MEDIA|STOP|CLEAR_PLAYLIST|PLAY|SHUFFLE_SET|BROWSE_MEDIA|REPEAT_SET|GROUPING|MEDIA_ENQUEUE: 3077055>}}
2024-05-14 16:44:32.028 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save state: media_player.muziekgarage -> {'state': 'playing', 'attributes': {'group_members': [], 'volume_level': 0.44, 'is_volume_muted': False, 'media_content_id': 'http://icecast.omroep.nl/radio2-bb-aac', 'media_content_type': <MediaType.MUSIC: 'music'>, 'media_position': 14, 'media_position_updated_at': datetime.datetime(2024, 5, 14, 14, 44, 31, 837069, tzinfo=datetime.timezone.utc), 'media_title': 'I Just Died In Your Arms Tonight', 'media_artist': 'Cutting Crew', 'media_channel': 'NPO Radio 2 92.6 (Pop)', 'shuffle': False, 'repeat': <RepeatMode.OFF: 'off'>, 'query_result': {'_p2': '0'}, 'sync_group': [], 'entity_picture': '/api/media_player_proxy/media_player.muziekgarage?token=2bac9237092560faa46845e372efdf8d14c26a286261af5e8790af766eeaa74b&cache=878ae75a0b97bb14', 'friendly_name': 'MuziekGarage', 'supported_features': <MediaPlayerEntityFeature.PAUSE|SEEK|VOLUME_SET|VOLUME_MUTE|PREVIOUS_TRACK|NEXT_TRACK|TURN_ON|TURN_OFF|PLAY_MEDIA|STOP|CLEAR_PLAYLIST|PLAY|SHUFFLE_SET|BROWSE_MEDIA|REPEAT_SET|GROUPING|MEDIA_ENQUEUE: 3077055>}}
2024-05-14 16:44:32.028 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save playlists: media_player.muziek_woonkamer
2024-05-14 16:44:32.031 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save playlists: media_player.muziek_kantoor
2024-05-14 16:44:32.033 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save playlists: media_player.muziek_boudoir
2024-05-14 16:44:32.036 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save playlists: media_player.muziekgarage
2024-05-14 16:44:32.038 DEBUG (Coordinator) [custom_components.lms_tts_notify] UnSync media_player.muziekgarage
2024-05-14 16:44:32.551 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Playing message 'Tessa, de wasmachine is klaar.'
2024-05-14 16:44:48.217 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player stuck
2024-05-14 16:45:03.868 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player stuck
2024-05-14 16:45:03.868 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Waiting for media_player.muziekgarage to finish
2024-05-14 16:45:04.070 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage not done
2024-05-14 16:45:04.272 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage not done
2024-05-14 16:45:04.475 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage not done
2024-05-14 16:45:04.677 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage not done
2024-05-14 16:45:04.879 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage not done
2024-05-14 16:45:05.081 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage not done
2024-05-14 16:45:05.284 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage not done
2024-05-14 16:45:05.486 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage not done
2024-05-14 16:45:05.688 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage not done
2024-05-14 16:45:05.890 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage not done
2024-05-14 16:45:05.890 DEBUG (muziekgarage_queue) [custom_components.lms_tts_notify] Player: media_player.muziekgarage stuck
2024-05-14 16:45:05.892 DEBUG (Coordinator) [custom_components.lms_tts_notify] Restore volume: media_player.muziekgarage
2024-05-14 16:45:05.894 DEBUG (Coordinator) [custom_components.lms_tts_notify] Restore state: media_player.muziekgarage -> {'state': 'playing', 'attributes': {'group_members': [], 'volume_level': 0.44, 'is_volume_muted': False, 'media_content_id': 'http://icecast.omroep.nl/radio2-bb-aac', 'media_content_type': <MediaType.MUSIC: 'music'>, 'media_position': 14, 'media_position_updated_at': datetime.datetime(2024, 5, 14, 14, 44, 31, 837069, tzinfo=datetime.timezone.utc), 'media_title': 'I Just Died In Your Arms Tonight', 'media_artist': 'Cutting Crew', 'media_channel': 'NPO Radio 2 92.6 (Pop)', 'shuffle': False, 'repeat': <RepeatMode.OFF: 'off'>, 'query_result': {'_p2': '0'}, 'sync_group': [], 'entity_picture': '/api/media_player_proxy/media_player.muziekgarage?token=2bac9237092560faa46845e372efdf8d14c26a286261af5e8790af766eeaa74b&cache=878ae75a0b97bb14', 'friendly_name': 'MuziekGarage', 'supported_features': <MediaPlayerEntityFeature.PAUSE|SEEK|VOLUME_SET|VOLUME_MUTE|PREVIOUS_TRACK|NEXT_TRACK|TURN_ON|TURN_OFF|PLAY_MEDIA|STOP|CLEAR_PLAYLIST|PLAY|SHUFFLE_SET|BROWSE_MEDIA|REPEAT_SET|GROUPING|MEDIA_ENQUEUE: 3077055>}}
2024-05-14 16:45:05.902 DEBUG (Coordinator) [custom_components.lms_tts_notify] Restore playlist: media_player.muziekgarage
2024-05-14 16:45:05.904 DEBUG (Coordinator) [custom_components.lms_tts_notify] Restore media_position: media_player.muziekgarage
2024-05-14 16:45:05.908 DEBUG (Coordinator) [custom_components.lms_tts_notify] Players all done: {'media_player.muziekgarage'}

EDIT
A little more explanation. It’s not for all devices the same, but for this instance, the music stops, but there is no alert sound and message. After a while the music does resume playing.

On another device it goes roughly the same, but there I do get the alert sound, but also not the tts message.

Does someone have an idea what could be the problem?

I heard an other user having similar problems with a raspberry pi, can’t remember how or if he solved the problem. I am not using a raspberry pi
Try manual using the TTS service in HA and look if that works and the player must have idle as status when finished in HA.
Try installing the latest version of https://www.picoreplayer.org/ without maxtoplay

There is no option to set the language of each message but It would not be hard to change the code to make this possible.
As this is a rare use case I am not implementing it at this moment but you are welcome to have a go at it and make a pull request on the github repro

Logitech media server does not allow to put a stream in pause when playing something else and it is not possible to start a stream at a specific time

1 Like

Thanks for the advice. The first tests are promising. I have replaced Max2Play with PiCorePlayer and this seems to work much better.

Thanks for this. I have been trying to send announcements via Logitech Media Server for quite a while.

Fairly new to Home Assistant but the installation was straight forward and I got it running pretty quickly.

I replace the message in YAML with a helper input text so I can send different messages from a dashboard using the same automation:

alias: Alert Test
description: ""
trigger:
  - platform: event
    event_type: ""
condition: []
action:
  - service: lms_tts_notify.queue
    metadata: {}
    data:
      entity_id: media_player.squeezebox_touch
      message: "{{ states('input_text.input_text')}}"
      volume: 0.5
mode: single
2 Likes