-
Notifications
You must be signed in to change notification settings - Fork 1
notificationTools A Collection of Tools to Manage Device Notifications
| Description | This library implements notifications for notification class version 8 as identified in Z-Wave standard SDS13713. |
|---|---|
| Classes Supported | Notification V8 |
| zwaveEvent handling | void zwaveEvent(hubitat.zwave.commands.notificationv8.NotificationSupportedReport report, ep = null ) void zwaveEvent(hubitat.zwave.commands.notificationv8.EventSupportedReport cmd, ep = null ) void zwaveEvent(hubitat.zwave.commands.notificationv8.NotificationReport cmd, ep = null ) |
| Initialization Function | To be added |
| Refresh Function | void notificationTools_refresh(ep = null ) |
| Customization | Driver operation can be customized using the following user defined functions (explanation to be added) userDefinedNotificationReportFilter(cmd) userDefinedNotificationEventFilter(event) |
| Custom Attributes | See table, below. |
| Notification Events Supported | See table, below. |
| S2 Support | Receipt of S2 encoded messages is handled by dependent library zwaveTools.receivetools |
| Dependencies | #include zwaveTools.receiveTools #include zwaveTools.globalDataTools #include zwaveTools.endpointTools |
| Sleep / Wake Support | For sleeping nodes, the Refresh and Initialization functions should be called during a wake (additional explanation to be added) |
This library supports the following Z-Wave Notification Types and Subtypes (see Zwave Document SDS13713)
- "Event" corresponds to column B of standard SDS13713
- "Event Values" corresponds to column G of standard SDS13713
| Event | Name | Event Values | Capability or Attribute | Notes |
|---|---|---|---|---|
| 0x01 | Smoke Alarm | 1, 2 | Capability "SmokeDetector" | |
| 4, 5, 7, 8 | Capability "Consumable" | |||
| 0x02 | CO Alarm | 1, 2 | Capability "CarbonMonoxideDetector" | |
| 4, 5, 7 | Capability "Consumable" | |||
| 0x03 | CO2 Alarm | 1, 2 | attribute "carbonDioxideDetected" | This is a custom attribute with values "" or "" |
| 4, 5, 7 | Capability "Consumable" | |||
| 0x04 | Heat Alarm | 1, 2, 3, 4, 5, 6, 8, 12, 13 | attribute "heatAlarm" | add custom attribute "heatAlarm" to your driver definition section. Values are: ENUM: [ "normal", "overheat", "underheat", "rapidRise", "rapidFall" ] |
| 8, 10, 11 | Capability "Consumable" | |||
| 0x05 | Water Alarm | 1, 2 | Capability "WaterSensor" | |
| 5 | Capability "FilterStatus" | Not sure if any real devices use this, but the zwave spec seemed to match up, so its included! |
||
| 0x06 | Access Control | 1, 2, 3, 4, 5, 6, 11, 254 | Capability "Lock" | |
| 0x07 | Home Security | 1, 2 | Capability "ContactSensor" | |
| 3, 4, 9 | Capability "TamperAlert" | |||
| 5, 6 | Capability "ShockSensor" | This is for Glass Breakage detectors | ||
| 7, 8 | Capability "Motion" | |||
| 0x09 | System | 5 | attribute "heartbeat" | Custom attribute. Value is the last heartbeat time. |
| 0x12 | Gas Alarm | 1, 2, 5 | Capability "GasDetector" | |
| 6 | Capability "Consumable" | |||
| 0x0E | Siren | 1 | Capability "Alarm" | |
| 0x0F | Water Valve | 1 | Capability "Valve" | |
| 0x16 | Home Monitoring | 1, 2 | Capability "PresenceSensor" |
This library is dependent on globalDataTools.groovy
Your code should include the lines:
#include zwaveTools.globalDataTools
#include zwaveTools.notificationTools
The following method for use in your driver
void notificationTools_refresh(ep = null )
This method causes an **immediate **refresh of the notification state of your device by sending notificationGet messages to your device. If your device is "sleepy", then you should add this to your "wake" routine or implement code.
In order to make the "refresh" function device-independent, it makes no assumptions about the notification supported by your device. In order to do that, the first time the refresh command is called, it will send a notificationSupportedGet() command to your device. The device will then responds with all of the notifications that it supports. These notifications are stored (using globalDataTools) and then used to perform the refresh. Note that, to speed operation, the "notificationSupportedGet" needs to be called by only one device of a particular type -- once it gets stored using globalDataTools, the result will be "seen" by any similar device (based on a match of the manufacturer, device type, device ID).
You can speed (and refine) the Notification refresh by defining the following method:
Map<Integer,List> getStoredNotificationList(ep = null )
The getStoredNotificationList function returns a Map which identifies the notifications supported by your end-device. The Map must be of the format
Map<Integer, List> = [ 7:[3, 8], 8:[1, 5], 9:[4, 5]]]
The Map keys are the Z-Wave Event type (column B of SDS 13713). The List for each key are then the event values that are supported (Column G of SDS13713).
This, for example, the map above is for Home Security (7) with events Tampering, and Motion, Power Management with events power applied and voltage drop, and System events "software failure and heartbeat"
This code handles endpoints / child devices in the following manner:
When a notification event occurs, the code will retrieve all child devices associated with an endpoint. Notifications are then dispatched to each child device by a "hasAttribute" test to check if the child device supports the event attribute. If it does, a sendEvent with the notifiction is dispatched to the child.
When a sendEvent message is sent by the driver, it will include the added field "deviceType" and "zwaveOriginalMessage".
- deviceType will always be set to "ZWV" indicating the original device was a Zwave device.
- zwaveOriginalMessage is the packet content of the original zWave notification message expressed as a hex string.
[deviceType:"ZWV", zwaveOriginalMessage:cmd.format()]
These fields are not used by Hubitat, but I've added them in case any application listening on the eventStream wants to know the "full" message in order to do any custom parsing / processing.