diff --git a/homeassistant/components/binary_sensor/__init__.py b/homeassistant/components/binary_sensor/__init__.py index f022509f9d..0ab1987e66 100644 --- a/homeassistant/components/binary_sensor/__init__.py +++ b/homeassistant/components/binary_sensor/__init__.py @@ -28,6 +28,9 @@ DEVICE_CLASS_BATTERY = "battery" # On means charging, Off means not charging DEVICE_CLASS_BATTERY_CHARGING = "battery_charging" +# On means clean, Off means dirty +DEVICE_CLASS_CLEAN = "clean" + # On means cold, Off means normal DEVICE_CLASS_COLD = "cold" @@ -97,6 +100,7 @@ DEVICE_CLASS_WINDOW = "window" DEVICE_CLASSES = [ DEVICE_CLASS_BATTERY, DEVICE_CLASS_BATTERY_CHARGING, + DEVICE_CLASS_CLEAN, DEVICE_CLASS_COLD, DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_DOOR, diff --git a/homeassistant/components/binary_sensor/device_condition.py b/homeassistant/components/binary_sensor/device_condition.py index 999a62b3a8..89d469cf5c 100644 --- a/homeassistant/components/binary_sensor/device_condition.py +++ b/homeassistant/components/binary_sensor/device_condition.py @@ -16,6 +16,7 @@ from homeassistant.helpers.typing import ConfigType from . import ( DEVICE_CLASS_BATTERY, DEVICE_CLASS_BATTERY_CHARGING, + DEVICE_CLASS_CLEAN, DEVICE_CLASS_COLD, DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_DOOR, @@ -47,6 +48,8 @@ CONF_IS_BAT_LOW = "is_bat_low" CONF_IS_NOT_BAT_LOW = "is_not_bat_low" CONF_IS_CHARGING = "is_charging" CONF_IS_NOT_CHARGING = "is_not_charging" +CONF_IS_CLEAN = "is_clean" +CONF_IS_NOT_CLEAN = "is_not_clean" CONF_IS_COLD = "is_cold" CONF_IS_NOT_COLD = "is_not_cold" CONF_IS_CONNECTED = "is_connected" @@ -89,6 +92,7 @@ CONF_IS_NOT_OPEN = "is_not_open" IS_ON = [ CONF_IS_BAT_LOW, CONF_IS_CHARGING, + CONF_IS_CLEAN, CONF_IS_COLD, CONF_IS_CONNECTED, CONF_IS_GAS, @@ -114,6 +118,7 @@ IS_ON = [ IS_OFF = [ CONF_IS_NOT_BAT_LOW, CONF_IS_NOT_CHARGING, + CONF_IS_NOT_CLEAN, CONF_IS_NOT_COLD, CONF_IS_NOT_CONNECTED, CONF_IS_NOT_HOT, @@ -145,6 +150,7 @@ ENTITY_CONDITIONS = { {CONF_TYPE: CONF_IS_CHARGING}, {CONF_TYPE: CONF_IS_NOT_CHARGING}, ], + DEVICE_CLASS_CLEAN: [{CONF_TYPE: CONF_IS_CLEAN}, {CONF_TYPE: CONF_IS_NOT_CLEAN}], DEVICE_CLASS_COLD: [{CONF_TYPE: CONF_IS_COLD}, {CONF_TYPE: CONF_IS_NOT_COLD}], DEVICE_CLASS_CONNECTIVITY: [ {CONF_TYPE: CONF_IS_CONNECTED}, diff --git a/homeassistant/components/binary_sensor/device_trigger.py b/homeassistant/components/binary_sensor/device_trigger.py index f7f0c53a69..d2738c156d 100644 --- a/homeassistant/components/binary_sensor/device_trigger.py +++ b/homeassistant/components/binary_sensor/device_trigger.py @@ -14,6 +14,7 @@ from homeassistant.helpers.entity_registry import async_entries_for_device from . import ( DEVICE_CLASS_BATTERY, DEVICE_CLASS_BATTERY_CHARGING, + DEVICE_CLASS_CLEAN, DEVICE_CLASS_COLD, DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_DOOR, @@ -47,6 +48,8 @@ CONF_BAT_LOW = "bat_low" CONF_NOT_BAT_LOW = "not_bat_low" CONF_CHARGING = "charging" CONF_NOT_CHARGING = "not_charging" +CONF_CLEAN = "clean" +CONF_NOT_CLEAN = "not_clean" CONF_COLD = "cold" CONF_NOT_COLD = "not_cold" CONF_CONNECTED = "connected" @@ -89,6 +92,7 @@ CONF_NOT_OPENED = "not_opened" TURNED_ON = [ CONF_BAT_LOW, + CONF_CLEAN, CONF_COLD, CONF_CONNECTED, CONF_GAS, @@ -113,6 +117,7 @@ TURNED_ON = [ TURNED_OFF = [ CONF_NOT_BAT_LOW, + CONF_NO_CLEAN, CONF_NOT_COLD, CONF_NOT_CONNECTED, CONF_NOT_HOT, @@ -142,6 +147,7 @@ ENTITY_TRIGGERS = { {CONF_TYPE: CONF_CHARGING}, {CONF_TYPE: CONF_NOT_CHARGING}, ], + DEVICE_CLASS_CLEAN: [{CONF_TYPE: CONF_CLEAN}, {CONF_TYPE: CONF_NOT_CLEAN}], DEVICE_CLASS_COLD: [{CONF_TYPE: CONF_COLD}, {CONF_TYPE: CONF_NOT_COLD}], DEVICE_CLASS_CONNECTIVITY: [ {CONF_TYPE: CONF_CONNECTED}, diff --git a/homeassistant/components/binary_sensor/strings.json b/homeassistant/components/binary_sensor/strings.json index 045fcdae70..1167729ab7 100644 --- a/homeassistant/components/binary_sensor/strings.json +++ b/homeassistant/components/binary_sensor/strings.json @@ -4,6 +4,8 @@ "condition_type": { "is_bat_low": "{entity_name} battery is low", "is_not_bat_low": "{entity_name} battery is normal", + "is_clean": "{entity_name} is clean", + "is_not_clean": "{entity_name} is not clean", "is_cold": "{entity_name} is cold", "is_not_cold": "{entity_name} is not cold", "is_connected": "{entity_name} is connected", @@ -48,6 +50,8 @@ "trigger_type": { "bat_low": "{entity_name} battery low", "not_bat_low": "{entity_name} battery normal", + "clean": "{entity_name} got clean", + "not_clean": "{entity_name} became dirty", "cold": "{entity_name} became cold", "not_cold": "{entity_name} became not cold", "connected": "{entity_name} connected", @@ -95,6 +99,10 @@ "off": "Normal", "on": "Low" }, + "clean": { + "off": "Dirty", + "on": "Clean" + }, "cold": { "off": "[%key:component::binary_sensor::state::battery::off%]", "on": "Cold" diff --git a/homeassistant/components/binary_sensor/translations/pt.json b/homeassistant/components/binary_sensor/translations/pt.json index cedcdc2732..4a628aac14 100644 --- a/homeassistant/components/binary_sensor/translations/pt.json +++ b/homeassistant/components/binary_sensor/translations/pt.json @@ -2,6 +2,8 @@ "device_automation": { "condition_type": { "is_bat_low": "a bateria {entity_name} est\u00e1 baixa", + "is_clean": "{entity_name} est\u00e1 limpo", + "is_not_clean": "{entity_name} est\u00e1 sujo", "is_cold": "{entity_name} est\u00e1 frio", "is_connected": "{entity_name} est\u00e1 ligado", "is_gas": "{entity_name} est\u00e1 a detectar g\u00e1s", @@ -46,6 +48,8 @@ }, "trigger_type": { "bat_low": "{entity_name} com bateria fraca", + "clean": "{entity_name} ficou limpo", + "not_clean": "{entity_name} ficou sujo", "cold": "{entity_name} ficou frio", "connected": "{entity_name} est\u00e1 ligado", "gas": "{entity_name} detectou g\u00e1s", @@ -98,6 +102,10 @@ "off": "Normal", "on": "Baixo" }, + "clean": { + "off": "Sujo", + "on": "Limpo" + }, "cold": { "off": "Normal", "on": "Frio" @@ -172,4 +180,4 @@ } }, "title": "Sensor bin\u00e1rio" -} \ No newline at end of file +} diff --git a/homeassistant/const.py b/homeassistant/const.py index 9f92d11e4c..51a83a05fb 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -217,6 +217,7 @@ EVENT_TIME_CHANGED = "time_changed" # #### DEVICE CLASSES #### DEVICE_CLASS_BATTERY = "battery" +DEVICE_CLASS_CLEAN = "clean" DEVICE_CLASS_HUMIDITY = "humidity" DEVICE_CLASS_ILLUMINANCE = "illuminance" DEVICE_CLASS_SIGNAL_STRENGTH = "signal_strength"