Generic Thermostat Trigger event when switching to heat?

I’m very new to HA! I’m using the generic thermostat. I want to trap the event when I turn my thermostat on and off.

This ‘trigger’ (when I turn it off) registers:

  • platform: state
    entity_id:
    • climate.upstairs_north_boost
      to: “off”
      id: upstairs_north_boost_off

However this reciprocal ‘trigger’ when switching from off to on (heat) sees nothing.

  • platform: state
    entity_id:
    • climate.upstairs_north_boost
      to: heat
      id: upstairs_north_boost_heat

How can I trap the off to on event? Or is this a bug?

I’m not familiar with the specific setup, but I notice that you put "off" in quotes, but didn’t do so for heat. I’m unsure which way is correct though. Also, are you sure that the state is named heat? And, in my case the state is available in the state attribute named hvac_action. Did you try checking the climate entity in the developer tools (in the left menu bar) → states and see what it outputs? Maybe you need something like the following instead?

platform: state
entity_id:
  - climate.upstairs_north_boost
attribute: hvac_action
to: heating
1 Like

I found my issue. I was also doing earlier on with a previous action:

service: climate.set_hvac_mode
data:
  hvac_mode: heat
target:
  entity_id: climate.upstairs_north_boost

which weirdly didn’t turn on the thermostat but did mean that when I did turn it on for real it seems there wasn’t an event to get trapped. It was already at heat. It wasn’t going “to” heat so to speak. I think reading the documentation that setting hvac_mode to heat should also turn on the generic thermostat but it doesn’t. It’s actually necessary to do:

service: climate.turn_on
target:
  entity_id: climate.upstairs_north_boost

But I had left the climate.set_hvac_mode still in from earlier. When I took that out, it worked correctly. I think it is a bit of a bug.

As for the "off" (with quotes) vs heat (without quotes), according to the documentation that is correct. I’m still at the stage where I use the Automation visual editor to get the bulk of my code before tweaking here and there with bits of template code and those two settings are how the Visual editor put in in. It works.