mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Move Z-Wave JS smoke, CO, CO2, Heat, Water problem entities to diagnostic (#129922)
* Move Z-Wave JS smoke, CO, CO2, Heat, Water problem entities to diagnostic * Update link + states * Specify problem class explicitly instead of catch-all * Heat alarm test is not a problem * Also split out smoke alarm * Document mapping rule * add tests * format * update test * review comments * remove idle state from doc as it is ignored --------- Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
This commit is contained in:
parent
7a9836064d
commit
cbcd1929dd
@ -67,7 +67,45 @@ 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.
|
||||
#
|
||||
# The following notifications have been moved to diagnostic:
|
||||
# Smoke Alarm
|
||||
# - Alarm silenced
|
||||
# - Replacement required
|
||||
# - Replacement required, End-of-life
|
||||
# - Maintenance required, planned periodic inspection
|
||||
# - Maintenance required, dust in device
|
||||
# CO Alarm
|
||||
# - Carbon monoxide test
|
||||
# - Replacement required
|
||||
# - Replacement required, End-of-life
|
||||
# - Alarm silenced
|
||||
# - Maintenance required, planned periodic inspection
|
||||
# CO2 Alarm
|
||||
# - Carbon dioxide test
|
||||
# - Replacement required
|
||||
# - Replacement required, End-of-life
|
||||
# - Alarm silenced
|
||||
# - Maintenance required, planned periodic inspection
|
||||
# Heat Alarm
|
||||
# - Rapid temperature rise (location provided)
|
||||
# - Rapid temperature rise
|
||||
# - Rapid temperature fall (location provided)
|
||||
# - Rapid temperature fall
|
||||
# - Heat alarm test
|
||||
# - Alarm silenced
|
||||
# - Replacement required, End-of-life
|
||||
# - Maintenance required, dust in device
|
||||
# - Maintenance required, planned periodic inspection
|
||||
|
||||
# Water Alarm
|
||||
# - Replace water filter
|
||||
# - Sump pump failure
|
||||
|
||||
NOTIFICATION_SENSOR_MAPPINGS: tuple[NotificationZWaveJSEntityDescription, ...] = (
|
||||
NotificationZWaveJSEntityDescription(
|
||||
# NotificationType 1: Smoke Alarm - State Id's 1 and 2 - Smoke detected
|
||||
@ -75,10 +113,17 @@ NOTIFICATION_SENSOR_MAPPINGS: tuple[NotificationZWaveJSEntityDescription, ...] =
|
||||
states=("1", "2"),
|
||||
device_class=BinarySensorDeviceClass.SMOKE,
|
||||
),
|
||||
NotificationZWaveJSEntityDescription(
|
||||
# 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,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
NotificationZWaveJSEntityDescription(
|
||||
# NotificationType 2: Carbon Monoxide - State Id's 1 and 2
|
||||
@ -86,10 +131,17 @@ NOTIFICATION_SENSOR_MAPPINGS: tuple[NotificationZWaveJSEntityDescription, ...] =
|
||||
states=("1", "2"),
|
||||
device_class=BinarySensorDeviceClass.CO,
|
||||
),
|
||||
NotificationZWaveJSEntityDescription(
|
||||
# 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,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
NotificationZWaveJSEntityDescription(
|
||||
# NotificationType 3: Carbon Dioxide - State Id's 1 and 2
|
||||
@ -97,10 +149,17 @@ NOTIFICATION_SENSOR_MAPPINGS: tuple[NotificationZWaveJSEntityDescription, ...] =
|
||||
states=("1", "2"),
|
||||
device_class=BinarySensorDeviceClass.GAS,
|
||||
),
|
||||
NotificationZWaveJSEntityDescription(
|
||||
# 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,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
NotificationZWaveJSEntityDescription(
|
||||
# NotificationType 4: Heat - State Id's 1, 2, 5, 6 (heat/underheat)
|
||||
@ -109,20 +168,34 @@ NOTIFICATION_SENSOR_MAPPINGS: tuple[NotificationZWaveJSEntityDescription, ...] =
|
||||
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 - 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,
|
||||
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
NotificationZWaveJSEntityDescription(
|
||||
# NotificationType 6: Access Control - State Id's 1, 2, 3, 4 (Lock)
|
||||
@ -214,16 +287,22 @@ NOTIFICATION_SENSOR_MAPPINGS: tuple[NotificationZWaveJSEntityDescription, ...] =
|
||||
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,
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -509,6 +509,15 @@ def aeotec_smart_switch_7_state_fixture() -> NodeDataType:
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(name="zcombo_smoke_co_alarm_state")
|
||||
def zcombo_smoke_co_alarm_state_fixture() -> NodeDataType:
|
||||
"""Load node with fixture data for ZCombo-G Smoke/CO Alarm."""
|
||||
return cast(
|
||||
NodeDataType,
|
||||
load_json_object_fixture("zcombo_smoke_co_alarm_state.json", DOMAIN),
|
||||
)
|
||||
|
||||
|
||||
# model fixtures
|
||||
|
||||
|
||||
@ -554,6 +563,7 @@ def mock_client_fixture(
|
||||
client.connect = AsyncMock(side_effect=connect)
|
||||
client.listen = AsyncMock(side_effect=listen)
|
||||
client.disconnect = AsyncMock(side_effect=disconnect)
|
||||
client.disable_server_logging = MagicMock()
|
||||
client.driver = Driver(
|
||||
client, copy.deepcopy(controller_state), copy.deepcopy(log_config_state)
|
||||
)
|
||||
@ -1252,3 +1262,13 @@ def aeotec_smart_switch_7_fixture(
|
||||
node = Node(client, aeotec_smart_switch_7_state)
|
||||
client.driver.controller.nodes[node.node_id] = node
|
||||
return node
|
||||
|
||||
|
||||
@pytest.fixture(name="zcombo_smoke_co_alarm")
|
||||
def zcombo_smoke_co_alarm_fixture(
|
||||
client: MagicMock, zcombo_smoke_co_alarm_state: NodeDataType
|
||||
) -> Node:
|
||||
"""Load node for ZCombo-G Smoke/CO Alarm."""
|
||||
node = Node(client, zcombo_smoke_co_alarm_state)
|
||||
client.driver.controller.nodes[node.node_id] = node
|
||||
return node
|
||||
|
@ -0,0 +1,854 @@
|
||||
{
|
||||
"nodeId": 3,
|
||||
"index": 0,
|
||||
"installerIcon": 3073,
|
||||
"userIcon": 3073,
|
||||
"status": 1,
|
||||
"ready": true,
|
||||
"isListening": false,
|
||||
"isRouting": true,
|
||||
"isSecure": true,
|
||||
"manufacturerId": 312,
|
||||
"productId": 3,
|
||||
"productType": 1,
|
||||
"firmwareVersion": "11.0.0",
|
||||
"zwavePlusVersion": 1,
|
||||
"deviceConfig": {
|
||||
"filename": "/data/db/devices/0x0138/zcombo-g.json",
|
||||
"isEmbedded": true,
|
||||
"manufacturer": "First Alert (BRK Brands Inc)",
|
||||
"manufacturerId": 312,
|
||||
"label": "ZCOMBO",
|
||||
"description": "ZCombo-G Smoke/CO Alarm",
|
||||
"devices": [
|
||||
{
|
||||
"productType": 1,
|
||||
"productId": 3
|
||||
}
|
||||
],
|
||||
"firmwareVersion": {
|
||||
"min": "0.0",
|
||||
"max": "255.255"
|
||||
},
|
||||
"preferred": false,
|
||||
"associations": {},
|
||||
"paramInformation": {
|
||||
"_map": {}
|
||||
},
|
||||
"metadata": {
|
||||
"wakeup": "WAKEUP\n1. Slide battery door open and then closed with the batteries inserted.",
|
||||
"inclusion": "ADD\n1. Slide battery door open.\n2. Insert batteries checking the correct orientation.\n3. Press and hold the test button. Keep it held down as you slide the battery drawer closed. You may then release the button.\nNOTE: Use only your finger or thumb on the test button. The use of any other instrument is strictly prohibited",
|
||||
"exclusion": "REMOVE\n1. Slide battery door open.\n2. Remove and re-insert batteries checking the correct orientation.\n3. Press and hold the test button. Keep it held down as you slide the battery drawer closed. You may then release the button.\nNOTE: Use only your finger or thumb on the test button. The use of any other instrument is strictly prohibited",
|
||||
"reset": "RESET DEVICE\nIf the device is powered up with the test button held down for 10+ seconds, the device will reset all Z-Wave settings and leave the network.\nUpon completion of the Reset operation, the LED will glow and the horn will sound for ~1 second.\nPlease use this procedure only when the network primary controller is missing or otherwise inoperable",
|
||||
"manual": "https://products.z-wavealliance.org/ProductManual/File?folder=&filename=product_documents/3886/User_Manual_M08-0456-173833_D2.pdf"
|
||||
}
|
||||
},
|
||||
"label": "ZCOMBO",
|
||||
"interviewAttempts": 0,
|
||||
"isFrequentListening": false,
|
||||
"maxDataRate": 100000,
|
||||
"supportedDataRates": [40000, 100000],
|
||||
"protocolVersion": 3,
|
||||
"supportsBeaming": true,
|
||||
"supportsSecurity": false,
|
||||
"nodeType": 1,
|
||||
"zwavePlusNodeType": 0,
|
||||
"zwavePlusRoleType": 6,
|
||||
"deviceClass": {
|
||||
"basic": {
|
||||
"key": 4,
|
||||
"label": "Routing End Node"
|
||||
},
|
||||
"generic": {
|
||||
"key": 7,
|
||||
"label": "Notification Sensor"
|
||||
},
|
||||
"specific": {
|
||||
"key": 1,
|
||||
"label": "Notification Sensor"
|
||||
}
|
||||
},
|
||||
"interviewStage": "Complete",
|
||||
"deviceDatabaseUrl": "https://devices.zwave-js.io/?jumpTo=0x0138:0x0001:0x0003:11.0.0",
|
||||
"statistics": {
|
||||
"commandsTX": 1,
|
||||
"commandsRX": 4,
|
||||
"commandsDroppedRX": 1,
|
||||
"commandsDroppedTX": 0,
|
||||
"timeoutResponse": 0,
|
||||
"lwr": {
|
||||
"protocolDataRate": 3,
|
||||
"repeaters": [],
|
||||
"rssi": -79,
|
||||
"repeaterRSSI": []
|
||||
},
|
||||
"lastSeen": "2024-11-11T21:36:45.802Z",
|
||||
"rtt": 28.9,
|
||||
"rssi": -79
|
||||
},
|
||||
"highestSecurityClass": 1,
|
||||
"isControllerNode": false,
|
||||
"keepAwake": false,
|
||||
"lastSeen": "2024-11-11T19:17:39.916Z",
|
||||
"protocol": 0,
|
||||
"values": [
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 112,
|
||||
"commandClassName": "Configuration",
|
||||
"property": 1,
|
||||
"propertyName": "Supervision Report Timeout",
|
||||
"ccVersion": 1,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": true,
|
||||
"description": "ZCOMBO will send the message over Supervision Command Class and it will wait for the Supervision report from the Controller for the Supervision report timeout time.",
|
||||
"label": "Supervision Report Timeout",
|
||||
"default": 1500,
|
||||
"min": 500,
|
||||
"max": 5000,
|
||||
"unit": "ms",
|
||||
"valueSize": 2,
|
||||
"format": 0,
|
||||
"allowManualEntry": true,
|
||||
"isFromConfig": true
|
||||
},
|
||||
"value": 1500
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 112,
|
||||
"commandClassName": "Configuration",
|
||||
"property": 2,
|
||||
"propertyName": "Supervision Retry Count",
|
||||
"ccVersion": 1,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": true,
|
||||
"description": "If the Supervision report is not received within the Supervision report timeout time, the ZCOMBO will retry sending the message again. Upon exceeding the max retry, the ZCOMBO device will send the next message available in the queue.",
|
||||
"label": "Supervision Retry Count",
|
||||
"default": 1,
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"valueSize": 2,
|
||||
"format": 0,
|
||||
"allowManualEntry": true,
|
||||
"isFromConfig": true
|
||||
},
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 112,
|
||||
"commandClassName": "Configuration",
|
||||
"property": 3,
|
||||
"propertyName": "Supervision Wait Time",
|
||||
"ccVersion": 1,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": true,
|
||||
"description": "Before retrying the message, ZCOMBO will wait for the Supervision wait time. Actual wait time is calculated using the formula: Wait Time = Supervision wait time base-value + random-value + (attempt-count x 5 seconds). The random value will be between 100 and 1100 milliseconds.",
|
||||
"label": "Supervision Wait Time",
|
||||
"default": 5,
|
||||
"min": 1,
|
||||
"max": 60,
|
||||
"unit": "seconds",
|
||||
"valueSize": 2,
|
||||
"format": 0,
|
||||
"allowManualEntry": true,
|
||||
"isFromConfig": true
|
||||
},
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 113,
|
||||
"commandClassName": "Notification",
|
||||
"property": "Smoke Alarm",
|
||||
"propertyKey": "Sensor status",
|
||||
"propertyName": "Smoke Alarm",
|
||||
"propertyKeyName": "Sensor status",
|
||||
"ccVersion": 8,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Sensor status",
|
||||
"ccSpecific": {
|
||||
"notificationType": 1
|
||||
},
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"states": {
|
||||
"0": "idle",
|
||||
"2": "Smoke detected"
|
||||
},
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 113,
|
||||
"commandClassName": "Notification",
|
||||
"property": "Smoke Alarm",
|
||||
"propertyKey": "Alarm status",
|
||||
"propertyName": "Smoke Alarm",
|
||||
"propertyKeyName": "Alarm status",
|
||||
"ccVersion": 8,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Alarm status",
|
||||
"ccSpecific": {
|
||||
"notificationType": 1
|
||||
},
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"states": {
|
||||
"0": "idle",
|
||||
"3": "Smoke alarm test",
|
||||
"6": "Alarm silenced"
|
||||
},
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 113,
|
||||
"commandClassName": "Notification",
|
||||
"property": "CO Alarm",
|
||||
"propertyKey": "Sensor status",
|
||||
"propertyName": "CO Alarm",
|
||||
"propertyKeyName": "Sensor status",
|
||||
"ccVersion": 8,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Sensor status",
|
||||
"ccSpecific": {
|
||||
"notificationType": 2
|
||||
},
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"states": {
|
||||
"0": "idle",
|
||||
"2": "Carbon monoxide detected"
|
||||
},
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 113,
|
||||
"commandClassName": "Notification",
|
||||
"property": "CO Alarm",
|
||||
"propertyKey": "Maintenance status",
|
||||
"propertyName": "CO Alarm",
|
||||
"propertyKeyName": "Maintenance status",
|
||||
"ccVersion": 8,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Maintenance status",
|
||||
"ccSpecific": {
|
||||
"notificationType": 2
|
||||
},
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"states": {
|
||||
"0": "idle",
|
||||
"5": "Replacement required, End-of-life"
|
||||
},
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 113,
|
||||
"commandClassName": "Notification",
|
||||
"property": "CO Alarm",
|
||||
"propertyKey": "Alarm status",
|
||||
"propertyName": "CO Alarm",
|
||||
"propertyKeyName": "Alarm status",
|
||||
"ccVersion": 8,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Alarm status",
|
||||
"ccSpecific": {
|
||||
"notificationType": 2
|
||||
},
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"states": {
|
||||
"0": "idle",
|
||||
"6": "Alarm silenced"
|
||||
},
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 113,
|
||||
"commandClassName": "Notification",
|
||||
"property": "System",
|
||||
"propertyKey": "Hardware status",
|
||||
"propertyName": "System",
|
||||
"propertyKeyName": "Hardware status",
|
||||
"ccVersion": 8,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Hardware status",
|
||||
"ccSpecific": {
|
||||
"notificationType": 9
|
||||
},
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"states": {
|
||||
"0": "idle",
|
||||
"1": "System hardware failure"
|
||||
},
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 113,
|
||||
"commandClassName": "Notification",
|
||||
"property": "alarmType",
|
||||
"propertyName": "alarmType",
|
||||
"ccVersion": 8,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Alarm Type",
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 113,
|
||||
"commandClassName": "Notification",
|
||||
"property": "alarmLevel",
|
||||
"propertyName": "alarmLevel",
|
||||
"ccVersion": 8,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Alarm Level",
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 114,
|
||||
"commandClassName": "Manufacturer Specific",
|
||||
"property": "manufacturerId",
|
||||
"propertyName": "manufacturerId",
|
||||
"ccVersion": 2,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Manufacturer ID",
|
||||
"min": 0,
|
||||
"max": 65535,
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 312
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 114,
|
||||
"commandClassName": "Manufacturer Specific",
|
||||
"property": "productType",
|
||||
"propertyName": "productType",
|
||||
"ccVersion": 2,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Product type",
|
||||
"min": 0,
|
||||
"max": 65535,
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 114,
|
||||
"commandClassName": "Manufacturer Specific",
|
||||
"property": "productId",
|
||||
"propertyName": "productId",
|
||||
"ccVersion": 2,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Product ID",
|
||||
"min": 0,
|
||||
"max": 65535,
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 128,
|
||||
"commandClassName": "Battery",
|
||||
"property": "level",
|
||||
"propertyName": "level",
|
||||
"ccVersion": 1,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Battery level",
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"unit": "%",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 92
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 128,
|
||||
"commandClassName": "Battery",
|
||||
"property": "isLow",
|
||||
"propertyName": "isLow",
|
||||
"ccVersion": 1,
|
||||
"metadata": {
|
||||
"type": "boolean",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Low battery level",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": false
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 132,
|
||||
"commandClassName": "Wake Up",
|
||||
"property": "wakeUpInterval",
|
||||
"propertyName": "wakeUpInterval",
|
||||
"ccVersion": 2,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"default": 4200,
|
||||
"readable": false,
|
||||
"writeable": true,
|
||||
"min": 4200,
|
||||
"max": 4200,
|
||||
"steps": 0,
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 4200
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 132,
|
||||
"commandClassName": "Wake Up",
|
||||
"property": "controllerNodeId",
|
||||
"propertyName": "controllerNodeId",
|
||||
"ccVersion": 2,
|
||||
"metadata": {
|
||||
"type": "any",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Node ID of the controller",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "libraryType",
|
||||
"propertyName": "libraryType",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Library type",
|
||||
"states": {
|
||||
"0": "Unknown",
|
||||
"1": "Static Controller",
|
||||
"2": "Controller",
|
||||
"3": "Enhanced Slave",
|
||||
"4": "Slave",
|
||||
"5": "Installer",
|
||||
"6": "Routing Slave",
|
||||
"7": "Bridge Controller",
|
||||
"8": "Device under Test",
|
||||
"9": "N/A",
|
||||
"10": "AV Remote",
|
||||
"11": "AV Device"
|
||||
},
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 6
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "protocolVersion",
|
||||
"propertyName": "protocolVersion",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Z-Wave protocol version",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": "6.7"
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "firmwareVersions",
|
||||
"propertyName": "firmwareVersions",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string[]",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Z-Wave chip firmware versions",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": ["11.0", "7.0"]
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "hardwareVersion",
|
||||
"propertyName": "hardwareVersion",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "number",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Z-Wave chip hardware version",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "sdkVersion",
|
||||
"propertyName": "sdkVersion",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "SDK version",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": "6.81.6"
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "applicationFrameworkAPIVersion",
|
||||
"propertyName": "applicationFrameworkAPIVersion",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Z-Wave application framework API version",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": "4.3.0"
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "applicationFrameworkBuildNumber",
|
||||
"propertyName": "applicationFrameworkBuildNumber",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Z-Wave application framework API build number",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 52445
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "hostInterfaceVersion",
|
||||
"propertyName": "hostInterfaceVersion",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Serial API version",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": "unused"
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "hostInterfaceBuildNumber",
|
||||
"propertyName": "hostInterfaceBuildNumber",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Serial API build number",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "zWaveProtocolVersion",
|
||||
"propertyName": "zWaveProtocolVersion",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Z-Wave protocol version",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": "6.7.0"
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "zWaveProtocolBuildNumber",
|
||||
"propertyName": "zWaveProtocolBuildNumber",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Z-Wave protocol build number",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 97
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "applicationVersion",
|
||||
"propertyName": "applicationVersion",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Application version",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": "11.0.0"
|
||||
},
|
||||
{
|
||||
"endpoint": 0,
|
||||
"commandClass": 134,
|
||||
"commandClassName": "Version",
|
||||
"property": "applicationBuildNumber",
|
||||
"propertyName": "applicationBuildNumber",
|
||||
"ccVersion": 3,
|
||||
"metadata": {
|
||||
"type": "string",
|
||||
"readable": true,
|
||||
"writeable": false,
|
||||
"label": "Application build number",
|
||||
"stateful": true,
|
||||
"secret": false
|
||||
},
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
"endpoints": [
|
||||
{
|
||||
"nodeId": 3,
|
||||
"index": 0,
|
||||
"installerIcon": 3073,
|
||||
"userIcon": 3073,
|
||||
"deviceClass": {
|
||||
"basic": {
|
||||
"key": 4,
|
||||
"label": "Routing End Node"
|
||||
},
|
||||
"generic": {
|
||||
"key": 7,
|
||||
"label": "Notification Sensor"
|
||||
},
|
||||
"specific": {
|
||||
"key": 1,
|
||||
"label": "Notification Sensor"
|
||||
}
|
||||
},
|
||||
"commandClasses": [
|
||||
{
|
||||
"id": 94,
|
||||
"name": "Z-Wave Plus Info",
|
||||
"version": 2,
|
||||
"isSecure": false
|
||||
},
|
||||
{
|
||||
"id": 133,
|
||||
"name": "Association",
|
||||
"version": 2,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 142,
|
||||
"name": "Multi Channel Association",
|
||||
"version": 3,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 89,
|
||||
"name": "Association Group Information",
|
||||
"version": 1,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 85,
|
||||
"name": "Transport Service",
|
||||
"version": 2,
|
||||
"isSecure": false
|
||||
},
|
||||
{
|
||||
"id": 134,
|
||||
"name": "Version",
|
||||
"version": 3,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 114,
|
||||
"name": "Manufacturer Specific",
|
||||
"version": 2,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 90,
|
||||
"name": "Device Reset Locally",
|
||||
"version": 1,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 115,
|
||||
"name": "Powerlevel",
|
||||
"version": 1,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 128,
|
||||
"name": "Battery",
|
||||
"version": 1,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 159,
|
||||
"name": "Security 2",
|
||||
"version": 1,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 113,
|
||||
"name": "Notification",
|
||||
"version": 8,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 132,
|
||||
"name": "Wake Up",
|
||||
"version": 2,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 112,
|
||||
"name": "Configuration",
|
||||
"version": 1,
|
||||
"isSecure": true
|
||||
},
|
||||
{
|
||||
"id": 108,
|
||||
"name": "Supervision",
|
||||
"version": 1,
|
||||
"isSecure": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -293,3 +293,141 @@ async def test_config_parameter_binary_sensor(
|
||||
state = hass.states.get(binary_sensor_entity_id)
|
||||
assert state
|
||||
assert state.state == STATE_OFF
|
||||
|
||||
|
||||
async def test_smoke_co_notification_sensors(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
zcombo_smoke_co_alarm: Node,
|
||||
integration: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test smoke and CO notification sensors with diagnostic states."""
|
||||
# Test smoke alarm sensor
|
||||
smoke_sensor = "binary_sensor.zcombo_g_smoke_co_alarm_smoke_detected"
|
||||
state = hass.states.get(smoke_sensor)
|
||||
assert state
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == BinarySensorDeviceClass.SMOKE
|
||||
entity_entry = entity_registry.async_get(smoke_sensor)
|
||||
assert entity_entry
|
||||
assert entity_entry.entity_category != EntityCategory.DIAGNOSTIC
|
||||
|
||||
# Test smoke alarm diagnostic sensor
|
||||
smoke_diagnostic = "binary_sensor.zcombo_g_smoke_co_alarm_smoke_alarm_test"
|
||||
state = hass.states.get(smoke_diagnostic)
|
||||
assert state
|
||||
assert state.state == STATE_OFF
|
||||
entity_entry = entity_registry.async_get(smoke_diagnostic)
|
||||
assert entity_entry
|
||||
assert entity_entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||
|
||||
# Test CO alarm sensor
|
||||
co_sensor = "binary_sensor.zcombo_g_smoke_co_alarm_carbon_monoxide_detected"
|
||||
state = hass.states.get(co_sensor)
|
||||
assert state
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes[ATTR_DEVICE_CLASS] == BinarySensorDeviceClass.CO
|
||||
entity_entry = entity_registry.async_get(co_sensor)
|
||||
assert entity_entry
|
||||
assert entity_entry.entity_category != EntityCategory.DIAGNOSTIC
|
||||
|
||||
# Test diagnostic entities
|
||||
entity_ids = [
|
||||
"binary_sensor.zcombo_g_smoke_co_alarm_smoke_alarm_test",
|
||||
"binary_sensor.zcombo_g_smoke_co_alarm_alarm_silenced",
|
||||
"binary_sensor.zcombo_g_smoke_co_alarm_replacement_required_end_of_life",
|
||||
"binary_sensor.zcombo_g_smoke_co_alarm_alarm_silenced_2",
|
||||
"binary_sensor.zcombo_g_smoke_co_alarm_system_hardware_failure",
|
||||
"binary_sensor.zcombo_g_smoke_co_alarm_low_battery_level",
|
||||
]
|
||||
for entity_id in entity_ids:
|
||||
entity_entry = entity_registry.async_get(entity_id)
|
||||
assert entity_entry
|
||||
assert entity_entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||
|
||||
# Test state updates for smoke alarm
|
||||
event = Event(
|
||||
type="value updated",
|
||||
data={
|
||||
"source": "node",
|
||||
"event": "value updated",
|
||||
"nodeId": 3,
|
||||
"args": {
|
||||
"commandClassName": "Notification",
|
||||
"commandClass": 113,
|
||||
"endpoint": 0,
|
||||
"property": "Smoke Alarm",
|
||||
"propertyKey": "Sensor status",
|
||||
"newValue": 2,
|
||||
"prevValue": 0,
|
||||
"propertyName": "Smoke Alarm",
|
||||
"propertyKeyName": "Sensor status",
|
||||
},
|
||||
},
|
||||
)
|
||||
zcombo_smoke_co_alarm.receive_event(event)
|
||||
await hass.async_block_till_done() # Wait for state change to be processed
|
||||
# Get a fresh state after the sleep
|
||||
state = hass.states.get(smoke_sensor)
|
||||
assert state is not None, "Smoke sensor state should not be None"
|
||||
assert state.state == STATE_ON, (
|
||||
f"Expected smoke sensor state to be 'on', got '{state.state}'"
|
||||
)
|
||||
|
||||
# Test state updates for CO alarm
|
||||
event = Event(
|
||||
type="value updated",
|
||||
data={
|
||||
"source": "node",
|
||||
"event": "value updated",
|
||||
"nodeId": 3,
|
||||
"args": {
|
||||
"commandClassName": "Notification",
|
||||
"commandClass": 113,
|
||||
"endpoint": 0,
|
||||
"property": "CO Alarm",
|
||||
"propertyKey": "Sensor status",
|
||||
"newValue": 2,
|
||||
"prevValue": 0,
|
||||
"propertyName": "CO Alarm",
|
||||
"propertyKeyName": "Sensor status",
|
||||
},
|
||||
},
|
||||
)
|
||||
zcombo_smoke_co_alarm.receive_event(event)
|
||||
await hass.async_block_till_done() # Wait for state change to be processed
|
||||
# Get a fresh state after the sleep
|
||||
state = hass.states.get(co_sensor)
|
||||
assert state is not None, "CO sensor state should not be None"
|
||||
assert state.state == STATE_ON, (
|
||||
f"Expected CO sensor state to be 'on', got '{state.state}'"
|
||||
)
|
||||
|
||||
# Test diagnostic state updates for smoke alarm
|
||||
event = Event(
|
||||
type="value updated",
|
||||
data={
|
||||
"source": "node",
|
||||
"event": "value updated",
|
||||
"nodeId": 3,
|
||||
"args": {
|
||||
"commandClassName": "Notification",
|
||||
"commandClass": 113,
|
||||
"endpoint": 0,
|
||||
"property": "Smoke Alarm",
|
||||
"propertyKey": "Alarm status",
|
||||
"newValue": 3,
|
||||
"prevValue": 0,
|
||||
"propertyName": "Smoke Alarm",
|
||||
"propertyKeyName": "Alarm status",
|
||||
},
|
||||
},
|
||||
)
|
||||
zcombo_smoke_co_alarm.receive_event(event)
|
||||
await hass.async_block_till_done() # Wait for state change to be processed
|
||||
# Get a fresh state after the sleep
|
||||
state = hass.states.get(smoke_diagnostic)
|
||||
assert state is not None, "Smoke diagnostic state should not be None"
|
||||
assert state.state == STATE_ON, (
|
||||
f"Expected smoke diagnostic state to be 'on', got '{state.state}'"
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user