Control my heating pump with a temp sensor

Ah ok then I get it! But when I do create that Generic Thermostat, shouldnt my Thermostat Card have a new entity? The one I just created for me to choose? I still only see the original one. Am I doing something wrong?

Do you see your new thermostat in developer tools - states? Did you try adding “Thermostat” card in your dashboard and configure that new climate entity in it?

Hm, no its not there! I made a folder “climate” in config. In that folder I created “generic_thermostat.yaml” and in that file I did this code:

  • platform: generic_thermostat
    name: test_ny
    heater: switch.värmestyrning
    target_sensor: sensor.kok_temperature
    min_temp: 7
    max_temp: 35
    ac_mode: false
    target_temp: 22
    cold_tolerance: 0.5
    hot_tolerance: 0
    initial_hvac_mode: “off”
    away_temp: 20
    precision: 0.1

Is something wrong there maybe?

Hm I dont see this line “climate” in my configuration.yaml ! is that the problem?

Climate is in configuration.yaml and refers to separate file (usually climate.yaml in the same root folder where configuration.yaml is). See my note above.

If that’s the case, just put your config in that file. Or if it is not, just create that reference, or just put your whole code in the configuration.yaml

So either put this in configuration.yaml:

climate:
 - platform: generic_thermostat
   name: test_ny
   heater: switch.värmestyrning
   target_sensor: sensor.kok_temperature
   min_temp: 7
   max_temp: 35
   ac_mode: false
   target_temp: 22
   cold_tolerance: 0.5
   hot_tolerance: 0
   initial_hvac_mode: “off”
   away_temp: 20
   precision: 0.1

or make a reference in configuration.yaml to look for climate configuration elswhere:

climate: !include climate.yaml

and create file climate.yaml in the same root folder where configuration.yaml is. That file will contain then:

- platform: generic_thermostat
  name: test_ny
  heater: switch.värmestyrning
  target_sensor: sensor.kok_temperature
  min_temp: 7
  max_temp: 35
  ac_mode: false
  target_temp: 22
  cold_tolerance: 0.5
  hot_tolerance: 0
  initial_hvac_mode: “off”
  away_temp: 20
  precision: 0.1

Don’t forget to check configuration and reload core (in server controls) after you add it.

PS: I would not name your file generic_thermostat as there could be other climate components later, not just generic thermostat. And I would definitely not put it in additional folder, no reason to do that at all.

2 Likes

Ah right! Now it working :slight_smile: Thanks. Ok that sounds like a plan to name if to something more unique?
Oh and also the system didnt like my Å Ä Ö :stuck_out_tongue:

Ok so now I have the new Thermostat, now to go for the switch!.. but btw… since I now have 2… wich one is the one who is controlling the pump?

edit: btw if I dont name the platform “generic_thermostat” I get an error!

About the Switch, I tried use the Automations in HA. There I could easy choose triggers, conditions and actions. But about actions, this is where I want it to lower/raise the set temperature right?
If I select Device > my pump I have 2 actions to choose from, “change HVAC mode on Daikin” and “change preset on Daikin” … tried here to add your code:
turn_off:
service: climate.set_temperature
target:
entity_id: climate.heat_pump
data:
temperature: 15

but that didnt work.

The idea isn’t to use an automation. The generic thermostat controls it.

Right, think I starting to get this now…

But how do I link the Generic Thermostat with the switch?
In your example above do the entity_id in the switch be the “name” of the Generic Thermostat?

Oh and what I dont want is the pump to completely shut off (a process that takes some minutes) each time the temperature is reached.
And the idea you had with the lowering of the setpoint instead of shutting off made me think…

Lets say my Target Sensor in my kitchen is 22 degrees and I put the temperature on my pump to 23 degrees. It will then start heat towards 23 degrees right? And when it reaches 23 degrees the Generic Thermostat activates the “off” mode, but since we use that switch-code you had instead of “totally off” it instead changes the set temperature to 15 degrees. That way the pump will slow down and not heat… but still on and ready when its needed again.
But then the set temp is at 15 degrees right? But when the pump is not heating the target sensor in kitchen will slowly get colder… and lets say I want it to turn on again (here I use the Cold_Tolerance right?) and start heating when the temperature falls 1 degrees… how do I do that when the target sensor is 15 degrees? So it wont heat until the Temperature is 14 right? Not so good :slight_smile: Hm… or am I missing something here?

I guess one solution is to use the ON/OFF function, but to work with Cold/Hot Tolerance, right?
Because the “Target Temperature” is what temp I set on the wheel, right?
So if I use the heating-mode and set the Cold_Tolerance to 1 the pump will turn on again when the temperature in my target_sensor / kitchen goes below 1 degrees from the target temp?

Why not use this?
https://community.home-assistant.io/t/target-temperature-adjustment-depending-on-second-temperature-sensor/297287

1 Like

Thanks! Will look into this :slight_smile:

got it work?

Hm not so good… I wanted to try the Switch and Thermostat idea that though crlogic recommended. I had it working but it didnt seem work turn on/off the pump as I wanted.

Used this as switch:

