Added new commands and functionality to the harmony remote component.#7113
Conversation
|
Hi @everix1992, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
|
@everix1992, thanks for your PR! By analyzing the history of the files in this pull request, we identified @iandday, @titilambert and @fabaff to be potential reviewers. |
There was a problem hiding this comment.
line too long (98 > 79 characters)
There was a problem hiding this comment.
indentation contains mixed spaces and tabs
expected an indented block
There was a problem hiding this comment.
indentation contains tabs
TabError: inconsistent use of tabs and spaces in indentation
There was a problem hiding this comment.
indentation contains tabs
indentation contains mixed spaces and tabs
blank line contains whitespace
There was a problem hiding this comment.
line too long (92 > 79 characters)
There was a problem hiding this comment.
missing whitespace around operator
There was a problem hiding this comment.
missing whitespace around operator
There was a problem hiding this comment.
line too long (91 > 79 characters)
There was a problem hiding this comment.
We should not add a new service. Instead, by using cv.ensure_list you can make the existing send_command support multiple commands and stay backwards compatible.
There was a problem hiding this comment.
The default implementation of send_commands on the abstract base class should be to just call send_command once for each command.
There was a problem hiding this comment.
I agree with the comment about the default implementation of send_commands. However, if we are keeping the num_repeats parameter as we were discussing below, I'm not sure if we'd want to fold send_command and send_commands into one service, unless we're fine with being able to repeat a list of commands as well. I don't actually see a problem with this, but I just hadn't thought of it originally.
Also, I'm slightly confused about the backwards compatible comment. These changes shouldn't break backward compatibility because the new parameters for the send_command service have defaults specified. And send_commands wouldn't break backwards compatibility because it's a new service.
There was a problem hiding this comment.
You can setup the send_command schema validation in such a way that it is backwards compatible but still takes in multiple commands.
I prefer to keep it in 1 function.
There was a problem hiding this comment.
Alright, I'll make this change as soon as I have some free time, which will be at latest tomorrow night.
There was a problem hiding this comment.
It looks like merging everything back into one service is going to require some changes to pyharmony, so this'll be on hold until I can get another release out with that change in it.
There was a problem hiding this comment.
pyharmony 1.0.16 is up with your changes @everix1992, thanks for your hard work!
There was a problem hiding this comment.
Flakiness in a connection between remote and device is a concern for the platform. We should not have to add it to the main component.
There was a problem hiding this comment.
I guess you can add it as platform config to the harmony platform ?
There was a problem hiding this comment.
I'm curious, what do you mean by flakiness? If you're talking about the number of repeats parameter, that has nothing to do with flakiness. The intent of that it to allow you to repeat a command X number of times. For example, if you wanted to increase the volume by 5, you could send the volume up command with a number of repeats of 5.
There was a problem hiding this comment.
We should not add this for now as it can already be achieved differently: by just sending multiple commands.
There was a problem hiding this comment.
You are correct, but letting this be specified as a number allows for much easier integration. If I'm trying to trigger something through IFTTT, I can't generate a list of commands on the fly. I can, however, take the number given to me and pass that on to home assistant.
|
Hi @everix1992 Before, I used a work-around to repeat the commands (using the script functionality of home assistant, so simply enter the command X amount of times). The unfortunate part was that it was delayed about 2-3 seconds each-time it inputted the command. My assumption was that it was either a built-in hass delay or an issue with communicating to the harmony remote back-end API. Does this implementation experience that same issue? (I'm not home yet to try this PR out with my Harmony Hub) |
There was a problem hiding this comment.
Harmony Hubs have built-in delays for each command. So each-command would be 400ms + Harmony's configured delay (for ex. mine is set to 300ms). So for each vol-up it'd be 700ms which would still be slower than using a physical remote.
Is there a way to change this delay value within configuration.yaml, also, have you tested it with a lower configured delay? I'm assuming HA is multi-threaded so it could handle these commands.
There was a problem hiding this comment.
In response to your first question, no this PR doesn't experience that issue. The reason that behavior occurred within the script was due to how commands were being sent in the pyharmony library. I've worked with the developer of pyharmony to get that issue fixed.
With that issue gone, 0.4 seconds was the appropriate delay for my setup in which I was using the default delay for Harmony Hubs (didn't even realize there was a setting to change for that).
And yes, I did some testing when I was testing this and 0.4s seemed about right. Any faster (0.1 or 0.2) and I would drop commands. There was no benefit to going any slower.
Take this with a grain of salt since I'm fairly new to HASS development, but I think that it would be possible to add a default delay value to the configuration.yaml that would override the 0.4 seconds.
There was a problem hiding this comment.
@everix1992 Awesome! Thanks a lot man. I'll test this PR on my personal Harmony Hub as well this week.
|
This LGTM 👍 |
balloob
left a comment
There was a problem hiding this comment.
All remote platforms have to be updated to accommodate for a list of commands being passed in. Not just the demo and harmony platforms.
|
@balloob Ah, my bad. The commit I was working off of did not have any other remotes added. I'll rebase and get them fixed up. |
balloob
left a comment
There was a problem hiding this comment.
Ok to merge when tests pass 👍
There was a problem hiding this comment.
missing whitespace around operator
|
Ok to merge when conflicts resolved. Not sure what has changed. |
-This includes the ability to optionally specify a number of times to repeat a specific command, such as pressing the volume button multiple times. -Also added a new command that allows you to send multiple commands to the harmony at once, such as sending a set of channel numbers. -Updated the unit tests for these changes.
… list of commands
…armony version in requirements_all.txt
|
Should be fixed now. Was a silly line endings conflict.
…On Tue, May 23, 2017 at 5:15 PM, Paulus Schoutsen ***@***.***> wrote:
Ok to merge when conflicts resolved. Not sure what has changed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7113 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACJAYG83znsNBWWRZCblVF3AtrtOthiHks5r81pxgaJpZM4M-KoY>
.
|
-This includes the ability to optionally specify a number of times to repeat a specific command, such as pressing the volume button multiple times.
-Also added a new command that allows you to send multiple commands to the harmony at once, such as sending a set of channel numbers.
-Updated the unit tests for these changes.
Description:
Related issue (if applicable): fixes #
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2432
Example entry for
configuration.yaml(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass