Slowly Increase Climate Temp

For my cottage I set the temp down to 10c when not there, then on the day I head up I turn the heat up to 20 early in the day.
Recently put in a heat pump as main heat, with how it works if the set temp is more then 2 deg higher then the current temp then it kicks the secondary heating on.
Trying to set an automation so I can have it incrementally increase the set temp by 1 deg until it hits 20deg.
I can do the 1 deg increase I am just not sure the best way to have it repeat itself and have it stop at a set point.

Thanks.

something like:
If current_temp is < (heating_target_temp -1)
then set thermostat_target_temp to current_temp +1

so, in config you need:

input_number:
  heating_target_temp:
    name: "Target temperature"
    unit_of_measurement: Ā°C
    min: 10
    max: 23
    #initial: 17
    step: 1
    icon: mdi:thermometer

sensor:
  - name: thermostat current temp
      unique_id: heating_current_temp
      device_class: temperature
      unit_of_measurement: Ā°C
      state: "{{ state_attr('climate.thermostat','current_temperature') }}". ### yours may vary
  - name: thermostat target temp
      unique_id: heating_target_temp
      device_class: temperature
      unit_of_measurement: Ā°C
      state: "{{ state_attr('climate.thermostat','temperature') }}" ### yours may vary

Then your automation will be something like:

automation:
  - alias: heating_climb
    id: "heating_climb"
    description: ''
    mode: queued # ??
    variables: # might not need this
      from: "{{ trigger.from_state.state }}" # might not need this
      to:  "{{ trigger.to_state.state }}" # might not need this
    trigger:
      - platform: state
        entity_id: sensor.heating_current_temp
    condition:
      - condition: template  # might not need this
        value_template: "{{ from != to }}" # might not need this
      - condition: template
        value_template: "{{ states('sensor.thermostat_current_temp == ( states('sensor.thermostat_target_temp  }}" # temp will not increase
      - condition: template
        value_template: "{{ states('sensor.thermostat_current_temp < ( states('sensor.heating_target_temp -1 )   }}" # temp is still below target
    action :
      - service: climate.set_temperature
        data_template:
          temperature: "{{ states('sensor.thermostat_current_temp +1 )  }}"
          entity_id: climate.thermostat

You may need to use |round() or |int() in the templates.

[edit: typos]

Thanks.
I will give it a shot when I go back up in a couple weeksā€¦ Seems my remote access crashed on me last night so I canā€™t try it now.

good luck. pop back here if there are problems.

Giving me indentation error at the Current_temperature part of ā€œstate: ā€œ{{ state_attr(ā€˜climate.thermostatā€™,ā€˜current_temperatureā€™) }}ā€. ### yours may varyā€

yep, my bad. Try this:

sensor:
  - name: thermostat current temp
    unique_id: heating_current_temp
    device_class: temperature
    unit_of_measurement: Ā°C
    state: "{{ state_attr('climate.thermostat','current_temperature') }}". ### yours may vary

  - name: thermostat target temp
    unique_id: heating_target_temp
    device_class: temperature
    unit_of_measurement: Ā°C
    state: "{{ state_attr('climate.thermostat','temperature') }}" ### yours may vary

@jchh Wowā€¦ you really know your automation magic! Perhaps you can help as I have a similar situation.

Iā€™m chasing a nasty problem with my pellet stove and itā€™s driving me absolutely nuts for the past year. The stove will randomly and for no apparent reason turn itself completely off. Iā€™ve replaced all temp sensors, main board, and control board with the help of the vendor support to no avail. I think there is just some shoddy programming in this unit.

Soā€¦ Iā€™m brute force fixing it with HA. The stoveā€™s Tuya based climate entity incorrectly reports the current temp as -4 degrees at all times (more shoddy tuya platform coding) so I built an esphome temp sensor that I put in the same room and that gives me current temp. I can read set temp from the tuya values, and luckily I can turn the stove back on via a Tuya command.

Iā€™d like to create an automation that mimics a thermostat, since I canā€™t use the thermostat entity without a working current temp. Basically I want to turn the stove on when current temp is 5 degrees less than set temp. That means itā€™s failed as the stove normally has a 3 degree ā€œback onā€ differential from its set temp, when itā€™s working correctly. Hereā€™s what I have:



As you can see, itā€™s currently working ok as the temp diff is 68-65.5=2.5 degrees.

My current automation works, but only at a fixed temp. I really want to chase the set temp and turn it on when itā€™s 5 degrees less than set temp (my wife changes it all the time)

id: '1647433044968'
  alias: On Error, Turn wood stove on.
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.house_temperature
    below: 60
  condition: []
  action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
    target:
      entity_id:
      - climate.big_house_wood_pellet_stove
  - service: notify.mobile_app_jeffs_iphone_se
    data:
      message: Wood stove turned on due to Living room <60

This automation will be the basis for controlling the new Esphome firmware I finally flashed in my test bench Tuya MCU unit yesterday once I can solve several problems there. That is a saga in and of itself! Thereā€™s another guy battling the same thing I am so this will all be worth it for both of us.

If interested, that saga is here New Device Definition Request - Wood Pellet Stove with 8 dps Ā· Issue #1104 Ā· rospogrigio/localtuya Ā· GitHub

Thanks and of course Iā€™ll try to help.

You might want to change your trigger to a template (so you can compare sensor.house_temperature with sensor.set_temp).

so, assuming that sensor.set_temp is the correct name, try this for the trigger:

trigger:
  - platform: template
    value_template "{{ states('sensor.house_temperature') +5 <= states('sensor.set_temp') }}"

The problem is that this could trigger every time sensor.house_temperature changes and is also 5 degrees below sensor.set_temp. We can avoid that by adding the condition that the trigger_from state must also be greater than 5 degrees less. soā€¦

trigger:
  - platform: template
    value_template "{{ states('sensor.house_temperature') +5 <= states('sensor.set_temp') }}"
condition:
  - platform: template
    value_template: "{{ trigger.from_state.state +5 > states('sensor.set_temp') }}"

Let me know if that helps :slight_smile:

By the way, I have a Hive controller for my heating (heat and water, no cooling). I still use the Hive hub and Hive integration but am about to dump that and switch entirely to local control (via Z2M).

Even though I am using the (cloud based) Hive integration I control my heating & water 100% within HA and youā€™re welcome to have my package and dashboard that does it. Youā€™d need to customise it for your situation but the logic is all there. My dash looks like thisā€¦

I also have a ā€˜read onlyā€™ single button version of the 4 mode buttons (in a vertical-stack in the top left hand corner to the left of the thermostat) which I use in other dashboards so I can always see what is going on. I rarely have to visit this page, but it is where I have my settings and diagnostics.

The 4 modes are:

  • Off.
  • On. 3 temps set based on whether the house is ā€˜awakeā€™, asleepā€™, I am ā€˜awayā€™ (for a couple of hours) and just adding when I am ā€˜on holidayā€™ (away for days). I press a button at night which puts the house ā€˜asleepā€™ (sets lights to dim if activated by motion, sets the heating, turns off day-only devices etc). ā€˜Awakeā€™ is set by the first motion downstairs after 7am. ā€˜Awayā€™ is set using person.james: not_home but could also be set by zone.home state: 0 (for multiple people).
  • Schedule. 4 possible temp/time windows with a minimum temp for outside those windows. Temp also drops when I am away. Easily adjustable to be less or more windows.
  • Boost. Can set the relative temp increase and the boost time. Not effected by my presence.

Awesome! Templating gives me fits. Iā€™ll give it a try in the AM. Gotta get some sleep now!

let me know!

Ok, now youā€™re getting me excited! That looks exactly like what I need to figure out. My stove also has 4 modes and 2 eco settings. The datapoints that come out of esphome are all there and I can see them, and Iā€™ve mapped them. I just need to figure out how to get them into a useable format so I can control them. The thread I mentioned is where that fun is unfolding.
Thereā€™s another guy whoā€™s done amazing things with his thermostat

Jeff

yes, I took a look at it - very interesting stuff! What time zone are you? Idaho. Got it. PST.

Iā€™m MUCH better on the hardware side if things. Iā€™m a hack programmer at best! Yawnā€¦ :wink:

I donā€™t want to stop you sleeping but wish I had your skills on the hardware side - it looks very impressive.

Me too but us hackers get better with practiceā€¦and age!

I defined this sensor and checked it works in the dev tools template checker and returns a value of 68 which is correct.

 - platform: template
    sensors:
      house_set_temp:
        value_template:  "{{ state_attr('climate.big_house_wood_pellet_stove', 'temperature') }}"

{{ states(ā€˜sensor.house_temperatureā€™) +5 <= states(ā€˜sensor.house_set_tempā€™) }}

gives this in the dev tools template checker:
TypeError: can only concatenate str (not ā€œintā€) to str

Here are the attributes of the pellet stove:

 "home_assistant": {
      "name": "Big house Wood Pellet Stove",
      "entities": [
        {
          "unit_of_measurement": null,
          "state": {
            "entity_id": "climate.big_house_wood_pellet_stove",
            "state": "off",
            "attributes": {
              "hvac_modes": [
                "off",
                "heat"
              ],
              "min_temp": 50,
              "max_temp": 122,
              "target_temp_step": 1.0,
              "current_temperature": -4,
              "temperature": 68,
              "friendly_name": "Big house Wood Pellet Stove",
              "supported_features": 1
            },

Did I mention I DESPISE TEMPLATING? :slight_smile:

yep, sorry - forgot to add the |float() to convert from a string to a real number so you can then add ā€˜5ā€™ to it.

Note I have selected 0 and 99 as the default values. So the automation will go off if the sensors fail for any reason. You can change that if you want.

Try this:

{{ states(ā€˜sensor.house_temperatureā€™)|float(0) +5 <= states(ā€˜sensor.house_set_tempā€™)|float(99) }}

This works

{{ states("sensor.house_temperature")|float(0) +8 <= states("sensor.house_set_temp")|float(99) }}

Looks like 8 is the magic value that turns it TRUE.

Now the Automation

Invalid condition configuration

Unexpected value for condition: ā€˜[{ā€˜platformā€™: ā€˜templateā€™, ā€˜value_templateā€™: ā€œ{{ trigger.from_state.state +5 > states(ā€˜sensor.house_temperatureā€™) }}ā€}]ā€™. Expected and, device, not, numeric_state, or, state, sun, template, time, trigger, zone

ā€¦so the actual temp is currently 8 below the set point?

I think this may be the same problem. try:

ā€œ{{ trigger.from_state.state|float(0) +5 > states(ā€˜sensor.house_temperatureā€™)|float(99) }}ā€

ā€¦sorry for the errors - I am not doing this from my computer where I can check for typos and errors etc.

edit: Actually if +8 works, +5 should also work - you might want to check that.