floris-b / lms_tts_notify

Logitech Media Server TTS Notify Queue for Home Assistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LMS tts notify stopped working

Gregorusp opened this issue · comments

Hi!
LMS tts notify stopped working (it was working without issues in the past). Now I can play notification only once, and in the log of HomeAssistant even that first try ends with error "Uncaught thread exception".
Please see attached log.
I use squeezebox on raspberry 3.
lms_error.txt
BR
Greg

Is a player offline but still configured in ms_tts_notify?
Did you restart LMS?

What do the logs show:

logger:
  logs:
    custom_components.lms_tts_notify: debug

Not sure if this is the same issue, but there is an error when attempting to use the HA Assist Piper tts service, then subsequent calls just abort (see logs below).
The tts.google_say I set up in yaml works fine.

`
2023-12-15 14:00:00.378 DEBUG (MainThread) [custom_components.lms_tts_notify] Received on event bus: {'entity_id': 'media_player.squeezeamp', 'repeat': 1, 'message': 'Why are you not working'}
2023-12-15 14:00:00.475 INFO (MainThread) [homeassistant.components.automation.motion_event_reset] motion_event_reset: Executing step call service
2023-12-15 14:00:00.716 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save state: media_player.squeezeamp -> {'state': 'idle', 'attributes': {'group_members': [], 'volume_level': 0.8, 'is_volume_muted': False, 'media_content_id': 'http://10.10.102.103:8123/local/announce/whistle.mp3', 'media_content_type': <MediaType.MUSIC: 'music'>, 'media_duration': 4, 'media_title': 'Factory Whistle by MTI from Willy Wonka Jr Accompaniment CD', 'shuffle': False, 'repeat': <RepeatMode.OFF: 'off'>, 'query_result': {'_p2': '0'}, 'sync_group': [], 'entity_picture': '/api/media_player_proxy/media_player.squeezeamp?token=0b6fb455af2de49bacf4ac483b1e194c4e3126274de84c13519a1010afc7350c&cache=83edff7724f945dc', 'icon': 'mdi:surround-sound', 'friendly_name': 'Soundbar Kitchen', '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>}}
2023-12-15 14:00:00.717 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save playlists: media_player.squeezeamp
2023-12-15 14:00:00.726 DEBUG (Coordinator) [custom_components.lms_tts_notify] UnSync media_player.squeezeamp
2023-12-15 14:00:01.261 DEBUG (squeezeamp_queue) [custom_components.lms_tts_notify] Playing message 'Why are you not working'
2023-12-15 14:00:01.981 ERROR (squeezeamp_queue) [root] Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/config/custom_components/lms_tts_notify/init.py", line 429, in run
self.audio_alert()
File "/config/custom_components/lms_tts_notify/init.py", line 520, in audio_alert
self._hass.services.call('tts', self._tts_service, service_data)
File "/usr/src/homeassistant/homeassistant/core.py", line 1972, in call
).result()
^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call
raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Service tts.piper not found.

....

2023-12-15 14:04:08.080 DEBUG (MainThread) [custom_components.lms_tts_notify] Received on event bus: {'entity_id': 'media_player.squeezeamp', 'repeat': 1, 'message': 'Why are you not working'}
2023-12-15 14:04:08.161 DEBUG (Coordinator) [custom_components.lms_tts_notify] UnSync media_player.squeezeamp
`

Not sure if this is the same issue, but there is an error when attempting to use the HA Assist Piper tts service, then subsequent calls just abort (see logs below). The tts.google_say I set up in yaml works fine.

` 2023-12-15 14:00:00.378 DEBUG (MainThread) [custom_components.lms_tts_notify] Received on event bus: {'entity_id': 'media_player.squeezeamp', 'repeat': 1, 'message': 'Why are you not working'} 2023-12-15 14:00:00.475 INFO (MainThread) [homeassistant.components.automation.motion_event_reset] motion_event_reset: Executing step call service 2023-12-15 14:00:00.716 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save state: media_player.squeezeamp -> {'state': 'idle', 'attributes': {'group_members': [], 'volume_level': 0.8, 'is_volume_muted': False, 'media_content_id': 'http://10.10.102.103:8123/local/announce/whistle.mp3', 'media_content_type': <MediaType.MUSIC: 'music'>, 'media_duration': 4, 'media_title': 'Factory Whistle by MTI from Willy Wonka Jr Accompaniment CD', 'shuffle': False, 'repeat': <RepeatMode.OFF: 'off'>, 'query_result': {'_p2': '0'}, 'sync_group': [], 'entity_picture': '/api/media_player_proxy/media_player.squeezeamp?token=0b6fb455af2de49bacf4ac483b1e194c4e3126274de84c13519a1010afc7350c&cache=83edff7724f945dc', 'icon': 'mdi:surround-sound', 'friendly_name': 'Soundbar Kitchen', '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>}} 2023-12-15 14:00:00.717 DEBUG (Coordinator) [custom_components.lms_tts_notify] Save playlists: media_player.squeezeamp 2023-12-15 14:00:00.726 DEBUG (Coordinator) [custom_components.lms_tts_notify] UnSync media_player.squeezeamp 2023-12-15 14:00:01.261 DEBUG (squeezeamp_queue) [custom_components.lms_tts_notify] Playing message 'Why are you not working' 2023-12-15 14:00:01.981 ERROR (squeezeamp_queue) [root] Uncaught thread exception Traceback (most recent call last): File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() File "/config/custom_components/lms_tts_notify/init.py", line 429, in run self.audio_alert() File "/config/custom_components/lms_tts_notify/init.py", line 520, in audio_alert self._hass.services.call('tts', self._tts_service, service_data) File "/usr/src/homeassistant/homeassistant/core.py", line 1972, in call ).result() ^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call raise ServiceNotFound(domain, service) from None homeassistant.exceptions.ServiceNotFound: Service tts.piper not found.

....

2023-12-15 14:04:08.080 DEBUG (MainThread) [custom_components.lms_tts_notify] Received on event bus: {'entity_id': 'media_player.squeezeamp', 'repeat': 1, 'message': 'Why are you not working'} 2023-12-15 14:04:08.161 DEBUG (Coordinator) [custom_components.lms_tts_notify] UnSync media_player.squeezeamp `

tts.piper is not a service, you must use tts.speak : https://www.home-assistant.io/integrations/tts/#service-speak

FYI, tts.speak does not appear to work with the Legacy notify platform.

Looks' like they have completely changed notify to accommodate Assist. The new service assigns the tts engine, which they also call tts (sounds like more breaking changes to come!), as the target and a new media_player_entity_id as the output device. I'm going to have a look at the code implementation and see if there is an easy fix.