Zwavejs automation trigger on node event

Hello,

I’ve waited until now to migrate from the old openwave integration to the new zwavejs integration. I’m running home assistant in docker and have installed zwave2mqqt as docker image to. MQTT is disabled using Z-Wave JS websocket server for communication across.

I have several TF016 heatit thermostats that unfortunatly does not report back the state of the relay. Hence I could not calculate how much energy were used. This was solved in the old openwave integration by using automations that were triggered by “zwave.node_event” as each thermostat were on/off associated back to the zwave gateway:

- alias: Ovens on stue
  trigger:
    platform: event
    event_type: zwave.node_event
    event_data:
      entity_id: zwave.stue_thermostat
      basic_level: 255
  action:
    service: homeassistant.turn_on
    entity_id: input_boolean.heating_stue
  id: b2481b651f2d4e22a53dbf787ba61dd9

Now, I need to get the same functionality using zwavejs. I’ve checked the logs which does see the events:

2022-01-06T19:37:52.574Z DRIVER « [Node 005] [REQ] [ApplicationCommand]
                                  └─[BasicCCSet]
                                      target value: 0
2022-01-06T19:37:52.577Z CNTRLR   [Node 005] treating BasicCC::Set as a report
2022-01-06T19:37:52.577Z CNTRLR   [Node 005] [~] [Basic] currentValue: 255 => 0                     [Endpoint 0]


2022-01-06T19:37:07.831Z DRIVER « [Node 005] [REQ] [ApplicationCommand]
                                  └─[BasicCCSet]
                                      target value: 255
2022-01-06T19:37:07.834Z CNTRLR   [Node 005] treating BasicCC::Set as a report
2022-01-06T19:37:07.834Z CNTRLR   [Node 005] [~] [Basic] currentValue: 0 => 255                     [Endpoint 0]

Basically value 255 means that the realy is on, and 0 means off. All good except I cant figure out how to receive this back in Home Assistant. I’ve tried listening for events: “zwave_js_notification”, “zwave_js_value_notification” og " zwave_js_value_updated" without any results.

Anyone that have experience with similar that can point me in the right direction?

Thanks!

The device is not configured to emit an event for Basic Set, so none of the HA events will be triggered.

Check the Device page in HA for disabled entities and see if there’s a number entity. If there is, that will correspond to the Basic CC value.

If it’s not there, you will probably have to create an HA issue. If you post a debug dump of the node from z2m or from HA I can tell you if it’s supported or not.

Thank you very much freshcoast!
As you described this information was available from disabled number entities.

Another thing that I was not able to solve with the last version of zwave and using these TF016, devices was to get this state feedback integrated to the climate entity in such way that the climate entity knows and shows its state like other termostats ie ‘idle’ ‘heating’. Maybe this is possible by modifying the configuration file for the zwave device?

It’s doubtful any config file change will help with this thermostat. You can report an issue with HA if the thermostat is not working as you expect. Be sure to attach (not copy and paste) a diagnostic dump, and include a link to the device manual (or attach a copy) if you have one.

The thermostat is working as it should, there are no issues.
What I’m trying to do is more like a feature. As the thermostat does not report back the state of the relay HA does not know if its heating or not, hence the climate unit does not have “idle” “heating” variables as we are used to with other products. The workaround using the number entity gives that information, and perhaps it is possible to update the climate entity to use this as input, then displaying information if its heating or not. It is not big deal at all, simply a nice to have. In example, the snip below ‘Loftsbad’ is one of these TF016 thermostats, you can see it does not say anything about it’s actual state, just that it’s in heating mode. ‘Masterbedroom’ and ’ Trehytte’ are HA generic thermostats using a temp senor and wall plug. As you can see they are stating ‘idle’ and ’ Heating’ and also change color based on this. Also newer version of the Heatit thermostat like the Z-TRM3 does report this info, they also provide energy.
Thanks again for your help!

image

Unfortunately I think it would be hard to make a case to implement special support for this device in the integration. The Basic Set value to indicate the current HVAC action is not a standard and probably specific to this device.

For a Z-Wave thermostat, the integration requires the device to support the Thermostat Operating State Command Class, which indicates the operating state: Idle, Heating, Cooling, etc. Without this, there really is no other standard method to know what the thermostat is currently doing. The Z-TRM3 device is an example of one that implements Thermostat Operating State CC.

Thank you freshcoast,

I agree with that, the best would be a new firmware from the vendor the include this functionality in a proper way. I will try and see if there is a work around for now. If not I’ll leave as is.

Hello,

I did find a workaround. I now have “idle” and “heating” state for all the thermostats, including the heatit TF016 units:
image

Basically the TF016 climate entities does not have the “hvac_action” attribute as they dont know the relay state.
I found a script that sets the attributes of a entity based on other entities. This is off course not the best way. however it does the job:

I use automation to set input_booleans based on the number entities, this is because the number entities change between ‘0’, ‘99’ and ‘255’, don’t know why ‘99’.

## Stue 
- alias: Ovens on stue
  trigger:
    entity_id: number.stue_basic
    platform: numeric_state
    above: '200'
  action:
    service: input_boolean.turn_on
    target:
      entity_id: input_boolean.heating_stue
  id: b2481b651f2d4e22a53dbf787ba61dd9

- alias: Ovens off stue
  trigger:
    entity_id: number.stue_basic
    platform: numeric_state
    below: '10'
  action:
    service: input_boolean.turn_off
    target:
      entity_id: input_boolean.heating_stue
  id: f1f928cac90a4573878d5344a0de716f

The based on the state of the input Booleans I use below automation that rely on the above mentioned python script:

## Heating_stue
- id: set attribute thermostat stue
  alias: 'set attribute thermostat stue'
  trigger:
    platform: state
    entity_id:
      - climate.stue
      - input_boolean.heating_stue
  condition:
    condition: template
    value_template: >-
      {% if state_attr('climate.stue', 'hvac_action') == none %}
         true
      {% elif "input_boolean" in trigger.entity_id %}
         true
      {% else %}
         false
      {% endif %}

  action:
    service: python_script.set_state
    data_template:
      entity_id: 'climate.stue'
      hvac_action: >- 
        {% if is_state('input_boolean.heating_stue', 'on') %}heating{% else %}idle{% endif %}

Hi,

I have 6 Heatit thermostat, but I don’t have number intities. I use ZWAVEJS too. how are these entities created?

In my case the entities were supressed / hidden and I had to activate them in the configuration window.
Maybe you also need to associate the the thermostats with the controller if that is not already done.

What is your thermostat firmware version?

update:
I reconfig my thermostats, than restart HA, and number entities appears. So, I config everything, works fine again my energy meter.

Thx

Hello,

Recently this stopped working. More exactly a while ago the number entity stopped working after a update, however new light entities appeared which proved to have the same functionality (basic report). Now none of these are present anymore. Anyone know how to get work around this?
image