🔥 Advanced Heating Control

I have an oven that works with an adjustable hysteresis. However, there were a few problems, which is why I activated this blueprint. I will first check whether the thermostat control on the oven is working properly. If not, I’ll have to call a technician.

I had a look at the logs. I can see the problem: my thermostat apparently disconnected from the WLAN during the night and logged on again in HA. This triggered the blueprint again.


The log is in German

How can I run two schedules? These schedules should run 1 week apart because they are shift schedules. I would like to heat better when I come home at night. So it is cold at night because there is only one heating schedule.

I have achieved this by defining two different schedules and then creating a helper to switch between them that is triggered by the calendar (which is linked to our Google family calendar). Works like a treat.

with your local version check I only get the result:

Template variable warning: No first item, sequence was empty. when rendering '{{ value | regex_findall('\*\*Version\*\*:(.+\d+.\d+.\d+)', '\1') | first | trim }}'

Did you whitelist the blueprint directory in your configuration as explained in the comments?

yes, the template needs to be adjusted:

value_template: >
  {% set versions = value | regex_findall('\\*\\*Version\\*\\*:\\s*(\\d+\\.\\d+\\.\\d+)') %}
  {% if versions %}
    {{ versions | first | trim }}
  {% else %}
    "Unknown Version"
  {% endif %}

Can be simplified. Mine looks like:

sensor:
  unique_id: "ahc_blueprint_local_version"
  command: "cat /config/blueprints/automation/panhans/advanced_heating_control.yaml"
  name: "AHC Blueprint Local Version"
  value_template: "{{ value | regex_findall('\\*\\*Version\\*\\*:(.+\\d+.\\d+.\\d+)', '\\1') | first | default('Unknown') | trim }}"
  scan_interval: 3600 # every hour

And in the configuration.yaml:

homeassistant:
  allowlist_external_dirs:
    - /config
1 Like

another thing: I get the following error:

Logger: homeassistant.components.automation.ahc_gastezimmer
Quelle: components/automation/__init__.py:689
Integration: Automatisierung (Dokumentation, Probleme)
Erstmals aufgetreten: 16:23:34 (6 Vorkommnisse)
Zuletzt protokolliert: 16:26:18

Error rendering variables: ValueError: Template error: float got invalid input 'None' when rendering template '{% set n = namespace(dict=[]) %} {% if is_native_calibration_trigger %} {% for valve in valves_calibration_common %} {% set calibration_entities = device_entities(device_id(valve)) | expand | selectattr('domain','in','number') | selectattr('entity_id', 'search', input_calibration_key_word) | map(attribute='entity_id') | list %} {% if calibration_entities | count > 0%} {% set calibration_entity = calibration_entities | first %} {% set step = state_attr(calibration_entity, 'step') | float(1) %} {% if rounding_mode == 'manual' %} {% set step = input_calibration_step_size | float(1) %} {% endif %} {% 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 offset_old = states(calibration_entity) | float(0) %} {% set new_calibration_value = (-(thermostat_temperature - value_temperature_sensor) + offset_old) %} {% if is_aggressive_mode_calibration %} {% set temp_diff = state_attr(valve,'temperature') | float(target_temperature) - value_temperature_sensor %} {% if temp_diff * factor < input_aggressive_mode_range * -1 %} {% set new_calibration_value = new_calibration_value + input_aggressive_mode_offset * factor %} {% elif temp_diff * factor > input_aggressive_mode_range %} {% set new_calibration_value = new_calibration_value - input_aggressive_mode_offset * factor %} {% endif %} {% endif %} {% set new_calibration_value = iif(new_calibration_value > max_calibration_value, max_calibration_value, new_calibration_value) %} {% set new_calibration_value = iif(new_calibration_value < min_calibration_value, min_calibration_value, new_calibration_value) %} {% set round_size = iif('.' in (step | string), (step | string).split('.')[1] | length, 0) %} {% set offset_new = ((new_calibration_value | float(0) / step) | round(0) * step) | round(round_size) | float %} {% if (float(offset_old) - float(offset_new)) | abs >= float(input_calibration_delta) %} {% set n.dict = n.dict + [(calibration_entity, [{'value': offset_new, 'valve': valve}])] %} {% endif %} {% endif %} {% endfor %} {% endif %} {{ dict.from_keys(n.dict) }}' but no default was specified

how to solve that?

When did this happen? After a restart?

This happens if there is no value set for min, max or current_temperature, e.g. when your climate isn’t available or has unknown states. Maybe I should catch this and block the calibration in this case.

yes, might be possible, I restarted several times for debugging

In the last section is an option to delay the automation after a restart. Maybe this helps.

Thank you so much again! Worked like a charm:

