bushvin / hass-integrations

My custom Home Assistant integrations
Apache License 2.0
64 stars 11 forks source link

Integration Sets Up, but won't "Update" and Connections to the Mopidy Server Don't Work #77

Open kaijk opened 5 days ago

kaijk commented 5 days ago

(Hey, sorry for the duplicate on the deprecation warning. I was actually chasing this problem and noticed the warning).

I run Mopidy on a separate machine from my docker installed HA, using Mopidy for TTS announcements. It worked fine through HA 2024.8.x. After upgrading HA to 2024.10 (skipping 9), and now, on 11, the integration seems "connected," but doesn't work.

I have:

zeroconf:
network:

in my configuration.yaml, but not default_config, should that matter. It didn't matter through 2024.8

Here are some log messages:

2024-11-09 16:20:32.949 INFO (MainThread) [homeassistant.components.media_player] Setting up mopidy.media_player
2024-11-09 16:20:32.949 INFO (MainThread) [custom_components.mopidy.speaker.api] Creating Mopidy Websocket connection...
2024-11-09 16:20:32.951 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new media_player.mopidy entity: media_player.mopidy_dining_room

Seems like all is good. But, when I send a tried and true tts package to the integration I get:

2024-11-09 16:21:40.813 INFO (MainThread) [homeassistant.components.automation.say_current_weather_forecast] Say Current Weather Forecast: Executing step call service
... Echoing the message
2024-11-09 16:21:52.957 WARNING (MainThread) [homeassistant.components.media_player] Updating mopidy media_player took longer than the scheduled update interval 0:00:10
2024-11-09 16:21:52.957 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.mopidy_dining_room is taking over 10 seconds
2024-11-09 16:21:57.085 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.mopidy_dining_room is taking over 10 seconds

and nothing happens on the Mopidy side. (I can use Iris to play sounds locally on the target machine, so Mopidy itself is working).

Then, when I turn on debug logging for the Mopidy integration and send the tts package:

2024-11-09 16:56:49.761 INFO (MainThread) [homeassistant.components.automation.say_current_weather_forecast] Say Current Weather Forecast: Executing step call service
2024-11-09 16:56:49.762 DEBUG (SyncWorker_37) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.playback.stop
2024-11-09 16:56:49.771 DEBUG (SyncWorker_37) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.clear
2024-11-09 16:56:49.781 DEBUG (SyncWorker_37) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.add
2024-11-09 16:56:49.784 DEBUG (WSListener) [custom_components.mopidy.speaker.api] Routing event: tracklist_changed
2024-11-09 16:56:49.784 DEBUG (SyncWorker_35) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.index
2024-11-09 16:56:49.785 DEBUG (WSListener) [custom_components.mopidy.speaker.api] Routing event: tracklist_changed
2024-11-09 16:56:49.785 DEBUG (SyncWorker_57) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.index
2024-11-09 16:56:53.105 DEBUG (SyncWorker_26) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.get_version
2024-11-09 16:56:55.936 DEBUG (SyncWorker_37) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.get_tl_tracks
2024-11-09 16:56:55.940 DEBUG (WSListener) [custom_components.mopidy.speaker.api] Routing event: tracklist_changed
2024-11-09 16:56:55.941 DEBUG (SyncWorker_60) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.index
2024-11-09 16:56:55.955 DEBUG (WSListener) [custom_components.mopidy.speaker.api] Routing event: tracklist_changed
2024-11-09 16:56:55.956 DEBUG (SyncWorker_39) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.index
2024-11-09 16:56:55.961 DEBUG (SyncWorker_57) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.get_length
2024-11-09 16:56:55.963 DEBUG (SyncWorker_35) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.get_length
2024-11-09 16:56:55.986 DEBUG (SyncWorker_26) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.get_uri_schemes
2024-11-09 16:56:55.991 DEBUG (SyncWorker_37) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.playback.play
2024-11-09 16:56:56.019 DEBUG (SyncWorker_60) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.get_length
2024-11-09 16:56:56.021 DEBUG (SyncWorker_39) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.get_length
2024-11-09 16:56:56.026 DEBUG (SyncWorker_30) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.get_version
2024-11-09 16:56:56.029 DEBUG (SyncWorker_26) [custom_components.mopidy.speaker.api] Calling Mopidy method: core.tracklist.get_consume
2024-11-09 16:57:03.105 WARNING (MainThread) [homeassistant.components.media_player] Updating mopidy media_player took longer than the scheduled update interval 0:00:10

I get no audio

bushvin commented 3 days ago

Hey, don't worry about the duplicate Issue. It is solved, and I will release an update soon. Would you be able to tell me which tts you use? It would be good if I could reproduce your setup to troubleshoot it. A copy (or approximation) of your say_current_weather_forecast automation would be awesome as well.

kaijk commented 2 days ago

I'm using picotts. My say weather forecast automation is a lot of jinja with specific weather entities. I'd be happy to share, but I think the following will be more useful for our current purposes.

Picotts is set up like this in configuration.yaml

tts:
  - platform: picotts
    language: "en-US"

The Mopidy Integration is set up using the HA UI pointing at the IP address of the remote Pi that runs mopidy. I left the port setting at the default. I've deleted and re-added the mopidy entity, just in case. The integration gives the media_player.mopidy_dining_room entity. I have debug turned on for the integration.

Then, I have a notifier set up like this:

notify:
  - platform: tts
    name:         Dining Room Speakers
    tts_service:  tts.picotts_say
    media_player: media_player.mopidy_dining_room

Then, from Developer Tools > Actions the notifier action does nothing except produce DEBUG and Warning messages like I provided in the post above:

action: notify.dining_room_speakers
data:
  message:  "Tonight's forecast, dark. Then, continued mostly dark, with widely scattered light in the morning."

Also, running the tts.picotts_say action in Developer Tools > Actions does not get mopidy to say anything either:

action: tts.picotts_say
data:
  cache: false
  entity_id: media_player.mopidy_dining_room
  message: "Tonight's forecast, dark. Then, continued mostly dark, with widely scattered light in the morning."