From c80f284ca483f065cac9b280c75b56cf540d9785 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Wed, 27 Nov 2019 07:31:40 -0500 Subject: [PATCH] =?UTF-8?q?Update=20service=20domain=20for=20mysensors=20f?= =?UTF-8?q?rom=20'switch'=20to=20'mysensor=E2=80=A6=20(#29147)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homeassistant/components/mysensors/const.py | 2 ++ homeassistant/components/mysensors/services.yaml | 9 +++++++++ homeassistant/components/mysensors/switch.py | 5 +++-- homeassistant/components/switch/services.yaml | 10 ---------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/mysensors/const.py b/homeassistant/components/mysensors/const.py index 45f603a2cb4..ccb646eb47e 100644 --- a/homeassistant/components/mysensors/const.py +++ b/homeassistant/components/mysensors/const.py @@ -25,6 +25,8 @@ NODE_CALLBACK = "mysensors_node_callback_{}_{}" TYPE = "type" UPDATE_DELAY = 0.1 +SERVICE_SEND_IR_CODE = "send_ir_code" + BINARY_SENSOR_TYPES = { "S_DOOR": {"V_TRIPPED"}, "S_MOTION": {"V_TRIPPED"}, diff --git a/homeassistant/components/mysensors/services.yaml b/homeassistant/components/mysensors/services.yaml index e69de29bb2d..74a5ff0f183 100644 --- a/homeassistant/components/mysensors/services.yaml +++ b/homeassistant/components/mysensors/services.yaml @@ -0,0 +1,9 @@ +send_ir_code: + description: Set an IR code as a state attribute for a MySensors IR device switch and turn the switch on. + fields: + entity_id: + description: Name(s) of entities that should have the IR code set and be turned on. Platform dependent. + example: 'switch.living_room_1_1' + V_IR_SEND: + description: IR code to send. + example: '0xC284' \ No newline at end of file diff --git a/homeassistant/components/mysensors/switch.py b/homeassistant/components/mysensors/switch.py index c624aaafa34..fecec53370b 100644 --- a/homeassistant/components/mysensors/switch.py +++ b/homeassistant/components/mysensors/switch.py @@ -6,8 +6,9 @@ from homeassistant.components import mysensors from homeassistant.components.switch import DOMAIN, SwitchDevice from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON +from .const import DOMAIN as MYSENSORS_DOMAIN, SERVICE_SEND_IR_CODE + ATTR_IR_CODE = "V_IR_SEND" -SERVICE_SEND_IR_CODE = "mysensors_send_ir_code" SEND_IR_CODE_SERVICE_SCHEMA = vol.Schema( {vol.Optional(ATTR_ENTITY_ID): cv.entity_ids, vol.Required(ATTR_IR_CODE): cv.string} @@ -64,7 +65,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= await device.async_turn_on(**kwargs) hass.services.async_register( - DOMAIN, + MYSENSORS_DOMAIN, SERVICE_SEND_IR_CODE, async_send_ir_code_service, schema=SEND_IR_CODE_SERVICE_SCHEMA, diff --git a/homeassistant/components/switch/services.yaml b/homeassistant/components/switch/services.yaml index 46b1237f57c..3a30a0855f6 100644 --- a/homeassistant/components/switch/services.yaml +++ b/homeassistant/components/switch/services.yaml @@ -21,16 +21,6 @@ toggle: description: Name(s) of entities to toggle. example: 'switch.living_room' -mysensors_send_ir_code: - description: Set an IR code as a state attribute for a MySensors IR device switch and turn the switch on. - fields: - entity_id: - description: Name(s) of entities that should have the IR code set and be turned on. Platform dependent. - example: 'switch.living_room_1_1' - V_IR_SEND: - description: IR code to send. - example: '0xC284' - xiaomi_miio_set_wifi_led_on: description: Turn the wifi led on. fields: