Add running device class to binary sensor (#58423)

This commit is contained in:
Joakim Sørensen 2021-10-25 23:05:27 +02:00 committed by GitHub
parent ba901bbbbf
commit 6341dd4883
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 1 deletions

View File

@ -83,6 +83,9 @@ DEVICE_CLASS_PRESENCE = "presence"
# On means problem detected, Off means no problem (OK)
DEVICE_CLASS_PROBLEM = "problem"
# On means running, Off means not running
DEVICE_CLASS_RUNNING = "running"
# On means unsafe, Off means safe
DEVICE_CLASS_SAFETY = "safety"
@ -124,6 +127,7 @@ DEVICE_CLASSES = [
DEVICE_CLASS_POWER,
DEVICE_CLASS_PRESENCE,
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_RUNNING,
DEVICE_CLASS_SAFETY,
DEVICE_CLASS_SMOKE,
DEVICE_CLASS_SOUND,

View File

@ -34,6 +34,7 @@ from . import (
DEVICE_CLASS_POWER,
DEVICE_CLASS_PRESENCE,
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_RUNNING,
DEVICE_CLASS_SAFETY,
DEVICE_CLASS_SMOKE,
DEVICE_CLASS_SOUND,
@ -80,6 +81,8 @@ CONF_IS_PRESENT = "is_present"
CONF_IS_NOT_PRESENT = "is_not_present"
CONF_IS_PROBLEM = "is_problem"
CONF_IS_NO_PROBLEM = "is_no_problem"
CONF_IS_RUNNING = "is_running"
CONF_IS_NOT_RUNNING = "is_not_running"
CONF_IS_UNSAFE = "is_unsafe"
CONF_IS_NOT_UNSAFE = "is_not_unsafe"
CONF_IS_SMOKE = "is_smoke"
@ -113,6 +116,7 @@ IS_ON = [
CONF_IS_POWERED,
CONF_IS_PRESENT,
CONF_IS_PROBLEM,
CONF_IS_RUNNING,
CONF_IS_SMOKE,
CONF_IS_SOUND,
CONF_IS_TAMPERED,
@ -142,6 +146,7 @@ IS_OFF = [
CONF_IS_NO_LIGHT,
CONF_IS_NO_MOTION,
CONF_IS_NO_PROBLEM,
CONF_IS_NOT_RUNNING,
CONF_IS_NO_SMOKE,
CONF_IS_NO_SOUND,
CONF_IS_NO_UPDATE,
@ -196,6 +201,10 @@ ENTITY_CONDITIONS = {
{CONF_TYPE: CONF_IS_PROBLEM},
{CONF_TYPE: CONF_IS_NO_PROBLEM},
],
DEVICE_CLASS_RUNNING: [
{CONF_TYPE: CONF_IS_RUNNING},
{CONF_TYPE: CONF_IS_NOT_RUNNING},
],
DEVICE_CLASS_SAFETY: [{CONF_TYPE: CONF_IS_UNSAFE}, {CONF_TYPE: CONF_IS_NOT_UNSAFE}],
DEVICE_CLASS_SMOKE: [{CONF_TYPE: CONF_IS_SMOKE}, {CONF_TYPE: CONF_IS_NO_SMOKE}],
DEVICE_CLASS_SOUND: [{CONF_TYPE: CONF_IS_SOUND}, {CONF_TYPE: CONF_IS_NO_SOUND}],

View File

@ -32,6 +32,7 @@ from . import (
DEVICE_CLASS_POWER,
DEVICE_CLASS_PRESENCE,
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_RUNNING,
DEVICE_CLASS_SAFETY,
DEVICE_CLASS_SMOKE,
DEVICE_CLASS_SOUND,
@ -78,6 +79,8 @@ CONF_PRESENT = "present"
CONF_NOT_PRESENT = "not_present"
CONF_PROBLEM = "problem"
CONF_NO_PROBLEM = "no_problem"
CONF_RUNNING = "running"
CONF_NOT_RUNNING = "not_running"
CONF_UNSAFE = "unsafe"
CONF_NOT_UNSAFE = "not_unsafe"
CONF_SMOKE = "smoke"
@ -111,6 +114,7 @@ TURNED_ON = [
CONF_POWERED,
CONF_PRESENT,
CONF_PROBLEM,
CONF_RUNNING,
CONF_SMOKE,
CONF_SOUND,
CONF_UNSAFE,
@ -139,6 +143,7 @@ TURNED_OFF = [
CONF_NO_LIGHT,
CONF_NO_MOTION,
CONF_NO_PROBLEM,
CONF_NOT_RUNNING,
CONF_NO_SMOKE,
CONF_NO_SOUND,
CONF_NO_VIBRATION,
@ -175,6 +180,7 @@ ENTITY_TRIGGERS = {
DEVICE_CLASS_POWER: [{CONF_TYPE: CONF_POWERED}, {CONF_TYPE: CONF_NOT_POWERED}],
DEVICE_CLASS_PRESENCE: [{CONF_TYPE: CONF_PRESENT}, {CONF_TYPE: CONF_NOT_PRESENT}],
DEVICE_CLASS_PROBLEM: [{CONF_TYPE: CONF_PROBLEM}, {CONF_TYPE: CONF_NO_PROBLEM}],
DEVICE_CLASS_RUNNING: [{CONF_TYPE: CONF_RUNNING}, {CONF_TYPE: CONF_NOT_RUNNING}],
DEVICE_CLASS_SAFETY: [{CONF_TYPE: CONF_UNSAFE}, {CONF_TYPE: CONF_NOT_UNSAFE}],
DEVICE_CLASS_SMOKE: [{CONF_TYPE: CONF_SMOKE}, {CONF_TYPE: CONF_NO_SMOKE}],
DEVICE_CLASS_SOUND: [{CONF_TYPE: CONF_SOUND}, {CONF_TYPE: CONF_NO_SOUND}],

View File

@ -32,6 +32,8 @@
"is_not_present": "{entity_name} is not present",
"is_problem": "{entity_name} is detecting problem",
"is_no_problem": "{entity_name} is not detecting problem",
"is_running": "{entity_name} is running",
"is_not_running": "{entity_name} is not running",
"is_unsafe": "{entity_name} is unsafe",
"is_not_unsafe": "{entity_name} is safe",
"is_smoke": "{entity_name} is detecting smoke",
@ -80,6 +82,8 @@
"not_present": "{entity_name} not present",
"problem": "{entity_name} started detecting problem",
"no_problem": "{entity_name} stopped detecting problem",
"running": "{entity_name} started running",
"not_running": "{entity_name} is no longer running",
"unsafe": "{entity_name} became unsafe",
"not_unsafe": "{entity_name} became safe",
"smoke": "{entity_name} started detecting smoke",
@ -171,6 +175,10 @@
"off": "OK",
"on": "Problem"
},
"running": {
"off": "Not running",
"on": "Running"
},
"safety": {
"off": "Safe",
"on": "Unsafe"