AlexxIT / DashCast

DashCast component for Home Assistant
https://github.com/AlexxIT/Blog
MIT License
146 stars 7 forks source link

Error when trying to cast #25

Open Jaypeg85 opened 4 days ago

Jaypeg85 commented 4 days ago

Hi,

First off - I love this integration!! I use it to cast all my own custom angular dashboards around the house to smart mirrors (with chromecasts attached) and nest hubs.

Yesterday me DashCast integration stopped working. I now get errors in the log like this: AttributeError: 'AppleTvMediaPlayer' object has no attribute '_chromecast' although I'm casting to a chromecast mediaplayer and not an AppleTvMediaPlayer.

  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dash_cast/__init__.py", line 31, in play_media
    chromecast: Chromecast = getattr(entity, "_chromecast")

Any ideas to what is happening?

AlexxIT commented 4 days ago

Because this component only for Google Chromecast. And you trying to use it with AppleTV.

Jaypeg85 commented 4 days ago

I get that it indeed looks like that, but as i stated this is not the case. I checked multiple times after seeing the log and tried many different nest hubs/chromecasts. And the GUI in development tools/Action won't even let me choose anything other than the chromecast devices

AlexxIT commented 4 days ago

I know GUI should filter all media_players except Chromecast. I don't know how that can happen.

The media player search function is pretty simple. The comparison is based on entity_id.

https://github.com/AlexxIT/DashCast/blob/997831a54715bf89c52eb60e9d84956b00591cbd/custom_components/dash_cast/__init__.py#L25-L31

Do you have AppleTV? Maybe it's entity_id similar to your chromecast. Or maybe it was similar by default and you have changed it manually?

Jaypeg85 commented 4 days ago

Yea, I can't really figure that out... it stopped working after i readded my HomePods/AppleTVs because they were updated to iOS 18 and the AppleTV integration couldn't handle that apparently. So there have been tinkering with AppleTV's, but I haven't changed the automations where I use dashcast. I'm in the process of removing and readding all chromecasts, to see if that helps

Jaypeg85 commented 4 days ago

Hmm... that didn't change anything. However when i disable the HomePods/AppleTVs it works again. It seems that the homepods named media_player.kids_room interferes with the media_player.kids_room_display for some reason

AlexxIT commented 4 days ago

I will check if this issue related to renaming entity_id.