zwave-js / zwave-js-ui

Full featured Z-Wave Control Panel UI and MQTT gateway. Built using Nodejs, and Vue/Vuetify
https://zwave-js.github.io/zwave-js-ui
MIT License
982 stars 202 forks source link

[feat] MQTT Discovery support for Notification CC 0x71 (113) #2929

Closed max3163 closed 1 year ago

max3163 commented 1 year ago

Is your problem within Home Assistant (Core or Z-Wave JS Integration)?

NO, my problem is NOT within Home Assistant or the ZWave JS integration

Is your problem within Z-Wave JS UI (formerly ZwaveJS2MQTT)?

NO, my problem is NOT within Z-Wave JS UI

Checklist

Describe the bug

The Switch is never updated when I arm or disarm my ZIPATO keypad device. Nothing is updated on any switch remote to my Domoticz system too.

In fact, when I switch home or away in the tag reader just an event/notification is fire :

2023-01-14T19:58:07.764Z CNTRLR   [Node 006] [Notification]
type:   Access Control
event:  Keypad unlock operation
userId: 4

But the switch remain not updated...

Binary Switch v1
[6-37-0-currentValue] Current value : false

Is-it possible to add/update a switch corresponding to the Access_Control event for Keypad_unlock_operation/Keypad_lock_operation event?

On MQTT log :

2023-01-14T19:58:07: Received PUBLISH from ZWAVE_GATEWAY-zwave-js-ui (d0, q1, r0, m12351, 'domoticz/_EVENTS/ZWAVE_GATEWAY-zwave-js-ui/node/node_value_updated', ... (956 bytes))
2023-01-14T19:58:07: Sending PUBLISH to Domoticz-MQTT-AutoDiscoverd96c4a0c-2a15-40d8-a202-c640693b508011 (d0, q0, r0, m0, 'domoticz/_EVENTS/ZWAVE_GATEWAY-zwave-js-ui/node/node_value_updated', ... (956 bytes))
2023-01-14T19:58:07: Sending PUBACK to ZWAVE_GATEWAY-zwave-js-ui (m12351, rc0)
2023-01-14T19:58:07: Received PUBLISH from ZWAVE_GATEWAY-zwave-js-ui (d0, q1, r0, m12352, 'domoticz/Entrée/Zipato_RFID_Clavier/113/0/Access_Control/Keypad_unlock_operation', ... (43 bytes))

