OpenZwave: How to initiate get latest lock record via MQTT

My Vision ZM1701 does not report the latest log record automatically plus I do not see a way to retrieve the latest lock record in HA.
In ozw_admin, I can set the log record to ‘0’ which “gets” the latest lock record but how do I publish that command via MQTT? I think I might be able to figure out how to retrieve it…



Correct, HA does not support the Door Lock Logging class.

Normally you could use the (undocumented) refreshvalue command to refresh a single value, but I’m not sure it actually works for not for this specific command class.

topic: OpenZWave/1/command/refreshvalue/
payload: { "ValueIDKey": 5629...<fill in the rest> }

If that doesn’t work, you can request a refresh of the “dynamic” values.

topic: OpenZWave/1/command/requestnodedynamic/
payload: { "node": 13 }

If the refreshvalue does work, there is a way to configure OZW to always refresh the value when it receives a Door Lock Report.

How would I accomplish that?

I tried /refeshvalue/ with payload { “ValueIDKey”: 28148755200253969, “Value”,0 }, { “ValueIDKey”: 28148755200253969 } and { “ValueIDKey”: 562950176964631 } but they all did nothing.
I then published topic: OpenZWave/1/command/requestnodedynamic/ with payload: { "node": 13 } and that did refresh the log record to the current record although it does not seem to do it all the time. The other issue I see is the ‘current’ log record is always one behind the most current activity. i.e after unlocked manually it shows the last locked manually command…

I’ve added an automation which works in triggering MQTT to update the latest log record as long as I have set ‘0’ for log record in ozwadmin, If I look at any other log record then the /requestnodedynamic/ does not change that.

- id: '1598372075449'
  alias: Frontdoor Lock - Get latest record
  description: ''
  trigger:
  - device_id: 03edf5fc73bc4541ad3c06cf0ef7d90c
    domain: lock
    entity_id: lock.zm1702_deadbolt
    platform: device
    type: locked
  - device_id: 03edf5fc73bc4541ad3c06cf0ef7d90c
    domain: lock
    entity_id: lock.zm1702_deadbolt
    platform: device
    type: unlocked
  condition: []
  action:
  - data:
      payload: '{ "node": 13 }'
      topic: OpenZWave/1/command/requestnodedynamic/
    service: mqtt.publish
  mode: single

What would I configure in HA to get/contain the Log record?

MQTT topic is OpenZWave/1/node/13/instance/1/commandclass/76/value/562950176964631/
Value is:

{
    "Label": "Log Record",
    "Value": "25/08/2020 16:31:07 \tMessage: Lock Attempt via Remote Out of Schedule Access Code \tUserID: 0 \tUserCode:",
    "Units": "",
    "ValueSet": true,
    "ValuePolled": false,
    "ChangeVerified": false,
    "Min": 0,
    "Max": 0,
    "Type": "String",
    "Instance": 1,
    "CommandClass": "COMMAND_CLASS_DOOR_LOCK_LOGGING",
    "Index": 2,
    "Node": 13,
    "Genre": "User",
    "Help": "Log Entry",
    "ValueIDKey": 562950176964631,
    "ReadOnly": true,
    "WriteOnly": false,
    "Event": "valueChanged",
    "TimeStamp": 1598372859
}

I have added this sensor to HA but it’s incorrect/incompleet…

  - platform: mqtt
    name: "Front Door Lock Log"
    state_topic: "OpenZWave/1/node/13/instance/1/commandclass/76/value/562950176964631/"

Progress…

  - platform: mqtt
    name: "Front Door Lock Log"
    state_topic: "OpenZWave/1/node/13/instance/1/commandclass/76/value/562950176964631/"
    value_template: "{{ value_json.Index }}"
    json_attributes_topic: "OpenZWave/1/node/13/instance/1/commandclass/76/value/562950176964631/" 

  - platform: template
    sensors:
      frontdoor_lock_log_date:
        friendly_name: "Front Door Lock Log Date"
        value_template: '{{ states.sensor.front_door_lock_log.attributes["TimeStamp"] | timestamp_custom("%d/%m/%y %H:%M:%S") }}'
        device_class: timestamp

      frontdoor_lock_log_latest_entry:
        friendly_name: "Front Door Lock Log Latest Entry"
        value_template: '{{ states.sensor.front_door_lock_log.attributes["Value"] }}'
- id: '1598372075449'
  alias: Frontdoor Lock - Get latest record
  description: ''
  trigger:
  - device_id: 03edf5fc73bc4541ad3c06cf0ef7d90c
    domain: lock
    entity_id: lock.zm1702_deadbolt
    platform: device
    type: locked
  - device_id: 03edf5fc73bc4541ad3c06cf0ef7d90c
    domain: lock
    entity_id: lock.zm1702_deadbolt
    platform: device
    type: unlocked
  condition: []
  action:
  - data:
      payload: '{ "node": 13 }'
      topic: OpenZWave/1/command/requestnodedynamic/
    service: mqtt.publish
  mode: single

Now, I have to figure out why the record is incorrect.
The lock was LOCKED by Z-Wave, not UNLOCKED…