switch:
  - platform: template
    switches:
      heat_pump:
        value_template: "{{ is_state_attr('climate.daikinap42587', 'hvac_action','heating') }}"
        turn_on:
          service: climate.set_temperature
          target:
            entity_id: climate.daikinap42587
          data:
            temperature: 26
        turn_off:
          service: climate.set_temperature
          target:
            entity_id: climate.daikinap42587
          data:
            temperature: 21

And this as Generic Thermostat:

- platform: generic_thermostat
  name: Heatpump
  heater: switch.heat_pump
  target_sensor: sensor.kok_temperature
  min_temp: 7
  max_temp: 35
  ac_mode: false
  target_temp: 23
  cold_tolerance: 0.5
  hot_tolerance: 0
  initial_hvac_mode: "off"
  away_temp: 20
  precision: 0.1

As Crlogic told me I try to move forward slowly. First thing now is to get the switch to work…
And when I use the switch-card here I guess that is the way I manually send ON / OFF signal to the pump? Andinstead of actually turning the pump on / off the codes says to send a set temp. And that works fine! There is some wierd delay on the switch as it turn on/blue… changes the set temp to 26… but then the switch turn grey and goes into off mode. But some sec later the switch changes on on/blue.

But anyway… this is my goal atm. The switch do seem to work with the switch.

Next step is to use the fake Thermostat that is directed towards my temp sensor i the kitchen (in the middle of the house).

I want that one to send the ON / OFF signal instead of the manual switch, right?

And since I guess the switch now work fine, all I now need to be working fine is the Generic Thermostat right?
Here is a picture of the real thermostat, the fake one and the switch.

But how do I do next, do I just turn the Generic Thermostat on and let it work?
As you see in the Thermostat code above the idea is to hold a temp of 23 degrees in my kitchen. If I hold that temp there I know the rest of the house get the heat from the pump (I think this one is something I need to try out more detailed). But do the code look good? I dont want the pump to go on/off too often.
But wont that Cold_Tolerance create a “dead zone” when nothing is happening?
So since my target temp is 23 degrees in the kitchen the pump will heat with 26 degrees until the Generic Thermostat reaches the temp, then it will send OFF to the pump, and that will make the pump change to 21 degrees.
And then I guess the temp in the kitchen will slowly fall… and when the temp there reaches 22.5 (0.5 in cold_tolerance) the generic thermostat will then send ON to the pump and it increases temp to 26.

Is this the way my code works? :smiley: Have I gotten everything right so far?

The switch as I said seem to work. But when I turn the Generic Thermostat on the switch keeps going on and off… and I cant see why! It does that when the temp is above the set temp. It shouldnt behave like that if I understand the code correct. It should only send On when temp is 0.5 below target temp, and then send OFF when it reaches the target temp? What am I missing…
1221

I found a solution! I ditch that Generic Thermostat… didnt seem to work (or at least I didnt understand how it worked with my settings) so I used automation instead ! Worked perfect this night!

I send the set temp when temp falls below / goes above the temp in kitchen instead.

I did try this night and it worked perfect as I said, just as I wanted it to work. The only thing is that it will continue to trigger the automation when in this case the temp is above 23.4 … until it fall below. Since I used a time pattern as trigger every 5 minute to check the temp.
Can that somehow overload my Pi?
Could I instead of that time_pattern trigger use a generic_state as a trigger? So that the automation trigger when the temp goes above 23.4? Or how will that kind of trigger work? Will it then only trigger it once when the “goes above” occurs?
I have one condition that I only want this automation to run between 20:30 and 07:00 … So wont that cause a problem IF the temp is already above 23.4 when the time turns 20:30 ? Then nothing will run that automation that lowers the temp. Hm…

I’ve been thinking about doing something similar my self and as you state heat pumps don’t work very efficient if they are turned on or off, actually works best with a stable temperature.

The problem is that the sensor is up with the pump on the wall and sometimes roomtemp is around 19c og 21c even tho the temp setting on the pump is on lets say 20c…

So, the thing I’m going to try when I get the zigbee temp sensor is to make an automation that triggers every hour and checks the current room temp against a helper integer.
And if room temp > helper, reduce pump temp with -1
if room temp is < helper, increase pump temp with +1.

Hey! Yes compressors doesnt like to be turned on/off and can actually damage them if that happens to frequent. So I didnt want that.
The way I ended up with was 2 automations during night. Been using it now for some time and I actually feel it’s a good way to control it. The temperature in the house feels better since I now have something that automate it based on the temp INSIDE the house and not by the Heat Pump it self.
And I also believe I save quite some energy with it in the long run, but that is something I must measure. But the temperature in the house feels much better. Since all houses have different “thermal inertia” you have to check how fast the temp decrease in your house. And that is based on what material your house is made of and how good it stores the heat. And by logging the temp you can easily see that. When the heat pump turns down and it is cold outside you will very easily see how fast the temp decrese.