- trigger:
    - trigger: event
      event_type: ahc_event
      event_data:
        automation: automation.advanced_heating_control_bad
  sensor:
    - name: "Heizung Bad Target"
      unique_id: Heizung Bad Target
      unit_of_measurement: °C
      icon: "mdi:thermometer"
      state: "{{ trigger.event.data.target_temperature}}"

The following has nothing to do with the blueprint, but can I set the entity_id directly in this template sensor? Or do I really have to change it in the UI afterwards?

@panhans do you know what body I should include in a notify event, so that I’m informed about what has changed for every AHC attribute change? As I’m still testing my system, I have configured a notification for each state change but would be awesome if I could get all variables involved in the blueprint in the body of the notify event, or even better, what variable just changed.

thanks!

@AxelRHD
I think the entity id follows the unique id. In your case sensor.heizung_bad_target.

@kitus
I think there isn’t an elegant way.

alias: AHC-Trigger Notification
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: mode
    id: mode
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: automation
    id: automation
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: is_person_defined
    id: is_person_defined
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: is_proximity_defined
    id: is_proximity_defined
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: is_anybody_home
    id: is_anybody_home
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: is_guest_mode
    id: is_guest_mode
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: active_scheduler
    id: active_scheduler
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: state_scheduler
    id: state_scheduler
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: state_presence_sensor
    id: state_presence_sensor
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: state_presence_scheduler
    id: state_presence_scheduler
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: state_presence
    id: state_presence
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: state_proximity_arrived
    id: state_proximity_arrived
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: state_proximity_way_home
    id: state_proximity_way_home
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: is_force_max_temperature
    id: is_force_max_temperature
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: active_party_entity
    id: active_party_entity
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: party_temp
    id: party_temp
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: is_away
    id: is_away
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: state_window
    id: state_window
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: is_frost_protection
    id: is_frost_protection
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: is_liming_protection
    id: is_liming_protection
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: state_outside_temp
    id: state_outside_temp
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: entry_time
    id: entry_time
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: thermostats
    id: thermostats
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: hvac_mode
    id: hvac_mode
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: temperature_comfort
    id: temperature_comfort
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: temperature_eco
    id: temperature_eco
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: target_temperature
    id: target_temperature
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: set_max_temperature
    id: set_max_temperature
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: last_trigger_id
    id: last_trigger_id
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: last_calibration
    id: last_calibration
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: last_temperature_change
    id: last_temperature_change
  - trigger: state
    entity_id:
      - binary_sensor.YOUR_AHC_SENSOR
    attribute: friendly_name
    id: friendly_name
conditions: []
actions:
  - action: notify.YOUR_NOTIFY_DEVICE
    metadata: {}
    data:
      title: AHC - Change {{ trigger.id }}
      message: "Value {{ state_attr(trigger.entity_id, trigger.id) }}"
1 Like

Hi folks,
first of all, thank you @panhans for this amazing blueprint.

Unfortunately, i have some trouble since i started to use input_number entities for the temperature settings and drop down input_text for selecting the schedule.
I cant figure out whats the root cause…at the moment the automation does not recognize a change of the input_number temp entities and a schedule change by selecting a different one as well.

I also configured a input_boolean for the winter mode to enable/disable the automation at all. But even this is not working, the automation doesnt recognize that the input_boolean has changed.

It seems i missed something essential here…can someone help me to figure this out?
I would like to attach the trace file here, but it seems there are only images allowed to share.

Thanks a million @panhans! I will give this a try during the weekend. You rock!

@panhans I left my proximity zone today but the automation did not stop the heating automatically. I allowed the automation some time to react but it failed to stop the heating. As soon as I manually run the automation, the heating was stopped. I wonder what should I do in the future, if I want to capture a consistent trace; how do I capture the particular condition: heating is still on when it shouldn’t - automation has not been triggered (but if it had, it should stop the heating)? I’m asking that because I’m interested in the why, but if I run the automation manually I’m artificially solving the issue, but the trace I would capture would have been tampered with?.

I look forward to your indications, which should allow for a better evaluation of the issue I hope.

Thanks!!!

Ok, i rebuilt the automations from scratch with exact the same settings.
Now the temperature change via the input_number entities and the winter mode boolean seems to work.

But whats not working is the schedule selection via the input_text.
e.g. the thermostats are set to comfort temp and selecting an “inactive” schedule does not change the temp to eco. And if i set the thermostats to something else and reload the automation with an inactive schedule configured, the thermostats get set to comfort.

Another slightly bigger issue:

  • Physical Temperature Change / Sync is turned On
  • Liming protection becomes active and sets the temperature to max

The temperature will be stuck at max since the Sync function sets the comfort temperature to max after the liming protection becomes active. When liming protection turns off the temperature remains at max since this is now the setpoint temperature.

Could you show me that please? :slight_smile:

Got it, it was a user issue :grimacing:
It is crucial to add all required schedules in the automation in addition to the selector input_text. That was not really clearly explained in the info text. But now its working fine :slight_smile: