ol-iver / denonavr

Automation Library for Denon AVR receivers.
MIT License
176 stars 67 forks source link

play & pause not implemented in HomeAssistant #108

Closed starkillerOG closed 4 years ago

starkillerOG commented 4 years ago

The media_player.media_play_pause function is implemented and works in HomeAssistant However the media_player.media_play and media_player.media_pause are not implemented and do not work.

If I look in the code the play and pause functions do exist in the denonavr library on line 1546 and line 1564, but they use the same command....

from experimenting a bit I discovered that (at least if you are playing spotify) this command always pauses the playback: 192.168.1.39/goform/formiPhoneAppDirect.xml?NS9B

Unfortunatly there is no resume/play action, only a toggle_play action: 192.168.1.39/goform/formiPhoneAppDirect.xml?NS9A, which resumes if it is paused and pauses if it is playing.

We could possibly create a workaround by looking at the state of the media_player (playing or paused), from that you now if you schould sent the command or not. Of course that is not ideal because the state could be old and not accurate anymore....

Shall I implement this workaround?

ol-iver commented 4 years ago

Thanks for researching 😄 I quickly implemented your proposal in the library

starkillerOG commented 4 years ago

No problem, thank you for all the work and effort that you put into the denonavr library and component, it is truly great!

Always happy if I can help a tiny bit.

ol-iver commented 4 years ago

You're welcome. It's very nice that you are helping out with the sound modes that often 😄 These are the changes in home-assistant: https://github.com/home-assistant/home-assistant/pull/30421