Retrieving zwave config parameter into sensor

Use Case: I have a zwave thermostat, one of its parameters sets the backlight level 0-3. Whenever the heat is on, I’d like to turn the backlight on, when the heat goes off turn the backlight off. I also want to animate my dashboard when the backlight is on.
The ideal implementation would be with a switch template I know I can use the ZWAVE_JS.SET_CONFIG_PARAMETER service to set the parameter.

How do I read the current value of the config parameter into a sensor entity?

Anyone know if this is possible?

1. Trigger-based template sensor with Z-Wave Value

Create a trigger-based sensor using the zwave_js.value_updated platform trigger.

The Device diagnostic (Device page → … → Download diagnostic) will show you the necessary fields to trigger off for the desired config parameter.

You will probably want to manually refresh the config param value on HA startup, otherwise the template won’t trigger. This can be done with the zwave_js.invoke_cc_api calling the Config CC “get” method.

2. Trigger-based template sensor intercepting service call

Like above, create a trigger-based sensor, triggering off the call_service event. You can check whether the event is the zwave_js.set_config_parameter service call, and set the template value appropriately base on the service parameters. The downside is that this doesn’t necessarily reflect reality of the device, e.g. some error during Set occurred.

3. MQTT template sensor

If you have MQTT already, switch to Z-Wave JS UI (it not already using it), enable MQTT (but not HASS discovery) in Z-Wave JS UI, and create an MQTT template sensor based on the config parameter topic.

4. Input Boolean

Use a script/automation to set your backlight. In the same script/automation, modify an input_boolean based on the backlight setting. Use the input_boolean in your dashboard. Similar to example 2.

1 Like

Thank you, 1+3 seem like the best as I want it to reflect what the device thinks it is, vs tracking what it was set to.

I’ll work on putting together a number template as a working example.

Here is a full example of how to create a number entity for a zwave config parameter.

Using the “idle brightness” configuration parameters for the Honeywell T6 Pro thermostat as an example:

Step 1 - Get the zwave device diagnostics for the device and find the property you want.

      {
        "id": "18-112-0-39",
        "nodeId": 18,
        "commandClass": 112,
        "commandClassName": "Configuration",
        "endpoint": 0,
        "property": 39,
        "propertyName": "Idle Brightness",
        "type": "number",
        "readable": true,
        "writeable": true,
        "label": "Idle Brightness",
        "default": 0,
        "stateless": false,
        "commandClassVersion": 4,
        "min": 0,
        "max": 5,
        "list": false,
        "lastUpdate": 1662215115053
      },

Step 2 - Create the following package file

template:
  - trigger:
      - platform: zwave_js.value_updated
        entity_id:
          - climate.upstairs_thermostat
        command_class: 112
        property: 39
    sensor:
      - name: "upstairs_thermostat_idle_brightness"
        state: "{{ trigger.current_value }} "

  - number:
      - name: "upstairs_thermostat_idle_brightness"
        state: '{{ states("sensor.upstairs_thermostat_idle_brightness") }}'
        step: 1
        min: 0
        max: 5
        set_value:
          service: zwave_js.set_config_parameter
          data_template:
            entity_id: climate.upstairs_thermostat
            parameter: 39
            value: "{{ value }}"

Note, you may need to perform a manual refresh of config from zwave_js ui the first time. On subsequent startups it retains the old value. If you are concerned about the value being changed while HASS is down, then you should poll as @freshcoast describes above.

In process of replicating this using shell scripts and automating generation from the device diagnostic file.

3 Likes