And atm I have one automation that increase the set temp and one that decrease the set temp based on the temp in the middle of my house.
And I used Home Assistant built-in Automation for this, very easy!
Triggers once per 5min.
Conditions is the time during night when I want the automation to take control over my heat pump.
And atm I also have a condition based on the outside temp, because when/if the temp goes above some temperature I dont need the heat as much. This one is something I will modify closer to summer, but atm its below 14 degrees outside.
The last condition is the temp in my kitchen that is in the middle of my house.
And here it’s important to have a kind of “dead zone” used then you heat and cool. Without a dead zone the set temp will go bananas and go up/down very often. The dead zone is something you should tweat based on how fast the temp decrease etc. A good tweaked dead zone also saves energy in the long run because you use your houses stored heat better before you use the Heat Pump again.
At the moment I have Below 22.3 degrees in kitchen = set temp 26
And above 23.3 in kitchen = set temp to 23 degrees.
This way I have 1 degree “dead zone”. And I feel so far this is a good setting… but I will probably tweak this as the time goes.

I also have the same automation when the alarm system is activated. That way I know 100% sure none is home and I set the temp alittle lower during day.

Hello,

I like your idea to adjust heat pump settings based on the external temperature sensor. Have you succeeded with creating the automation for this?

BR, Piotr

Yes I did 2 automation for this, one to increase set temp and one to lower!

alias: Kväll 1a | <14 ute & HEAT | <22 i kök = 26°C
description: >-
  Under kväll/natt och temp i kök understiger 22.3 grader och det är under 14
  ute så höjs värmepump till 26 grader
trigger:
  - platform: time_pattern
    minutes: /5
condition:
  - condition: time
    after: '20:30'
    before: '06:00:00'
  - condition: numeric_state
    below: '14'
    entity_id: sensor.daikincaldoxrh30ap42587_outside_temperature
  - condition: numeric_state
    below: '22'
    entity_id: sensor.multisensor_kitchen_temp
  - condition: state
    entity_id: climate.daikincaldoxrh30ap42587
    state: heat
  - condition: state
    entity_id: input_boolean.automatisering_vid_kvall_on_off
    state: 'on'
action:
  - service: climate.set_temperature
    data:
      temperature: 26
      hvac_mode: heat
    target:
      entity_id: climate.daikincaldoxrh30ap42587
  - service: climate.set_fan_mode
    data:
      fan_mode: '3'
    target:
      entity_id: climate.daikincaldoxrh30ap42587
mode: single

So this one checks every 5 minute and if its night & outside temp below 14 & kitchen temp is below 22 degrees & daiking is infact in heat mode already & the on/off switch is ON (if I want to deactivate this of some reason and manually controll the heat) I simply send set temperature to 26. And fan mode 3.

Simple! And then another one for when I want to lower the set temp:

alias: Kväll 1b | <14 ute & HEAT | >23 <24.5 i kök = 22°C
description: >-
  Under kväll/natt och temp i kök överstiger 23.1 grader men under 25 OCH VP är
  i läge Värme OCH det är under 14 ute så sänks värmepump till 22 grader
trigger:
  - platform: time_pattern
    minutes: /5
condition:
  - condition: time
    after: '20:30'
    before: '06:00:00'
  - condition: numeric_state
    below: '14'
    entity_id: sensor.daikincaldoxrh30ap42587_outside_temperature
  - condition: numeric_state
    above: '23'
    entity_id: sensor.multisensor_kitchen_temp
    below: '24.5'
  - condition: state
    entity_id: climate.daikincaldoxrh30ap42587
    state: heat
  - condition: state
    entity_id: input_boolean.automatisering_vid_kvall_on_off
    state: 'on'
action:
  - service: climate.set_temperature
    data:
      temperature: 22
      hvac_mode: heat
    target:
      entity_id: climate.daikincaldoxrh30ap42587
  - service: climate.set_fan_mode
    data:
      fan_mode: '3'
    target:
      entity_id: climate.daikincaldoxrh30ap42587
mode: single

I also did one last automation if the kitchen temp is above 25 degree. I have a fireplace and if I use that the temp in my kitchen will go up and then I set the temp to 20 on the pump. But it takes some hours for the temp to increase so thats why I have this one. Now when I think about it I should probably change this one to activate the fan only mode and no heat!

alias: Kväll 1c | <14 ute & HEAT | >25 i kök = 20°C
description: >-
  Under kväll/natt och temp i kök överstiger 24 grader OCH VP är i läge Värme
  OCH det är under 14 ute så sänks värmepump till 20 grader
trigger:
  - platform: time_pattern
    minutes: /5
condition:
  - condition: time
    after: '20:30'
    before: '06:00:00'
  - condition: numeric_state
    below: '14'
    entity_id: sensor.daikincaldoxrh30ap42587_outside_temperature
  - condition: numeric_state
    above: '25'
    entity_id: sensor.multisensor_kitchen_temp
  - condition: state
    entity_id: climate.daikincaldoxrh30ap42587
    state: heat
  - condition: state
    entity_id: input_boolean.automatisering_vid_kvall_on_off
    state: 'on'
action:
  - service: climate.set_temperature
    data:
      temperature: 20
      hvac_mode: heat
    target:
      entity_id: climate.daikincaldoxrh30ap42587
  - service: climate.set_fan_mode
    data:
      fan_mode: '3'
    target:
      entity_id: climate.daikincaldoxrh30ap42587
mode: single