Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Z-Wave JS smoke, CO, CO2, Heat, Water problem entities to diagnostic #129922

Draft
wants to merge 6 commits into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 54 additions & 10 deletions homeassistant/components/zwave_js/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ class PropertyZWaveJSEntityDescription(BinarySensorEntityDescription):


# Mappings for Notification sensors
# https://github.com/zwave-js/node-zwave-js/blob/master/packages/config/config/notifications.json
# https://github.com/zwave-js/specs/blob/master/Registries/Notification%20Command%20Class%2C%20list%20of%20assigned%20Notifications.xlsx
#
# Mapping rules:
# The catch all description should not have a device class and be marked as diagnostic.
NOTIFICATION_SENSOR_MAPPINGS: tuple[NotificationZWaveJSEntityDescription, ...] = (
NotificationZWaveJSEntityDescription(
# NotificationType 1: Smoke Alarm - State Id's 1 and 2 - Smoke detected
Expand All @@ -76,9 +79,16 @@ class PropertyZWaveJSEntityDescription(BinarySensorEntityDescription):
device_class=BinarySensorDeviceClass.SMOKE,
),
NotificationZWaveJSEntityDescription(
# NotificationType 1: Smoke Alarm - All other State Id's
# NotificationType 1: Smoke Alarm - State Id's 4, 5, 7, 8
key=NOTIFICATION_SMOKE_ALARM,
states=("4", "5", "7", "8"),
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 1: Smoke Alarm - All other State Id's
key=NOTIFICATION_SMOKE_ALARM,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 2: Carbon Monoxide - State Id's 1 and 2
Expand All @@ -87,9 +97,16 @@ class PropertyZWaveJSEntityDescription(BinarySensorEntityDescription):
device_class=BinarySensorDeviceClass.CO,
),
NotificationZWaveJSEntityDescription(
# NotificationType 2: Carbon Monoxide - All other State Id's
# NotificationType 2: Carbon Monoxide - State Id 4, 5, 7
key=NOTIFICATION_CARBON_MONOOXIDE,
states=("4", "5", "7"),
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 2: Carbon Monoxide - All other State Id's
key=NOTIFICATION_CARBON_MONOOXIDE,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 3: Carbon Dioxide - State Id's 1 and 2
Expand All @@ -98,9 +115,16 @@ class PropertyZWaveJSEntityDescription(BinarySensorEntityDescription):
device_class=BinarySensorDeviceClass.GAS,
),
NotificationZWaveJSEntityDescription(
# NotificationType 3: Carbon Dioxide - All other State Id's
# NotificationType 3: Carbon Dioxide - State Id's 4, 5, 7
key=NOTIFICATION_CARBON_DIOXIDE,
states=("4", "5", "7"),
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 3: Carbon Dioxide - All other State Id's
key=NOTIFICATION_CARBON_DIOXIDE,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 4: Heat - State Id's 1, 2, 5, 6 (heat/underheat)
Expand All @@ -109,20 +133,34 @@ class PropertyZWaveJSEntityDescription(BinarySensorEntityDescription):
device_class=BinarySensorDeviceClass.HEAT,
),
NotificationZWaveJSEntityDescription(
# NotificationType 4: Heat - All other State Id's
# NotificationType 4: Heat - State ID's 8, A, B
key=NOTIFICATION_HEAT,
states=("8", "10", "11"),
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 5: Water - State Id's 1, 2, 3, 4
# NotificationType 4: Heat - All other State Id's
key=NOTIFICATION_HEAT,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 5: Water - State Id's 1, 2, 3, 4, 6, 7, 8, 9, 0A
key=NOTIFICATION_WATER,
states=("1", "2", "3", "4"),
states=("1", "2", "3", "4", "6", "7", "8", "9", "10"),
device_class=BinarySensorDeviceClass.MOISTURE,
),
NotificationZWaveJSEntityDescription(
# NotificationType 5: Water - All other State Id's
# NotificationType 5: Water - State Id's B
key=NOTIFICATION_WATER,
states=("11",),
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 5: Water - All other State Id's
key=NOTIFICATION_WATER,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 6: Access Control - State Id's 1, 2, 3, 4 (Lock)
Expand Down Expand Up @@ -214,16 +252,22 @@ class PropertyZWaveJSEntityDescription(BinarySensorEntityDescription):
device_class=BinarySensorDeviceClass.SOUND,
),
NotificationZWaveJSEntityDescription(
# NotificationType 18: Gas
# NotificationType 18: Gas - State Id's 1, 2, 3, 4
key=NOTIFICATION_GAS,
states=("1", "2", "3", "4"),
device_class=BinarySensorDeviceClass.GAS,
),
NotificationZWaveJSEntityDescription(
# NotificationType 18: Gas
# NotificationType 18: Gas - State Id 6
key=NOTIFICATION_GAS,
states=("6",),
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
),
NotificationZWaveJSEntityDescription(
# NotificationType 18: Gas - All other State Id's
key=NOTIFICATION_GAS,
entity_category=EntityCategory.DIAGNOSTIC,
),
)

Expand Down
Loading