Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long message not played till the end #21

Open
terba opened this issue Nov 11, 2024 · 1 comment
Open

Long message not played till the end #21

terba opened this issue Nov 11, 2024 · 1 comment

Comments

@terba
Copy link

terba commented Nov 11, 2024

I let read out the weather forecast and playing stops somewhere in the middle of the text. The TTS engine renders the whole text, so the problem is on the LMS side. The TTS audio clip is 44 seconds long and playing stops around 17 seconds. Meanwhile the log says:

...
2024-11-11 12:30:08.189 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Playing message on tts.speak
2024-11-11 12:30:23.826 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player stuck
2024-11-11 12:30:23.826 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Waiting for media_player.konyha to finish
2024-11-11 12:30:24.039 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha not done
2024-11-11 12:30:24.249 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha not done
2024-11-11 12:30:24.458 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha not done
2024-11-11 12:30:24.668 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha not done
2024-11-11 12:30:24.876 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha not done
2024-11-11 12:30:25.086 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha not done
2024-11-11 12:30:25.298 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha not done
2024-11-11 12:30:25.537 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha not done
2024-11-11 12:30:25.744 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha not done
2024-11-11 12:30:25.950 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha not done
2024-11-11 12:30:25.950 DEBUG (konyha_queue) [custom_components.lms_tts_notify] Player: media_player.konyha stuck
2024-11-11 12:30:26.081 DEBUG (Coordinator) [custom_components.lms_tts_notify] Restore volume: media_player.konyha
...

It look like some kind of timeout handling is too short for my text. After 15 seconds of playing it starts to complain.

@terba
Copy link
Author

terba commented Nov 11, 2024

Yes, there is a limit in the code:

    def wait_on_idle(self):
        '''Wait until player is done playing'''
        timeout = time.time() + 15  #break is media player is stuck
        while True:
            # Force update status of the media_player
            service_data = {'entity_id': self._media_player}
            self._hass.services.call('homeassistant', 'update_entity', service_data)
            time.sleep(0.2)
            state = self._hass.states.get(self._media_player).state
            if time.time() > timeout:
                _LOGGER.debug('Player stuck')
                break
            if state in ['idle', 'paused', 'off', 'unavailable']:
                break

Please allow setting this in config or make it a bigger number like 60 or 120.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant