D-Link DCH-Z120 Z-wave PIR sensor

When using D-Link Z-wave PIR sensors (dch-z120) with HA, each sensor trigger sends back sensor.*_burglar with value 8. However, they don’t reset to the basic level (and neither the associated binary sensors) despite modifying Customer function to send off report (thus any automation will fail, as the sensor value remains unchanged).

Still, the sensor can be reset to the basic level (254) or other value - see below. When motion sensor triggers, the sensor will change to value 8, then back to 254 so the value 8 can be used for automation when it occurs.

It might also work for other brands. Shell command needs modification case using a password on HA.

  1. automation

     - alias: reset_z_pir
       initial_state: 'on'
       trigger:
         - platform: state
           entity_id: sensor.z_pir_burglar
           to: '8'
         - platform: state
           entity_id: sensor.z_pir_burglar
           to: '3'
       action:
         - service: shell_command.reset_z_pir
    
  2. shell_command:
    reset_z_pir: ‘bash /home/homeassistant/.homeassistant/shell_command/reset_zwave_pir.sh’

  3. reset_zwave_pir.sh
    #! /bin/bash

curl -X POST -d ‘{“state”: “254”}’ http://localhost:8123/api/states/sensor.z_pir_burglar