-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend itach repeat functionality #36535
Extend itach repeat functionality #36535
Conversation
Update from home-assistant/core
for single_command in command: | ||
self.itachip2ir.send(self._name, single_command, num_repeats) | ||
self.itachip2ir.send( | ||
self._name, single_command, self._ir_count * num_repeats |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Say i had a TV that needed 3 ir count for power but i then sent a command of volume up or such. Will this mean that the volume raises once (ie all commands need the 3 ir) or will it raise volume 3x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as ‘ir_count’ is a reasonable value, you won’t get repeat commands sent. It should be device specific, so if you need 3 repeats for power on a particular device, you should need the same number of repeats for one volume increment.
self.schedule_update_ha_state() | ||
|
||
def turn_off(self, **kwargs): | ||
"""Turn the device off.""" | ||
self._power = False | ||
num_repeats = kwargs.get(ATTR_NUM_REPEATS, 1) | ||
self.itachip2ir.send(self._name, "OFF", num_repeats) | ||
self.itachip2ir.send(self._name, "OFF", self._ir_count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to still respect NUM_REPEATS
when it is passed in
num_repeats = kwargs.get(ATTR_NUM_REPEATS, self._ir_count)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So prior to PR 36362, NUM_REPEATS was never honored, neither for turn_on/off nor for send_command. I don’t think one should ever intend to repeat a turn_on or turn_off command, unless the device ‘needs’ to see a command repeated in order to respond, which was the driver for implementing this ‘ir_count’ parameter.
We can honor the NUM_REPEATS for turn_on/off, but I can’t think of a valid use case. Note that ‘send_command’ does in fact honor NUM_REPEATS, which can be useful for smooth volume adjustment among other things.
Proposed change
This change implements a per-device configuration parameter "ir_count", which is intended to be used when a particular ir sequence must be repeated some minimum number of times for the device to interpret the command (such as for Sony TVs, which require a code to be repeated 2-3 times.)
Using this new parameter, use of the "num_repeats" parameter is more consistent with the original intent.
Type of change
Example entry for
configuration.yaml
:Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale: