Slowly Increase Climate Temp

No go:
In ‘template’ condition: UndefinedError: ‘trigger’ is undefined

alias: "Fix wood stove error "
description: ""
trigger:
  - platform: template
    value_template: >-
      {{ states('sensor.house_temperature')|float(0) +8 <=
      states('sensor.house_set_temp')|float(99) }}
condition:
  - condition: template
    value_template: >-
      {{ trigger.from_state.state|float(0) +5 >
      states('sensor.house_temperature')|float(99) }}
action: []
mode: single

So I had to break it up. I defined a sensor

 - platform: template
    sensors:
      stove_error:
        value_template: "{{ states('sensor.house_temperature')|float(0) +5  <= states('sensor.house_set_temp')|float(0) }}"

Then tested that sensor in an automation. I could not find a way to trigger the automation other than when house temp falls below a certain threshold, nor could I use the template sensor in the automation without errors. Then the condition has to be met before it runs.

alias: "Fix wood stove error "
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.house_temperature
    below: 63
condition:
  - condition: state
    entity_id: sensor.stove_error
    state: "True"
action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
    target:
      entity_id: climate.big_house_wood_pellet_stove
  - service: notify.mobile_app_jeffs_128gb_ipad
    data:
      message: >-
        Stove Error. House Temp={{ states('sensor.house_temperature')}}. Set
        temp={{states('sensor.house_set_temp')}}
  - service: notify.mobile_app_jeffs_128gb_ipad
    data:
      message: >-
        Stove Error. House Temp={{ states('sensor.house_temperature')}}. Set
        temp={{states('sensor.house_set_temp')}}
mode: single

Very frustrating. Did I mention I hate templates? I just opened my front door and it does work! It’s 15F here… which is why I had to get this working!

Sorry for all the hassle but glad it is working for you now!

…I am not sure why the condition didn’t work - I’ll look into that.

The trigger I set up fails if the temp doesn’t rise above the trigger temp and then back down past it again, I woke up to a really cold house this am… And to complicate things, the BME280 sometimes doesnt register on the i2e bus… which causes me to change it’s address in the config file before it’s recognized again. very strange.

[07:21:35][C][i2c.arduino:044]:   Recovery: bus successfully recovered
[07:21:35][I][i2c.arduino:054]: Results from i2c bus scan:
[07:21:35][I][i2c.arduino:060]: Found i2c device at address 0x77

Now I need to figure out a reliable trigger.

yes, my logic made the assumption that the temp was high enough to start with - it was basically only triggering as the temp fell down past the 5 degree difference. If it is already below that aren’t you already in trouble?

Another way to do it is to maybe have:
trigger: house_temperature is >=5 degrees below house_set_temp
condition: house_temperature is falling
…this would trigger even if the start point was already more than 5 degrees below the set_point. Would that help?

I sincerely appreciate the help you’ve offered up. I’m going to implement the newly esphome/Tuya MCU flashed control module tomorrow on my main stove, and many of the problems you helped me solve will be incorporated into that.

I have some challenges though. The biggest is that normally the Tuya control app changes the target temp on the stove itself. It’s all self contained in the stove. The Tuya MCU ESPHome code is not bidirectional in the same way. The only control I have is the on/off switch on the stove. Which means the Im going to have to set the set temp value on the stove to a maximum temp I can stand and hope the esphome control sw is reliable in shutting the stove off when the set temp detected by home assistant is reached.

In theory it should work fine. I can read the room temp reliably from the stove and turn it on and off reliably via esphome, at least in my extensive bench tests. Time will tell!

I wish I knew who the programmers are for the Tuya MCU modules in ESPHome. I have LOTS of questions and thoughts on their implementation. Ie, why can the OEM Vendor’s Tuya based control app programatically set the target temp on the stove and ESPHOME cannot? The same with ECO Mode and the P1-P4 power levels. I can read those values set via the front panel of the stove thru Tuya MCU, but there is no way to set them. It’s unidirectional only, and limited by design. I’m not sure why…

Regardless, the frigging stove in my main house shut off no less than 5 times today, again for no reason, and now I can detect it and turn it back on. Happy wife, happy life as they say!

1 Like

Well, its all working - I had to get the ESPHome devs to make a change to the Tuya code for it to work w/ my stove. That was quite the adventure! At least I learned how to use Discord. Cool tool. Some of the folks arent too friendly tho.

Now I’m trying to get the UI to look right… Here’s another head scratcher.

should have posted it here.

someone already answered before I woke up :slight_smile:

They did and it works!

I’m still having problems getting my automation to trigger.

I’ve set up 3 triggers, none of them worked last night as the stove had randomly turned itself off this morning.

alias: "Fix wood stove error "
description: ""
trigger:
  - platform: template
    value_template: >-
      "{{ states('sensor.esph_house_stove_current_temp_2')|float(0) +4  <=
      states('sensor.esph_house_stove_set_temp_2')|float(0) }}
  - platform: numeric_state
    entity_id: sensor.esph_house_stove_current_temp
    below: 63
  - platform: state
    entity_id:
      - sensor.stove_error
    from: "False"
    to: "true"
condition: []
action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
    target:
      entity_id: climate.house_wood_pellet_stove

I can change the state of the error by adjusting the value of set temp. If it’s 4 degrees below current temp, the sensor goes True, but the automation does not trigger

And after I raise the temp to 70 which is current temp + 4

Stove remains off.
If I run the automation manually, the stove turns on.

I’m baffled

why do you have ..._2? Did you change the entity names or are you now looking at the wrong entities?

Also, what does the template show in Dev tools > templates when you chnage the settings?

[edited for typos and clarity]

Somehow esphome created new entities when I renamed the module. But it’s the right sensor

I see why my fallback failsafe didn’t trigger last night.

I’d love to know how to delete all the random unused entities but I haven’t found a way yet…

goto settings > devices & services > entities.

Sort by status (you may need to click twice) but then the unknowns and unavailable will come to the top. Select and delete. You can also rename the new ones (to remove the '_2" there as well).

I suspected this, hence the question.

Im still battling the automation trigger. any ideas?

What does the template show in Dev tools > templates when you change the settings?

It works just as I’d expect it to when I change the thermostat temp.

state test: {{ states('sensor.esph_house_stove_current_temp')
|float(0) +4  < states('sensor.esph_house_stove_set_temp')|float(0)}}

Current: {{states("sensor.esph_house_stove_current_temp")}}

Set: {{states("sensor.esph_house_stove_set_temp")}}

increasing temp to 73:

changes to True, but no trigger…

dumb question, but the automation has been enabled, right?

U Made me look, but yes

I think I’ll start a new topic and put it out there at large. There has to be a simple answer or it’s a bug. What it took to get my stove working w/ esphome was rocket science. This should be easy…