Automation Send Thermostat Setpoint to boiler

Happy New year @everybody,
Iam trying to automate the set point on my boiler but now I am stuck.

I integrated the Vissman API via HACS and can set the target temperature. Fine.

hvac_modes:
  - "off"
  - auto
min_temp: 3
max_temp: 37
target_temp_step: 1
preset_modes:
  - comfort
  - eco
  - home
  - sleep
current_temperature: 32
temperature: 20
hvac_action: idle
preset_mode: home
vicare_programs:
  - comfort
  - eco
  - forcedLastFromSchedule
  - normal
  - reduced
  - reducedEnergySaving
  - standby
friendly_name: E3_Vitodens_200_0821 Heizung
supported_features: 401
active_vicare_program: normal
active_vicare_mode: heating
heating_curve_slope: 0.8
heating_curve_shift: 9
vicare_modes:
  - heating
  - standby

The temperature Value is what I am after.
I managed to calculate the temperature setpoint from all my Thermostats by creating a helper Sensor fot the Setpoint like so

  - sensor:
    - name: KĂźche Thermostat SET Temperature
      unique_id: kuche_settemperature
      state: "{{ state_attr('climate.kuche_thermostat', 'temperature') }}"  
  - sensor:
    - name: Atelier Thermostat SET Temperature
      unique_id: atelier_settemperature
      state: "{{ state_attr('climate.gastezimmer_thermostat', 'temperature') }}"
  - sensor:
    - name: Badezimmer Thermostat SET Temperature
      unique_id: badezimmer_settemperature
      state: "{{ state_attr('climate.badezimmer_thermostat' 'temperature') }}"  
  - sensor:
    - name: EG Flur Thermostat SET Temperature
      unique_id: eg_flur_settemperature
      state: "{{ state_attr('climate.eg_flur_thermostat', 'temperature') }}"
  - sensor:
    - name: Gäste WG Thermostat SET Temperature
      unique_id: gaste_wc_settemperature
      state: "{{ state_attr('climate.gaste_wc_thermostat', 'temperature') }}"  
  - sensor:
    - name: Jurij Thermostat SET Temperature
      unique_id: jurij_settemperature
      state: "{{ state_attr('climate.hm_tc_it_wm_w_eu_neq0935537', 'temperature') }}"
  - sensor:
    - name: Schlafzimmer Thermostat SET Temperature
      unique_id: shclafzimmer_settemperature
      state: "{{ state_attr('climate.schlafzimmer_thermostat', 'temperature') }}"
  - sensor:
    - name: Wohnzimmer Thermostat SET Temperature
      unique_id: wohnzimemer_settemperature
      state: "{{ state_attr('climate.wohnzimmer_thermostat', 'temperature') }}"

Than summarize them to get the highes Value round up to thenxt full digit by using a statiscs helper add all my Createrd sensors, set accuracy to full dezimal only.
It shows the correct value. Looks fine to me.

Now I try to setup an automation (in the gui, because I am not good in Programming Syntax)
Trigger any change of the Statistics Helper (that works)
But I can’t figure out how to pass the value of this helper to my target device.
I even managed to setup a variable, but I can enter only numbers into the Value filed within the gui.
Also the state of my Statistics helper looks far from what I expected.


I expected to only get the 23 out of it, not all that ither stuff.

Here is the yaml code of the automation I tried to build in the gui.

alias: Temperatur Anforderung Heizung
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.temperatur_anforderung
conditions: []
actions:
  - variables:
      setpoint: |
        {{ state_attr('sensor.temperatur_anforderung', 'temperature')}}
    enabled: true
  - device_id: 6b5f511f8c041d27edcbf37ea68691db
    domain: number
    entity_id: aa7c2c9b93df203f3e5361369419b2bf
    type: set_value
    value: 20
mode: single

As soon as I try to add something like {{setpoint}} instead of the 20 at value, I get an error.
Or even the full state_attr line, I also get an error.
Message malformed: expected float for dictionary value @ data[‘value’]
I googled for it but can’t figure out what it means.
Also it is very confusing that there are other automations that look totally different they have an extra line data: and than a sub point of value:
I assume this is some old stuff but as I found a lot of it, it really confuses me.

I use HA 2024.12.5 on HAOS 14.1 in a Proxmox KVM.

Any Help would be much appreciated.

Hi, You are showing a sensor, typlically they do not allow input. Is the original entity a climate entity? If so, then you should use a service/action to set it: climate.set_temperature. It will allow templates.

If not: It seems there also is a device action you are trying. device actions often do not allow for templating. If that device action is the only means, then you are out of luck. But most self-respecting integrations should also provide services to do the same, and these always do support templates. So look if the integration you use also provides a service (called action nowadays, but it is the same thing).

If there is not, the only thing I can think of is a big choose with the most common setpoints hardcoded.

Well the boiller ist not a sensor, it is categorized as a heating system and that is what I have selected in the GUI while creating the automation.
Here is screenshot of the state


The rest is the code I have posted already.
I can manually set the target temperature from my Dashboard. That all works as expected.
I am not sure why the Automation GUI turns this

Into these GUID like device IDs.

device_id: 6b5f511f8c041d27edcbf37ea68691db
entity_id: aa7c2c9b93df203f3e5361369419b2bf

@Edwin_D I double checked and changed the action to a heating device
It now looks like

  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: 19
    target:
      device_id: 6b5f511f8c041d27edcbf37ea68691db

