🔥 Advanced Heating Control

Oh, did not know that.
Though the UI actually interprets it directly as -8000, both in the ZigBee2MQTT interface and HA entities.

I’m struggling with the same- haven’t been able to solve (3.3.7).

As soon as calibration is invoked the temp reading of the thermotat (TZE200_p3dbf6qs) goes haywire, flipping from +47 deg to 0 deg in a matter of a short time with the HVAC either pumping at highest level or turning off.

I have tried to toggle Full Rounding, Timeout time, Delta to no avail. I simply can’t figure out what I am missing. Frustrating. Anyone with advice?

A trace log after setting such big temperature values would be great. But I don’t think it has something to do with that blueprint. Maybe it fights with some internal scheduling or so.
If the automation sets such values it will get logged. Can you reproduce that behavior?

I’m a little new to HA- can you guide me a little more as to what you need. The behviour reproduces as soon as i define an external temp sensor…

Just for testing:

  1. Navigate to your devices

  2. filter for your thermostat

  3. find and select the calibration entity

  4. manually change the value and observe the temperature of your thermostat

  5. Could you also click on the little gear in the dialog of the calibration entity and copy the entity_id.

  6. navigate to developer tools

  7. paste the entity_id in the filter entity text field

  8. take a screenshot of all attributes and share it with me

//EDIT: Do you use wifi,z2m or zha?

Reg 4: the temperature will change according to the changed value. Expected behaviour.

Reg 6-8. Can’t find a “filter entity” in developer tools?

ZHA, enabled via Quirk.

Are you still using v3 of the blueprint?

Yes, using v 3.

Could you first enable debugging for the blueprint? Simply add this to logger section in your configuration.yaml:

logger:
  default: warning
  logs:
    blueprints.panhans.heatingcontrol: debug

Then restart home assistant.

Just navigate to your automation, add the external sensor, wait until the false target temperature is set.
Open up the trace view. It’s in the upper right corner on traces. You can navigate through the last traces with the arrows on top.

Make sure you select following trace where this branch is highlighted:

Then click in the upper right corner again (3-dots-menu) and download the trace log.

You can share the content of the file here.

//EDIT: also check the value of the calibration entity, please.

//EDIT: There was asolution for @BishKopt problem. Did you read this? 🔥 Advanced Heating Control - #889 by BishKopt

//EDIT: is your climate wrapped by better thermostat?

i will check this as well. I have kind of a related problem with the calibration with “v4” and valves randomly set to max (30°C).

The Offset works in general if i manually set it to e.g. -2 but it seems the high offset values (-20) of the valve is causing that the thermostat is set to maximum.

With “Calibration Full Rounding” enabled and “Agressive Mode - Range” & “Agressive Mode - Offset” set to 0 at least for now it seems not to overheat anymore with the latest “v4” but calibration value entities are still set to -20.

2024-02-07 15:34:37.759 DEBUG (MainThread) [blueprints.panhans.heatingcontrol] AHC REF CALIBRATION

As soon as this trace is in the log the calibration value is -20 again every time.

1 Like

Could you paste this into your template editor in dev tools. Don’t forget to add your thermostate and your temperature sensor. Please send me the return values on the right:

{% set valves_calibration_common = [ 'climate.YOUR_THERMOSTAT'] %}
{% set input_temperature_sensor = 'sensor.YOUR_TEMP_SENSOR' %}

{% set input_calibration_rounding_full_values = false %}

{% for valve in valves_calibration_common %}

  {% set calibration_entities = device_entities(device_id(valve)) |
                              expand | selectattr('domain','in','number') |
                              selectattr('entity_id', 'search', 'offset|calibration') |
                              map(attribute='entity_id') | list %}

  {% if calibration_entities | count > 0 %}

    {% set calibration_entity = calibration_entities | first %}
    {% set step = state_attr(calibration_entity, 'step') | float %}
    {% set min_calibration_value = state_attr(calibration_entity,'min') | float %}
    {% set max_calibration_value = state_attr(calibration_entity,'max') | float %}
    {% set thermostat_temperature = state_attr(valve, 'current_temperature') | float %}
    {% set calibration_sensor_temperature = states(input_temperature_sensor) | float %}
    {% set offset_old = states(calibration_entity) | float(0) %}
    
    {% set new_calibration_value = calibration_sensor_temperature - (thermostat_temperature - offset_old) %}
    
    {% set new_calibration_value_ext = iif(new_calibration_value > max_calibration_value, max_calibration_value, new_calibration_value) %}
    {% set new_calibration_value_ext = iif(new_calibration_value < min_calibration_value, min_calibration_value, new_calibration_value) %}
    
    {% set round_size = iif('.' in (step | string) and input_calibration_rounding_full_values == false, (step | string).split('.')[1] | length, 0) %}
    
    {% set offset_new = ((new_calibration_value_ext | float(0) / step) | round(0) * step) | round(round_size) %}
    
step: {{ step }}
min_calibration_value: {{ min_calibration_value }}
max_calibration_value: {{ max_calibration_value }}
calibration_sensor_temperature: {{ calibration_sensor_temperature }}
new_calibration_value: {{ new_calibration_value }}
new_calibration_value_ext: {{ new_calibration_value_ext }}
offset_old: {{ offset_old }}
offset_new: {{ offset_new }}

  {% endif %}

{% endfor %}

i am using generic_thermostat it is closing and not opening again or dont changing temp . now temp must be 22

image
image

First enter this in template editor and post the return value on the right. (Add your comfort temp entity)

{% set input_temperature_comfort = 'input_number.YOUR_COMFORT_ENTITY' %}
{{ states.input_number[input_temperature_comfort.split('.')[1]].last_changed }}
{{ now() }}

What happens if you trigger the automation manually?

I did an update to the blueprint. At the end there is an dropdown for log level. Select log level warning, trigger the automation. Wait until a new entry in your logs pops up and share the trace log with me.

here is the result

step: 0.1
min_calibration_value: -2.5
max_calibration_value: 2.5
calibration_sensor_temperature: 20.8
new_calibration_value: -3.8999999999999986
new_calibration_value_ext: -2.5
offset_old: -2.0
offset_new: -2.5

hmm maybe the -20 i see in the calibration entity is original 2.0 and the -25 is -2.5. Float to int conversion error of the offset value :thinking:

only opened windows no manuel trigger

The min and max doesn’t fit to screenshot you send. In the screenshot the range is set to -6 till 6°C

I’ve added the calibration entity. Just try again.
But I cast the value again to float. Maybe you try the latest version first.

{% set valves_calibration_common = [ 'climate.YOUR_THERMOSTAT'] %}
{% set input_temperature_sensor = 'sensor.YOUR_TEMP_SENSOR' %}

{% set input_calibration_rounding_full_values = false %}

{% for valve in valves_calibration_common %}

  {% set calibration_entities = device_entities(device_id(valve)) |
                              expand | selectattr('domain','in','number') |
                              selectattr('entity_id', 'search', 'offset|calibration') |
                              map(attribute='entity_id') | list %}

  {% if calibration_entities | count > 0 %}

    {% set calibration_entity = calibration_entities | first %}
    {% set step = state_attr(calibration_entity, 'step') | float %}
    {% set min_calibration_value = state_attr(calibration_entity,'min') | float %}
    {% set max_calibration_value = state_attr(calibration_entity,'max') | float %}
    {% set thermostat_temperature = state_attr(valve, 'current_temperature') | float %}
    {% set calibration_sensor_temperature = states(input_temperature_sensor) | float %}
    {% set offset_old = states(calibration_entity) | float(0) %}
    
    {% set new_calibration_value = calibration_sensor_temperature - (thermostat_temperature - offset_old) %}
    
    {% set new_calibration_value_ext = iif(new_calibration_value > max_calibration_value, max_calibration_value, new_calibration_value) %}
    {% set new_calibration_value_ext = iif(new_calibration_value < min_calibration_value, min_calibration_value, new_calibration_value) %}
    
    {% set round_size = iif('.' in (step | string) and input_calibration_rounding_full_values == false, (step | string).split('.')[1] | length, 0) %}
    
    {% set offset_new = ((new_calibration_value_ext | float(0) / step) | round(0) * step) | round(round_size) %}
    
step: {{ step }}
min_calibration_value: {{ min_calibration_value }}
max_calibration_value: {{ max_calibration_value }}
calibration_sensor_temperature: {{ calibration_sensor_temperature }}
new_calibration_value: {{ new_calibration_value }}
new_calibration_value_ext: {{ new_calibration_value_ext }}
offset_old: {{ offset_old }}
offset_new: {{ offset_new }}
calibration_entity: {{ calibration_entity }}

  {% endif %}

{% endfor %}

//EDIT: what’s irritating me is the old value is -2.0. Its the value directly of this calibration entity. But why the graph says -20?

Seems to me there is something wrong with the quirk. Is this also a TZE200_p3dbf6qs? I’ve read it has many problems in ZHA not in Z2M. For ZHA there is a qustom quirk.

Step size also is 1 and min and max is 2.5. that doesn’t fit together

I think with this config only integrr from -2 to 2 are possible. Will add this in code.

Done → 53e5548a - advanced heating tace

image

Thanks, i just updated to the latest v4 version with the debug switch at the end. I’ll wait now how it behaves.

Sorry the graph above was a older screenshot from earlier today :man_facepalming:

I have _TZE200_h4cgnbzg and _TZE200_yw7cahqs in ZHA with a custom quirk. Yes they have issues, i don’t blame you :wink:

Here is a screenshot with everything at once. There are two “calibration” sliders and it seems the upper one has the strange values (-10 but shown as -6 in the UI).

the lower one is set to the calculated calibration value as shown in the template editor output.

i’m out of ideas but willing to try other things :slight_smile:

That could be the problem! There is a number entity for calibration and one for offset. Didn’ seen begore. The code scans for both. Do you know the difference between them? I would go with offset. So I would drop the scanning for the calibration entity.

//EDIT:

I’ve deleted the scanning for a calibration entity. Just reimport the latest blueprint and reload your automation, please.

I don’t feel blamed. It’s just a little frustrating because so many manufacturers don’t give a shit about the zigbee standard.

Same problem like @k-dani . I pushed an update to the current v4 branch.

Your thermostat provides a calibration and an offset entity. Don’t know about the differences.

The automation now prefers the offset entity. If no is given it looks for a calibration entity.

I am waiting for @k-dani’s feedback. If this solves the problem I prepare the blueprint to go final and replace v3 with it.

But for current v4 users there will be some breaking changes because I will reorder and change some selectors in blueprint settings to make it more user friendly and structured.