Detect Z-Wave thermostat SetPoint change

How to detect Z-Wave thermostat (DANFOSS 014G0013) SetPoint temperature change? I try with this:

- alias: Salon temp change
   trigger:
     platform: event
     event_type: zwave.node_event
     event_data:
       object_id: climate.salon_thermostat_heating_1_6_1

but no luck.

You can check the state of the thermostat as trigger:

trigger:
  - platform: state
    entity_id: climate.danfoss_z_thermostat_014g0013_heating_1_2_1

I’m pretty sure though, that this will also trigger when the battery level drops.
You could store the setpoint value in a hidden slider control and then compare the thermostat’s current setpoint with the slider value whenever the trigger fires.
If the values differ, the setpoint change was what caused the trigger to fire.
You can then update the slider value and do whatever your automation was supposed to do in the first place.

Sebastian

Something like that is working:

  trigger:
    - platform: state
      entity_id: climate.salon_thermostat_heating_1_6_1
  condition:
    - condition: template
      value_template: >-
         {% if states.climate.salon_thermostat_heating_1_6_1 %}
            {{ trigger.to_state.attributes.temperature != trigger.from_state.attributes.temperature }}
         {% endif %}

but I have in log errors now when HA starts:

17-02-11 13:18:43 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'None' has no attribute 'attributes'
17-02-11 13:18:43 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'None' has no attribute 'attributes'

Ah, cool, I wasn’t aware of the different trigger attributes. That makes things a lot easier.
I think you can ignore the errors - they appear because at the time HA starts and evaluates automations, most of the objects, like state.* and apparently trigger.*, are not completely initialized.
You could add conditions like {% if trigger.to_state %} ... and {% if trigger.from_state %} ... to the automation, but that would make it a lot more complex.

Sebastian

Thanks. I like clean log so I will try tomorrow with {% if trigger.to_state %} and {% if trigger.from_state %}.

With your suggestion @sebk-666

- alias: "Salon Thermostat SetPoint Change"
  trigger:
    - platform: state
      entity_id: climate.salon_thermostat_heating_1_6_1
  condition:
    - condition: template
      value_template: >-
         {% if (trigger.to_state and trigger.from_state) %}
            {{ trigger.to_state.attributes.temperature != trigger.from_state.attributes.temperature }}
         {% endif %}

there is no errors in log and automation is working great. Thanks for help.

2 Likes