Device information

  "productDescription": "Keypad with alarm activation rfid tag",
  "manufacturer": "Wintop",
  "firmwareVersion": "0.28",
  "protocolVersion": 3,
  "nodeType": 1,
  "endpointsCount": 0,
  "endpointIndizes": [],
  "isSecure": false,
  "security": "None",
  "supportsSecurity": false,
  "supportsBeaming": true,
  "isControllerNode": false,
  "isListening": false,
  "isFrequentListening": false,
  "isRouting": true,
  "keepAwake": false,
  "maxDataRate": 40000,
  "deviceClass": {
    "basic": 4,
    "generic": 64,
    "specific": 0
      "id": "6-37-0-currentValue",
      "nodeId": 6,
      "toUpdate": false,
      "commandClass": 37,
      "commandClassName": "Binary Switch",
      "endpoint": 0,
      "property": "currentValue",
      "propertyName": "currentValue",
      "type": "boolean",
      "readable": true,
      "writeable": false,
      "label": "Current value",
      "stateless": false,
      "commandClassVersion": 1,
      "list": false,
      "value": false,
      "isCurrentValue": true,
      "targetValue": "37-0-targetValue",
      "lastUpdate": 1673777986262,
      "newValue": false

How are you using node-zwave-js?

Which branches or versions?

2023-01-22T10:39:28.782Z DRIVER version 10.3.1 2023-01-22T10:39:28.783Z DRIVER
2023-01-22T10:39:28.805Z CONFIG version 10.3.1

Did you change anything?

no

If yes, what did you change?

No response

Did this work before?

Don't know, this is a new device

If yes, where did it work?

When I used the OpenZwave lib with domoticz it worked well.

Attach Driver Logfile

zwavejs_2023-01-22.log

AlCalzone commented 1 year ago

Assuming this is your device manual, then the switch you reference is this one:

The Switch Binary Command Class is used to enable or disable the notification sound. This sound is typically used to notify a user when the alarm system is being activated. See also the ‘Sound Notification’ section.

which has nothing to do with what you're trying to do.

Keypad unlock notifications should be mapped to values of either the Lock CC or the Door Lock CC. Unfortunately, I cannot see this in your log, since it is not on loglevel debug as requested.

max3163 commented 1 year ago

Hi,

thanks for your answer.

See, the log with debug level :

zwavejs_2023-01-30.log

AlCalzone commented 1 year ago

Uhhhh - there's no (Door) Lock CC to map these events to.

So you'll have to implement something with MQTT discovery, but that's not a driver issue, but zwave-js UI. I'll transfer the issue. @robertsLando should be able to give you some pointers.

robertsLando commented 1 year ago

@max3163 Like you said in this comment you should try to create a custom component for that, once you have identified the topic where the notification is sent that based on what you said should be

domoticz/Entrée/Zipato_RFID_Clavier/113/0/Access_Control/Keypad_unlock_operation

max3163 commented 1 year ago

But I use domoticz and not Home Assistant... it will work too ? I'm not sure to understand what I need to do exactly when I read the documentation ...

robertsLando commented 1 year ago

I don't know how/if domoticz allows to create custom components, you need to ask devs for that. Anyway as long as there are mqtt messages for that event you should be able to catch them on domoticz and show a wisdget for it.

I could also try to implement in on MQTT discovery side but I would need you to be able to test it locally. Are you able to do so?

I need to know what kind of mqtt discovery device you wish to use for it too

robertsLando commented 1 year ago

On hass integration side they mapped notification in this way: https://github.com/home-assistant/core/blob/dev/homeassistant/components/zwave_js/binary_sensor.py#L75

Following https://github.com/zwave-js/node-zwave-js/blob/master/packages/config/config/notifications.json

The same should be done on discoverValue function here: https://github.com/zwave-js/zwave-js-ui/blob/master/lib/Gateway.ts#L1223

kpine commented 1 year ago

@robertsLando HA does not map any notification events to switches (binary switch). Also, the Z-Wave JS Notifications are events in HA, not sensors, see for this exact case: https://www.home-assistant.io/integrations/zwave_js/#node-events-notification.

The code you've linked to is mapping Notification value updates to binary sensors (not switches).

robertsLando commented 1 year ago

@kpine Thanks for the clarification, as you know I'm not an HA user, could you suggest me the best way to integrate notifications using MQTT discovery? Can I create events using mqtt discovery or something similar?

kpine commented 1 year ago

I don't use MQTT discovery so I'm probably not qualified to answer. I did look at the docs and don't see anything like an "event" being supported. I think that depends on what type of device the discovery categorizes it as. E.g. an MQTT Lock has different configuration and features than an MQTT Alarm Panel.

max3163 commented 1 year ago

I admit, I'm totally lost... What I need to do exactly ? Ask on the domoticz side ? Wait for more details?

robertsLando commented 1 year ago

@max3163 You could ask to domoticx devs if there is a way to show a widget or else from a packet you receive from mqtt.

The other solution could be to wait if I find a way to implement such thing on zui but I cannot say if I will do this soon

max3163 commented 1 year ago

As I understand from the Domoticz side, it's impossible to have a device without config object and Ass I understand on you side it's not the case with event ?

So I just need to resell my Zipato RFID keypad...

robertsLando commented 1 year ago

Nope at least until someone (or me) find some time to implement this. ATM I have no device with this and I even don't use domoticz so it's difficult for me to test.

max3163 commented 1 year ago

I've written a little program in Go to parse the "/AccessControl/Keypad(un)lock_operation" topics and push on the "Zipato_RFID_Clavier/37/0/targetValue/set" topic the corresponding state.

It works, so I will close the issue even if the source of the problem persistent.