mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Enable handling of 'num_repeats' for itach (#36362)
This commit is contained in:
parent
35b95f77e9
commit
355d655542
@ -5,7 +5,7 @@ import pyitachip2ir
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import remote
|
from homeassistant.components import remote
|
||||||
from homeassistant.components.remote import PLATFORM_SCHEMA
|
from homeassistant.components.remote import ATTR_NUM_REPEATS, PLATFORM_SCHEMA
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICES,
|
CONF_DEVICES,
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
@ -106,19 +106,22 @@ class ITachIP2IRRemote(remote.RemoteEntity):
|
|||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Turn the device on."""
|
"""Turn the device on."""
|
||||||
self._power = True
|
self._power = True
|
||||||
self.itachip2ir.send(self._name, "ON", 1)
|
num_repeats = kwargs.get(ATTR_NUM_REPEATS, 1)
|
||||||
|
self.itachip2ir.send(self._name, "ON", num_repeats)
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
"""Turn the device off."""
|
"""Turn the device off."""
|
||||||
self._power = False
|
self._power = False
|
||||||
self.itachip2ir.send(self._name, "OFF", 1)
|
num_repeats = kwargs.get(ATTR_NUM_REPEATS, 1)
|
||||||
|
self.itachip2ir.send(self._name, "OFF", num_repeats)
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def send_command(self, command, **kwargs):
|
def send_command(self, command, **kwargs):
|
||||||
"""Send a command to one device."""
|
"""Send a command to one device."""
|
||||||
|
num_repeats = kwargs.get(ATTR_NUM_REPEATS, 1)
|
||||||
for single_command in command:
|
for single_command in command:
|
||||||
self.itachip2ir.send(self._name, single_command, 1)
|
self.itachip2ir.send(self._name, single_command, num_repeats)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update the device."""
|
"""Update the device."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user