OpenZWave - What happened to some services like lock.set_usercode?

Thanks for quick responses. I truly appreciate it.

statusreport sensor does not change when I enable/disable the code in the card.
However it does update when I manipulate the lock manually (lock/code unlock/autolock, etc.).

I also checked OZW services ‘ozw.set_usercode’ and ‘ozw.clear_usercode’ from Developers Tools panel and they seems to work fine. I had OZW VNC open and can see codes added and removed when I call these services.

Any other advice?

Sorry to bother so much, but I’m excited to get it to work :slight_smile: and unfortunately don’t have much experience with Home Assistant and OZW - still learning.

Thanks!

Usually if the code isn’t updating it’s because the allow_automations sensor is off. You can toggle it on manually.

allow_automations sensor was off.
Codes started to work when I manually switched the sensor on.
Interesting… Now to find out why it is off :slight_smile:

This doesn’t seem to work when qt-openzwave 1.6 is on another box and is already up and running while HA is rebooting. I’ve implemented this automation instead:

- id: 712a904051494d49824430c4ff93a387
  alias: HA Startup - Set Door Lock Booleans
  trigger:
  - event: start
    platform: homeassistant
  condition: []
  action:
  - condition: state
    entity_id: binary_sensor.ozw_network_status
    state: 'on'
  - data:
      entity_id: input_boolean.allow_automation_execution
    service: input_boolean.turn_on
  - data:
      entity_id: input_boolean.system_ready
    service: input_boolean.turn_on
  - condition: state
    entity_id: binary_sensor.ozw_network_status
    state: 'off'
  - data:
      entity_id: input_boolean.allow_automation_execution
    service: input_boolean.turn_off
  - data:
      entity_id: input_boolean.system_ready
    service: input_boolean.turn_off
  initial_state: true
  mode: single

Plus I have this automation:

  alias: OpenZwave State Changed
  description: ''
  trigger:
  - entity_id: binary_sensor.ozw_network_status
    platform: state
  condition: []
  action:
  - condition: state
    entity_id: binary_sensor.ozw_network_status
    state: 'on'
  - entity_id: input_boolean.allow_automation_execution
    service: input_boolean.turn_on
  - entity_id: input_boolean.system_ready
    service: input_boolean.turn_on
  - condition: state
    entity_id: binary_sensor.ozw_network_status
    state: 'off'
  - entity_id: input_boolean.allow_automation_execution
    service: input_boolean.turn_off
  - entity_id: input_boolean.system_ready
    service: input_boolean.turn_off
  mode: single

@dbrunt,
thank you for the automation scripts! They have fixed the issue for me.

You were right - my OZW is running in a separate docker container and was up and running when HA was starting up. With your automation scripts ‘allow_automation_execution’ sensor is initialized correctly. I deleted ‘system_cleanup’ and ‘customstartup’ scripts as they are not needed anymore.

Thank you very much for your help @firstof9 and @dbrunt

My allow_automations sensor is off even after using the automations that dbrunt put together recently. I cannot figure out why it does not turn on during startup.

If I manually set it on then my codes changes work. It would be nice to figure out what is causing the disconnect.

If you’re using OZW, make sure you have the following binary sensor in your configuration.yaml
Don’t forget to reboot HA after adding it).

binary_sensor:
  - platform: mqtt
    name: ozw_network_status
    state_topic: OpenZWave/1/status/
    value_template: >
      {{ "ON" if value_json.Status in ["driverAwakeNodesQueried", "driverAllNodesQueriedSomeDead", "driverAllNodesQueried"] else "OFF" }}
    json_attributes_topic: OpenZWave/1/status/
    device_class: "connectivity"

Credit to steve28 and @freshcoast for the snippet.

1 Like

I do have that sensor configured along with the other two required.

- platform: template
  sensors:
    allow_automation:
      friendly_name: "Allow Automation"
      value_template: "{{ is_state('input_boolean.allow_automation_execution', 'on') }}"

- platform: template
  sensors:        
    system_ready:
      friendly_name: "System ready"
      value_template: "{{ is_state('input_boolean.system_ready', 'on') }}"
      device_class: moving    

- platform: mqtt
  name: ozw_network_status
  state_topic: OpenZWave/1/status/
  value_template: >
    {{ "ON" if value_json.Status in ["driverAwakeNodesQueried", "driverAllNodesQueriedSomeDead", "driverAllNodesQueried"] else "OFF" }}
  json_attributes_topic: OpenZWave/1/status/
  device_class: "connectivity"   

What is the value of binary_sensor.ozw_network_status after HA reboot?

The status shows as it is connected (on).

This is what I have in my configuration.yaml

input_boolean:
  allow_automation_execution:
    name: 'Allow Automation'
    initial: off
  system_ready:
    name: 'System Ready'
    initial: off

binary_sensor:
  - platform: mqtt
    name: ozw_network_status
    state_topic: OpenZWave/1/status/
    value_template: >
      {{ "ON" if value_json.Status in ["driverAwakeNodesQueried", "driverAllNodesQueriedSomeDead", "driverAllNodesQueried"] else "OFF" }}
    json_attributes_topic: OpenZWave/1/status/
    device_class: "connectivity"
    
  - platform: template
    sensors:
      allow_automation:
        friendly_name: "Allow Automation"
        value_template: "{{ is_state('input_boolean.allow_automation_execution', 'on') }}"
      system_ready:
        friendly_name: "System ready"
        value_template: "{{ is_state('input_boolean.system_ready', 'on') }}"
        device_class: moving

in automations.yaml

- id: ha_startup_autom
  alias: HA Startup - Set Door Lock Booleans
  trigger:
  - event: start
    platform: homeassistant
  condition: []
  action:
  - condition: state
    entity_id: binary_sensor.ozw_network_status
    state: 'on'
  - data:
      entity_id: input_boolean.allow_automation_execution
    service: input_boolean.turn_on
  - data:
      entity_id: input_boolean.system_ready
    service: input_boolean.turn_on
  - condition: state
    entity_id: binary_sensor.ozw_network_status
    state: 'off'
  - data:
      entity_id: input_boolean.allow_automation_execution
    service: input_boolean.turn_off
  - data:
      entity_id: input_boolean.system_ready
    service: input_boolean.turn_off
  initial_state: true
  mode: single

- id: ozw_status_changed_autom
  alias: OpenZwave State Changed
  description: ''
  trigger:
  - entity_id: binary_sensor.ozw_network_status
    platform: state
  condition: []
  action:
  - condition: state
    entity_id: binary_sensor.ozw_network_status
    state: 'on'
  - entity_id: input_boolean.allow_automation_execution
    service: input_boolean.turn_on
  - entity_id: input_boolean.system_ready
    service: input_boolean.turn_on
  - condition: state
    entity_id: binary_sensor.ozw_network_status
    state: 'off'
  - entity_id: input_boolean.allow_automation_execution
    service: input_boolean.turn_off
  - entity_id: input_boolean.system_ready
    service: input_boolean.turn_off
  mode: single

@phdelmac: Have you removed the original automation & startup scripts that turn them off?

I have done this.

My automations and sensors match yours

I found my issue. My input booleans were never being created because I had commented out the include for boolean inputs in my configuration.yaml. Thanks for the help on this!

Glad to be of assistance!
I had a similar error once… !include sensors.yaml but the file I was editing was sensors,yaml

Would love to see a feature where we get confirmation from the Zwave stack that the code has been added. From what I have seen in the stack the locks do report this.