But still the same problem, I can not pass the variable, I have to enter a fixed number in the gui and if I change to like temperature: {{ setpoint }} in the YAML, it doesn’t work either. It is changed to

  - action: climate.set_temperature
    metadata: {}
    data:
      temperature:
        "[object Object]": null
    target:
      device_id: 6b5f511f8c041d27edcbf37ea68691db

This does indeed show that templates are allowed, but that your template is passing the wrong thing. Most likely the entity itself and not the state.

You do not show the template, but lets say you now have:

"{{ states.input_number.my_temp }}"

Then it should be:

"{{ states('input_number.my_temp') | float(0) }}"

If it is anything else, show what you use. Best to show the whole automation if you declare variables. You say you use {{ setpoint }} but you do not tell where and how setpoint is defined.

Good morning @Edwin_D, thank you for taking care of my problem.
The Sensor template was in my first post.

This is combined by a the statstiks sensor (I don’t know how to wexport yaml)


Seems to work as in this case 20 is the number I want to hand over to my boiler.

Why don’t I get just the number 20 in my Automation if I tell it to use result of sensor.temperatur_anforderung ?

From my basic knowledge in programming it should be just fine as an integer variable, which I assume is the same as number in HA world?

The entity is an object, and its state is always a string. Entities with a unit of measurement are assumed to be numerical, so can be converted to float or int, assuming they are not unavailable or unknown.

So as I hinted before, this should work:

"{{ states('sensor.temperatur_anforderung') | float(0) }}"

You can test any template in the developer tools.

Thank you once again.
I now figured out that I also need to add round(0) 2 get 2 digits only, eventhough the statistics helper already displays this value.

{{ states('sensor.temperatur_anforderung') | float(0) | round(0)}}

That gives me the correct output in the template testing.
But I still can not make the automation running. I assumed I could just use this state as the input for my set point.

Here is the code but I can not even save it.

alias: Temperatur Anforderung Heizung
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.temperatur_anforderung
conditions: []
actions:
  - device_id: 6b5f511f8c041d27edcbf37ea68691db
    domain: number
    entity_id: aa7c2c9b93df203f3e5361369419b2bf
    type: set_value
    value:  {{ states('sensor.temperatur_anforderung') | float(0) | round(0)}}
    enabled: true
mode: single

It still says: Message malformed: expected float for dictionary value @ data[‘value’]
I have absoultely no clue what that means. My assumption was, that we aready convert this to float.
When using the heat module:

alias: Temperatur Anforderung Heizung
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.temperatur_anforderung
conditions: []
actions:
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature:
        {{ states('sensor.temperatur_anforderung') | float(0) | round(0)}}
    target:
      device_id: 6b5f511f8c041d27edcbf37ea68691db
mode: single

I can save the automation but on execution, I get the same error: Message malformed: expected float for dictionary value @ data[‘value’]

When re-opening the automation it has changed to:

alias: Temperatur Anforderung Heizung
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.temperatur_anforderung
conditions: []
actions:
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature:
        "[object Object]": null
    target:
      device_id: 6b5f511f8c041d27edcbf37ea68691db
mode: single

When the template is on the same line as the tag then it needs quotes, because { means something for yaml too:

    value: "{{ states('sensor.temperatur_anforderung') | float(0) | round(0)}}"

And then, a little further:

When you put it on a new line, you need a multiline indicator (because… starting a new line means something in yaml too :slight_smile: ):

      temperature: >
        {{ states('sensor.temperatur_anforderung') | float(0) | round(0)}}

Well even with the quotes it says the same error on saving:

alias: Temperatur Anforderung Heizung
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.temperatur_anforderung
conditions: []
actions:
  - device_id: 6b5f511f8c041d27edcbf37ea68691db
    domain: number
    entity_id: aa7c2c9b93df203f3e5361369419b2bf
    type: set_value
    value: "{{ states('sensor.temperatur_anforderung') | float(0) | round(0)}}"
    enabled: true
mode: single

Error: expected float for dictionary value @ data[‘temperature’]

When using the heat integration:

alias: Temperatur Anforderung Heizung
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.temperatur_anforderung
conditions: []
actions:
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: "{{ states('sensor.temperatur_anforderung') | float(0) | round(0)}}"
    target:
      device_id: 6b5f511f8c041d27edcbf37ea68691db
mode: single

It now at least gives me an error message back from the ViCare integration.
Error: (PyViCareCommandError(…), ‘Command failed with status code 400. Reason given was: COMMAND_NOT_FOUND’)
I will start investigating that.

“Expected float” suggests that round makes it an int, so after rounding maybe cast to float again. The vicare integration throwing an error (even with a float) may suggest the integration does not support it. Can you change the setpoint from the UI? if that works, the service should work too.

“Expected float” suggests that round makes it an int, so after rounding maybe cast to float again.

That worked, the automation now passes the value.
Also the error message is gone from vicare, so Iguess we were passing a value like 23.0 and it only accepts the 2 digit value.
Shouldn’t just swapping round(0) and float (0) also give us the same result as float(0)|round(0)|float(0) ?

I’m using this now:

alias: Temperatur Anforderung Heizung
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.temperatur_anforderung
conditions: []
actions:
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: "{{ states('sensor.temperatur_anforderung') | float(0) | round(0) |  float(0)}}"
    target:
      device_id: 6b5f511f8c041d27edcbf37ea68691db
mode: single

Anyway, many thanks for your help @Edwin_D !
Now I finally can get rid of my old ioBroker.

1 Like

Not sure, but as said: you can check templates in developer tools to see if they work.