home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.61k stars 30.77k forks source link

MediaPlayer:Toggle does not turn Off Cast devices #77412

Open mvdwetering opened 2 years ago

mvdwetering commented 2 years ago

The problem

When using the MediaPlayer:Toggle service with a Cast media_player it does turn On, but when calling MediaPlayer:Toggle again it does not turn Off

When watching with the developer tools I see the following:

What version of Home Assistant Core has the issue?

core-2022.8.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Cast

Link to integration documentation on our website

https://www.home-assistant.io/integrations/cast/

Diagnostics information

Does not support diagnostics it seems

Example YAML snippet

I am using the UI mode for calling the service, but this is what it shows when switching to YAML mode:

service: media_player.toggle
data: {}
target:
  entity_id:
    - media_player.googlehome7482

Anything in the logs that might be useful for us?

No errors

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

cast documentation cast source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @emontnemery, mind taking a look at this issue as it has been labeled with an integration (cast) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

mvdwetering commented 2 years ago

Turns out that the MediaPlayer async_toggle considers STATE_IDLE to be Off which is why it won't turn Off when it is Idle.

        if self.state in (STATE_OFF, STATE_IDLE, STATE_STANDBY):
            await self.async_turn_on()
        else:
            await self.async_turn_off()

I am now not sure if Cast integration should not use STATE_IDLE or that STATE_IDLE should not be considered Off.

I assume the latter since the frontend renders the mediaplayer card as On when the state is Idle.

If there is clarity on what should change I can make a PR to fix it.

mvdwetering commented 2 years ago

Just noticed that the media_player documentation says:

Entity is turned on and accepting commands, but currently not playing any media. Possibly at some idle home screen.

(could have sworn that was not there when I submitted this :/ )

So idle should not be in the Off state list.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mvdwetering commented 1 year ago

Mediaplayer Toggle service does still not work for Google cast in HA 2022.12.4

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mvdwetering commented 1 year ago

Still same issue with HA 2023.3.3

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mvdwetering commented 1 year ago

Still exists on HA 2023.6.1

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mvdwetering commented 1 year ago

Still exists on HA 2023.9.1

issue-triage-workflows[bot] commented 11 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mvdwetering commented 11 months ago

Still exists

leafney commented 10 months ago

I seem to have a similar problem

antivariant commented 9 months ago

Doesn't turn off TV (only switches the HA and Chromecast wallpaper). Works like the 'Cast' button.

MG-PL-MG commented 8 months ago

I have similar problem. turn_off switches device to "Home Screen" and device is still on while HA shows media player off (grey card). It seems that if device has more services than only eg. playing media, the media_player.turn_off is turning of particular service that is in use but not power off the device. Calling turn_off again has no effect and device is still in "Home Screen". As it is commented above it might be that device is in idle state and accept only turn_on. This way HA is unable to turn device power off.

sol3uk commented 8 months ago

Same issue here, chromecast not being turned off, just sent to idle screen.

issue-triage-workflows[bot] commented 5 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mvdwetering commented 5 months ago

Still there in HA core 2024.6.0

issue-triage-workflows[bot] commented 2 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mvdwetering commented 2 months ago

Still an issue in 2024.8.1.

Last time I will extend the stale notice, next time I will let it go. Someone else can take over.

19Francesco81 commented 4 weeks ago

Still an issue in 2024.10.2.

why is this bug not fixed?