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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix roku play/pause support #35991

Merged
merged 7 commits into from
May 23, 2020
Merged

Fix roku play/pause support #35991

merged 7 commits into from
May 23, 2020

Conversation

ctalkington
Copy link
Contributor

@ctalkington ctalkington commented May 22, 2020

Breaking change

Proposed change

When used by various integrations such as alexa (or in the near future google assistant) you can't currently easily control device with voice commands like play or pause because the only method that was implemented was media_play_pause which is mostly meant for service calls and has basic support in lovelace components.

Roku only supports a "play" keypress that is really a play/pause behavior and doesn't offer discrete pause support.

This means that the implementation cant promise to actually pause but it can atleast toggle the play state and make available the "pause" action to integrations. In lovelace it should allow the pause icon rather than stop icon which is more accurate to what the actual keypress does.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 馃 Silver
  • 馃 Gold
  • 馃弳 Platinum

@probot-home-assistant probot-home-assistant bot added integration: roku small-pr PRs with less than 30 lines. labels May 22, 2020
@project-bot project-bot bot added this to Needs review in Dev May 22, 2020
@project-bot project-bot bot moved this from Needs review to By Code Owner in Dev May 22, 2020
@ctalkington ctalkington changed the title Asd pause support to roku Add pause support to roku May 22, 2020
@ctalkington ctalkington changed the title Add pause support to roku Fix pause support to roku May 22, 2020
@ctalkington ctalkington changed the title Fix pause support to roku Fix play/pause support to roku May 22, 2020
@ctalkington ctalkington changed the title Fix play/pause support to roku Fix roku play/pause support May 22, 2020
@ctalkington ctalkington added this to the 0.110.2 milestone May 22, 2020
@elupus
Copy link
Contributor

elupus commented May 22, 2020

There is no way of knowing current playback state?

@ctalkington
Copy link
Contributor Author

ctalkington commented May 22, 2020

Not exactly besides app being open and no screensaver. Which is the current logic for state. Effectively calling play or pause would always call the same thing (play) so checking state didnt really seem useful. Roku remotes also merge the two controls into 1 button.

@ctalkington
Copy link
Contributor Author

/AzurePipelines Run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 35991 in repo home-assistant/core

@frenck
Copy link
Member

frenck commented May 23, 2020

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Dev automation moved this from By Code Owner to Reviewer approved May 23, 2020
@MartinHjelmare
Copy link
Member

Not sure if we can consider this a bug fix since we're adding a feature

@frenck frenck removed this from the 0.110.2 milestone May 23, 2020
@frenck
Copy link
Member

frenck commented May 23, 2020

I agree on this is adding a feature as well. Removed the milestone.

@frenck frenck merged commit 765bf76 into dev May 23, 2020
Dev automation moved this from Reviewer approved to Done May 23, 2020
@frenck frenck deleted the ctalkington-roku-pause branch May 23, 2020 09:06
@ctalkington
Copy link
Contributor Author

i guess its a feature but as it already supported PLAY and had the async_media_play_pause. I see if more as a fix to being partially implemented than a new feature. guess it doesnt hurt to wait a few weeks though

@frenck
Copy link
Member

frenck commented May 24, 2020

Going to pick this one in 0.110.2 as the release CI will fail without it.

@frenck frenck added this to the 0.110.2 milestone May 24, 2020
frenck pushed a commit that referenced this pull request May 24, 2020
@frenck frenck mentioned this pull request May 24, 2020
@sycophantic
Copy link

sycophantic commented May 25, 2020

There is no way of knowing current playback state?

http://roku:8060/query/media-player (https://developer.roku.com/en-ca/docs/developer-program/debugging/external-control-api.md#querymedia-player-example) returns 3 states from what I can tell:

<player error="false" state="play">
<player error="false" state="pause">
<player error="false" state="close">

So it should be possible to detect the current state.

@ctalkington
Copy link
Contributor Author

fair point, i guess i overlooked that option as it was a bit more technical about video stream. Ill have to review using that but it would increase number of API calls something ive been trying to reduce/optimize lately since taking on maintenance of roku

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

Successfully merging this pull request may close these issues.

None yet

6 participants