Add mysensors IR switch device and service (#2239)
* Add mysensors IR switch device and service * Add MySensorsIRSwitch as child class to MySensorsSwitch. * Add platform specific service mysensors_send_ir_code. Only call device method in service function if device is IR device. * Add service and required attribute to state helper to support scenes. * Move V_IR_SEND type from sensor.mysensors to switch.mysensors platform. * Populate switch.services.yaml with service descriptions. * Fix check of entity_id in service function Since multiple entity_ids can be passed as service data, and the entity_id service attribute is forced to a list by the service validation schema, the check in the service function should iterate over any entity ids.
This commit is contained in:
parent
ebe4c39020
commit
81ca175906
4 changed files with 160 additions and 7 deletions
|
@ -12,6 +12,8 @@ from homeassistant.components.notify import (
|
|||
ATTR_MESSAGE, SERVICE_NOTIFY)
|
||||
from homeassistant.components.sun import (
|
||||
STATE_ABOVE_HORIZON, STATE_BELOW_HORIZON)
|
||||
from homeassistant.components.switch.mysensors import (
|
||||
ATTR_IR_CODE, SERVICE_SEND_IR_CODE)
|
||||
from homeassistant.components.thermostat import (
|
||||
ATTR_AWAY_MODE, ATTR_FAN, SERVICE_SET_AWAY_MODE, SERVICE_SET_FAN_MODE,
|
||||
SERVICE_SET_TEMPERATURE)
|
||||
|
@ -55,6 +57,7 @@ SERVICE_ATTRIBUTES = {
|
|||
SERVICE_SET_OPERATION_MODE: [ATTR_OPERATION_MODE],
|
||||
SERVICE_SET_AUX_HEAT: [ATTR_AUX_HEAT],
|
||||
SERVICE_SELECT_SOURCE: [ATTR_INPUT_SOURCE],
|
||||
SERVICE_SEND_IR_CODE: [ATTR_IR_CODE]
|
||||
}
|
||||
|
||||
# Update this dict when new services are added to HA.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue