diff --git a/homeassistant/components/device_automation/const.py b/homeassistant/components/device_automation/const.py index a668c78598a..40bfc4ca0a1 100644 --- a/homeassistant/components/device_automation/const.py +++ b/homeassistant/components/device_automation/const.py @@ -4,3 +4,5 @@ CONF_IS_ON = "is_on" CONF_TOGGLE = "toggle" CONF_TURN_OFF = "turn_off" CONF_TURN_ON = "turn_on" +CONF_TURNED_OFF = "turned_off" +CONF_TURNED_ON = "turned_on" diff --git a/homeassistant/components/device_automation/toggle_entity.py b/homeassistant/components/device_automation/toggle_entity.py index 722b92e33f2..1593e70771a 100644 --- a/homeassistant/components/device_automation/toggle_entity.py +++ b/homeassistant/components/device_automation/toggle_entity.py @@ -8,6 +8,8 @@ from homeassistant.components.device_automation.const import ( CONF_TOGGLE, CONF_TURN_OFF, CONF_TURN_ON, + CONF_TURNED_OFF, + CONF_TURNED_ON, ) from homeassistant.core import split_entity_id from homeassistant.const import ( @@ -53,12 +55,12 @@ ENTITY_TRIGGERS = [ { # Trigger when entity is turned off CONF_PLATFORM: "device", - CONF_TYPE: CONF_TURN_OFF, + CONF_TYPE: CONF_TURNED_OFF, }, { # Trigger when entity is turned on CONF_PLATFORM: "device", - CONF_TYPE: CONF_TURN_ON, + CONF_TYPE: CONF_TURNED_ON, }, ] @@ -87,7 +89,7 @@ TRIGGER_SCHEMA = vol.Schema( vol.Required(CONF_DEVICE_ID): str, vol.Required(CONF_DOMAIN): str, vol.Required(CONF_ENTITY_ID): cv.entity_id, - vol.Required(CONF_TYPE): vol.In([CONF_TURN_OFF, CONF_TURN_ON]), + vol.Required(CONF_TYPE): vol.In([CONF_TURNED_OFF, CONF_TURNED_ON]), } ) @@ -136,7 +138,7 @@ def async_condition_from_config(config, config_validation): async def async_attach_trigger(hass, config, action, automation_info): """Listen for state changes based on configuration.""" trigger_type = config[CONF_TYPE] - if trigger_type == CONF_TURN_ON: + if trigger_type == CONF_TURNED_ON: from_state = "off" to_state = "on" else: diff --git a/homeassistant/components/light/strings.json b/homeassistant/components/light/strings.json index 460114b143c..77b842ba078 100644 --- a/homeassistant/components/light/strings.json +++ b/homeassistant/components/light/strings.json @@ -10,8 +10,8 @@ "is_off": "{entity_name} is off" }, "trigger_type": { - "turn_on": "{entity_name} turned on", - "turn_off": "{entity_name} turned off" + "turned_on": "{entity_name} turned on", + "turned_off": "{entity_name} turned off" } } } diff --git a/homeassistant/components/switch/strings.json b/homeassistant/components/switch/strings.json index 857b3763076..77b842ba078 100644 --- a/homeassistant/components/switch/strings.json +++ b/homeassistant/components/switch/strings.json @@ -6,12 +6,12 @@ "turn_off": "Turn off {entity_name}" }, "condition_type": { - "turn_on": "{entity_name} turned on", - "turn_off": "{entity_name} turned off" + "is_on": "{entity_name} is on", + "is_off": "{entity_name} is off" }, "trigger_type": { - "turn_on": "{entity_name} turned on", - "turn_off": "{entity_name} turned off" + "turned_on": "{entity_name} turned on", + "turned_off": "{entity_name} turned off" } } } diff --git a/tests/components/device_automation/test_init.py b/tests/components/device_automation/test_init.py index a01dad03d46..b05c04a16f1 100644 --- a/tests/components/device_automation/test_init.py +++ b/tests/components/device_automation/test_init.py @@ -133,14 +133,14 @@ async def test_websocket_get_triggers(hass, hass_ws_client, device_reg, entity_r { "platform": "device", "domain": "light", - "type": "turn_off", + "type": "turned_off", "device_id": device_entry.id, "entity_id": "light.test_5678", }, { "platform": "device", "domain": "light", - "type": "turn_on", + "type": "turned_on", "device_id": device_entry.id, "entity_id": "light.test_5678", }, diff --git a/tests/components/light/test_device_automation.py b/tests/components/light/test_device_automation.py index 3525f1121c0..27b8b860d72 100644 --- a/tests/components/light/test_device_automation.py +++ b/tests/components/light/test_device_automation.py @@ -125,14 +125,14 @@ async def test_get_triggers(hass, device_reg, entity_reg): { "platform": "device", "domain": DOMAIN, - "type": "turn_off", + "type": "turned_off", "device_id": device_entry.id, "entity_id": f"{DOMAIN}.test_5678", }, { "platform": "device", "domain": DOMAIN, - "type": "turn_on", + "type": "turned_on", "device_id": device_entry.id, "entity_id": f"{DOMAIN}.test_5678", }, @@ -163,7 +163,7 @@ async def test_if_fires_on_state_change(hass, calls): "domain": DOMAIN, "device_id": "", "entity_id": ent1.entity_id, - "type": "turn_on", + "type": "turned_on", }, "action": { "service": "test.automation", @@ -187,7 +187,7 @@ async def test_if_fires_on_state_change(hass, calls): "domain": DOMAIN, "device_id": "", "entity_id": ent1.entity_id, - "type": "turn_off", + "type": "turned_off", }, "action": { "service": "test.automation", diff --git a/tests/components/switch/test_device_automation.py b/tests/components/switch/test_device_automation.py index 3bd29a72a12..1ebe4785761 100644 --- a/tests/components/switch/test_device_automation.py +++ b/tests/components/switch/test_device_automation.py @@ -125,14 +125,14 @@ async def test_get_triggers(hass, device_reg, entity_reg): { "platform": "device", "domain": DOMAIN, - "type": "turn_off", + "type": "turned_off", "device_id": device_entry.id, "entity_id": f"{DOMAIN}.test_5678", }, { "platform": "device", "domain": DOMAIN, - "type": "turn_on", + "type": "turned_on", "device_id": device_entry.id, "entity_id": f"{DOMAIN}.test_5678", }, @@ -163,7 +163,7 @@ async def test_if_fires_on_state_change(hass, calls): "domain": DOMAIN, "device_id": "", "entity_id": ent1.entity_id, - "type": "turn_on", + "type": "turned_on", }, "action": { "service": "test.automation", @@ -187,7 +187,7 @@ async def test_if_fires_on_state_change(hass, calls): "domain": DOMAIN, "device_id": "", "entity_id": ent1.entity_id, - "type": "turn_off", + "type": "turned_off", }, "action": { "service": "test.automation",