Skip to content

Instantly share code, notes, and snippets.

@rufik
Last active January 13, 2024 09:24
Show Gist options
  • Select an option

  • Save rufik/92b0b916c438ac8e78ccbce17f9b93d5 to your computer and use it in GitHub Desktop.

Select an option

Save rufik/92b0b916c438ac8e78ccbce17f9b93d5 to your computer and use it in GitHub Desktop.
Template sensors dla ESPAltherma w Home Assistant

ESPAltherma info

Źródło oprogramowania: https://raomin.github.io/ESPAltherma/

Informacje o urządzeniu w HA: ESP32 - LT EHVH D6V producent: espressif / Raomin oprogramowanie: 2021.12.06 Użyty został plik ALTHERMA(LT_EHVH-D6V_04-08KW).h dla mojej pompy, zoptymalizowany do niezbędnych i działających sensorów.

HA templates

W pliku configuration.yaml trzeba dodać wpis (np. na końcu):

template: !include_dir_merge_list sensor_templates/

Następnie plik esp_altherma.yaml umieścić w katalogu config/sensor_templates/ i zrestartować HA.

Uwaga! Aby template sensors poprawnie działały, koniecznie encja z atrybutami pompy ciepła musi mieć nazwę sensor.espalthermasensors. Inaczej trezba w pliku esp_altherma.yaml zmienić wszystkie odwołania state_attr('sensor.espalthermasensors',... na właściwe entity ID.

#include "labeldef.h"
// This file is a definition file for the ESPAtherma.
// uncomment each value you want to query for your installation.
LabelDef PROGMEM labelDefs[] = {
{0x00,0,152,1,-1,"Sensor Data Qty"},
{0x00,1,152,1,-1,"INV compressor Qty"},
{0x00,2,152,1,-1,"STD compressor Qty"},
{0x00,3,152,1,-1,"Fan Data Qty"},
{0x00,4,152,1,-1,"Expansion Valve Data Qty"},
{0x00,5,152,1,-1,"4 Way Valve Data Qty"},
{0x00,6,152,1,-1,"Crank Case Heater Qty"},
{0x00,7,152,1,-1,"Solenoid valve Qty"},
{0x00,8,152,1,-1,"Max. connectable indoor units"},
{0x00,9,152,1,-1,"Connected Indoor Unit Qty"},
{0x00,10,152,1,-1,"O/U MPU ID (xx)"},
{0x00,11,152,1,-1,"O/U MPU ID (yy)"},
{0x00,12,105,1,-1,"O/U capacity (kW)"},
{0x10,0,217,1,-1,"Operation Mode"},
{0x10,1,307,1,-1,"Thermostat ON/OFF"},
{0x10,1,306,1,-1,"Restart standby"},
{0x10,1,305,1,-1,"Startup Control"},
{0x10,1,304,1,-1,"Defrost Operation"},
{0x10,1,303,1,-1,"Oil Return Operation"},
{0x10,1,302,1,-1,"Pressure equalizing operation"},
{0x10,1,301,1,-1,"Demand Signal"},
{0x10,1,300,1,-1,"Low noise control"},
{0x10,4,203,1,-1,"Error type"},
{0x10,5,204,1,-1,"Error Code"},
{0x10,6,114,2,1,"Target Evap. Temp."},
{0x10,8,114,2,1,"Target Cond. Temp."},
{0x10,10,307,1,-1,"Discharge Temp. Drop"},
{0x10,10,303,1,-1,"Comp. INV Current Drop"},
{0x10,11,307,1,-1,"HP Drop Control"},
{0x10,11,303,1,-1,"LP Drop Control"},
{0x10,12,307,1,-1,"Fin Temp. Drop Control"},
{0x10,12,303,1,-1,"Other Drop Control"},
{0x20,0,105,2,1,"Outdoor air temp.(R1T)"},
{0x20,2,105,2,1,"O/U Heat Exch. Temp."},
{0x20,4,105,2,1,"Discharge pipe temp."},
{0x20,6,105,2,1,"Suction pipe temp."},
{0x20,8,105,2,1,"Heat exchanger mid-temp."},
{0x20,10,105,2,1,"Liquid pipe temp.(R6T)"},
{0x20,12,105,2,1,"Heat sink temp."},
{0x20,14,105,2,2,"Pressure sensor"},
{0x21,0,105,2,-1,"INV primary current (A)"},
{0x21,2,105,2,-1,"INV secondary current (A)"},
{0x21,4,101,2,-1,"Voltage (N-phase) (V)"},
{0x21,6,307,1,-1,"Brine Flow Switch"},
{0x21,7,105,2,1,"Brine inlet temp."},
{0x21,9,105,2,1,"Brine outlet temp."},
{0x21,11,105,2,1,"Refrig. temp. evap. In"},
{0x21,13,105,2,1,"Refrig. temp. evap.Out"},
{0x30,0,152,1,-1,"INV frequency (rps)"},
{0x30,1,152,1,-1,"INV frequency 2 (rps)"},
{0x30,0,307,1,-1,"STD Compressor 1"},
{0x30,0,306,1,-1,"STD Compressor 2"},
{0x30,0,211,1,-1,"Fan 1 (10 rpm)"},
{0x30,1,211,1,-1,"Fan 2 (step)"},
{0x30,0,151,2,-1,"Expansion valve (pls)"},
{0x30,2,151,2,-1,"Expansion valve 2 (pls)"},
{0x30,4,151,2,-1,"Expansion valve 3 (pls)"},
{0x30,6,151,2,-1,"Expansion valve 4 (pls)"},
{0x30,8,151,2,-1,"Expansion valve 5 (pls)"},
{0x30,0,307,1,-1,"4 Way Valve 1"},
{0x30,0,306,1,-1,"4 Way Valve 2"},
{0x30,0,305,1,-1,"4 Way Valve 3"},
{0x30,0,304,1,-1,"4 Way Valve 4"},
{0x30,0,303,1,-1,"4 Way Valve 5"},
{0x30,0,307,1,-1,"Crank case heater 1"},
{0x30,0,306,1,-1,"Crank case heater 2"},
{0x30,0,305,1,-1,"Crank case heater 3"},
{0x30,0,304,1,-1,"Crank case heater 4"},
{0x30,0,307,1,-1,"Solenoid Valve 1"},
{0x30,0,306,1,-1,"Solenoid Valve 2"},
{0x30,0,305,1,-1,"Solenoid Valve 3"},
{0x30,0,304,1,-1,"Solenoid Valve 4"},
{0x30,0,303,1,-1,"Solenoid Valve 5"},
{0x60,0,304,1,-1,"Data Enable/Disable"},
{0x60,1,152,1,-1,"Indoor Unit Address"},
{0x60,2,315,1,-1,"I/U operation mode"},
{0x60,2,303,1,-1,"Thermostat ON/OFF"},
{0x60,2,302,1,-1,"Freeze Protection"},
{0x60,2,301,1,-1,"Silent Mode"},
{0x60,2,300,1,-1,"Freeze Protection for water piping"},
{0x60,3,204,1,-1,"Error Code"},
{0x60,4,152,1,-1,"Error detailed code"},
{0x60,5,203,1,-1,"Error type"},
{0x60,7,105,2,1,"DHW setpoint"},
{0x60,9,105,2,1,"LW setpoint (main)"},
{0x60,11,307,1,-1,"Water flow switch"},
{0x60,11,306,1,-1,"Thermal protector (Q1L) BUH"},
{0x60,11,305,1,-1,"Thermal protector BSH"},
{0x60,11,304,1,-1,"Benefit kWh rate power supply"},
{0x60,11,303,1,-1,"Solar input"},
{0x60,11,300,1,-1,"Bivalent Operation"},
{0x60,12,307,1,-1,"2way valve(On:Heat_Off:Cool)"},
{0x60,12,306,1,-1,"3way valve(On:DHW_Off:Space)"},
{0x60,12,305,1,-1,"BSH"},
{0x60,12,304,1,-1,"BUH Step1"},
{0x60,12,303,1,-1,"BUH Step2"},
{0x60,12,302,1,-1,"BPH"},
{0x60,12,301,1,-1,"Water pump operation"},
{0x60,12,300,1,-1,"Solar pump operation"},
{0x60,13,152,1,-1,"Indoor Option Code"},
{0x60,16,152,1,-1,"I/U EEPROM Ver."},
{0x61,0,307,1,-1,"Data Enable/Disable"},
{0x61,1,152,1,-1,"Indoor Unit Address"},
{0x61,2,105,2,1,"Leaving water temp. before BUH (R1T)"},
{0x61,4,105,2,1,"Leaving water temp. after BUH (R2T)"},
{0x61,6,105,2,1,"Refrig. Temp. liquid side (R3T)"},
{0x61,8,105,2,1,"Inlet water temp.(R4T)"},
{0x61,10,105,2,1,"DHW tank temp. (R5T)"},
{0x61,12,105,2,1,"Indoor ambient temp. (R1T)"},
{0x61,14,105,2,1,"Ext. indoor ambient sensor (R6T)"},
{0x62,0,307,1,-1,"Data Enable/Disable"},
{0x62,1,152,1,-1,"Indoor Unit Address"},
{0x62,2,307,1,-1,"Reheat ON/OFF"},
{0x62,2,306,1,-1,"Storage eco ON/OFF"},
{0x62,2,305,1,-1,"Storage comfort ON/OFF"},
{0x62,2,304,1,-1,"Powerful DHW Operation. ON/OFF"},
{0x62,2,303,1,-1,"Space heating Operation ON/OFF"},
{0x62,2,302,1,-1,"System OFF (ON:System off)"},
{0x62,2,300,1,-1,"Emergency (indoor) active/not active"},
{0x62,3,105,2,1,"LW setpoint (add)"},
{0x62,5,105,2,1,"RT setpoint"},
{0x62,7,307,1,-1,"Add. Ext. RT Input Cool."},
{0x62,7,306,1,-1,"Add. Ext. RT Input Heat."},
{0x62,7,305,1,-1,"Main RT Cooling"},
{0x62,7,304,1,-1,"Main RT Heating"},
{0x62,7,303,1,-1,"Pwr consumption limit 4"},
{0x62,7,302,1,-1,"Pwr consumption limit 3"},
{0x62,7,301,1,-1,"Pwr consumption limit 2"},
{0x62,7,300,1,-1,"Pwr consumption limit 1"},
{0x62,8,307,1,-1,"None"},
{0x62,8,303,1,-1,"Tank preheat ON/OFF"},
{0x62,8,302,1,-1,"Circulation pump operation"},
{0x62,8,301,1,-1,"Alarm output"},
{0x62,8,300,1,-1,"Space H Operation output"},
{0x62,9,105,2,-1,"Flow sensor (l/min)"},
{0x62,11,105,1,2,"Water pressure"},
{0x62,12,152,1,-1,"Water pump signal (0:max-100:stop)"},
{0x62,13,152,1,-1,"[Future] 3 way Valve Mixing 1"},
{0x62,14,152,1,-1,"[Future] 3 way Valve Mixing 2"},
{0x63,0,307,1,-1,"Data Enable/Disable"},
{0x63,1,152,1,-1,"Indoor Unit Address"},
{0x64,0,307,1,-1,"Data Enable/Disable"},
{0x64,1,152,1,-1,"Indoor Unit Address"},
{0x64,2,316,1,-1,"Hybrid Op. Mode"},
{0x64,2,303,1,-1,"Boiler Operation Demand"},
{0x64,2,302,1,-1,"Boiler DHW Demand"},
{0x64,2,301,1,-1,"Bypass Valve Output"},
{0x64,3,105,2,-1,"BE_COP"},
{0x64,5,105,2,1,"Hybrid Heating Target Temp."},
{0x64,7,105,2,1,"Boiler Heating Target Temp."},
{0x64,9,302,1,-1,"Add pump"},
{0x64,9,301,1,-1,"Main pump"},
{0x64,10,105,2,1,"Mixed water temp."},
{0x64,12,105,2,1,"2nd Domestic hot water temperature"},
{0x64,14,152,1,1,"Target delta T heating"},
{0x64,15,152,1,1,"Target delta T cooling"},
};
- sensor:
- name: "Temperatura C.W.U."
unique_id: espaltherma_dhw_temp
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
icon: "mdi:water-boiler"
state: "{{ state_attr('sensor.espalthermasensors','DHW tank temp. (R5T)') }}"
- name: "COP"
unique_id: espaltherma_cop
unit_of_measurement: "cop"
# device_class: None
# state_class: measurement
icon: "mdi:elevation-rise"
state: >-
{% if is_state_attr('sensor.espalthermasensors','Operation Mode', 'Heating') and is_state_attr('sensor.espalthermasensors','Freeze Protection', 'OFF') %}
{{ ((state_attr('sensor.espalthermasensors','Flow sensor (l/min)')| float(0) * 0.06 * 1.16 * (state_attr('sensor.espalthermasensors','Leaving water temp. before BUH (R1T)') | float(0) - state_attr('sensor.espalthermasensors','Inlet water temp.(R4T)')|float(0)) ) / (state_attr('sensor.espalthermasensors','INV primary current (A)') | float(0) * state_attr('sensor.espalthermasensors','Voltage (N-phase) (V)')|float(0) / 1000))|round(2) }}
{%else%}
0.0
{%endif%}
- name: "COP pozytywny"
unique_id: espaltherma_cop_positive
unit_of_measurement: "cop"
# device_class: None
# state_class: measurement
icon: "mdi:elevation-rise"
state: >-
{%- if (states('sensor.espaltherma_cop')|float(0) <= 0.0) -%}
{{ None }}
{%- else -%}
{{ states('sensor.espaltherma_cop')|float(0) }}
{%- endif -%}
- name: "Indoor unit temperature"
unique_id: espaltherma_indoor_temp
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
icon: "mdi:home-thermometer"
state: "{{ state_attr('sensor.espalthermasensors','Indoor ambient temp. (R1T)') }}"
- name: "Outdoor unit temperature"
unique_id: espaltherma_outdoor_temp
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
icon: "mdi:thermometer"
state: "{{ state_attr('sensor.espalthermasensors','Outdoor air temp.(R1T)') }}"
# chyba jest zbędna
# - name: "I/U operation mode"
# unique_id: espaltherma_i_u_operation_mode
# # unit_of_measurement: ""
# # device_class:
# # state_class: measurement
# icon: "mdi:keyboard-f1"
# state: "{{ state_attr('sensor.espalthermasensors','I/U operation mode') }}"
# chyba jest zbędna
# - name: "Operation mode"
# unique_id: espaltherma_operation_mode
# # unit_of_measurement: ""
# # device_class:
# # state_class: measurement
# icon: "mdi:keyboard-f2"
# state: "{{ state_attr('sensor.espalthermasensors','Operation Mode') }}"
- name: "Tryb pracy"
unique_id: espaltherma_state
icon: "mdi:checkbox-marked-circle-outline"
state: >-
{%- set mode = "UNKNOWN" -%}
{%- if state_attr('sensor.espalthermasensors','Defrost Operation') == "ON" %}
{%- set mode = "DEFROSTING" %}
{%- elif state_attr('sensor.espalthermasensors','DHW setpoint')|float(0) > 55.0 %}
{%- set mode = "DHW TANK DISINFECTION" %}
{%- elif state_attr('sensor.espalthermasensors','Operation Mode') == "Fan Only" %}
{%- set mode = "IDLE" %}
{%- elif state_attr('sensor.espalthermasensors','Operation Mode') == "Heating" %}
{%- if state_attr('sensor.espalthermasensors','I/U operation mode') == "Heating" %}
{%- set mode = "HEATING" %}
{%- elif state_attr('sensor.espalthermasensors','I/U operation mode') == "Heating + DHW" %}
{%- set mode = "DHW HEATING" %}
{%- elif state_attr('sensor.espalthermasensors','I/U operation mode') == "DHW" %}
{%- set mode = "DHW HEATING" %}
{%- elif state_attr('sensor.espalthermasensors','I/U operation mode') == "Stop" %}
{%- set mode = "IDLE" %}
{%- else %}
{%- set mode = "UNKNOWN I/U MODE" %}
{%- endif %}
{%- else %}
{%- set mode = "OTHER" %}
{%- endif %}
{{ mode }}
- name: "LW temperature setpoint"
unique_id: espaltherma_lw_temperature_setpoint
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
icon: "mdi:temperature-celsius"
state: "{{ state_attr('sensor.espalthermasensors','LW setpoint (main)') }}"
- name: "Inlet water temperature R4T"
unique_id: espaltherma_inlet_water_temperature_r4t
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
icon: "mdi:oil-temperature"
state: "{{ state_attr('sensor.espalthermasensors','Inlet water temp.(R4T)') }}"
- name: "Refrigerant temperature R3T"
unique_id: espaltherma_refrigerant_temperature_r3t
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
icon: "mdi:oil-temperature"
state: "{{ state_attr('sensor.espalthermasensors','Refrig. Temp. liquid side (R3T)') }}"
- name: "Leaving water temperature before BUH R1T"
unique_id: espaltherma_leaving_water_temperature_before_buh_r1t
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
icon: "mdi:oil-temperature"
state: "{{ state_attr('sensor.espalthermasensors','Leaving water temp. before BUH (R1T)') }}"
- name: "Leaving water temperature after BUH R2T"
unique_id: espaltherma_leaving_water_temperature_after_buh_r2t
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
icon: "mdi:oil-temperature"
state: "{{ state_attr('sensor.espalthermasensors','Leaving water temp. after BUH (R2T)') }}"
- name: "Altherma water flow"
unique_id: espaltherma_water_flow
unit_of_measurement: "l/min"
# device_class: WZOR
# state_class: measurement
icon: "mdi:chevron-triple-right"
state: "{{ state_attr('sensor.espalthermasensors','Flow sensor (l/min)') }}"
- name: "Altherma water pressure"
unique_id: espaltherma_water_pressure
unit_of_measurement: "bar"
device_class: atmospheric_pressure
state_class: measurement
icon: "mdi:alpha-p-circle-outline"
state: "{{ state_attr('sensor.espalthermasensors','Water pressure') }}"
- name: "Altherma water pump rate"
unique_id: espaltherma_water_pump_rate
unit_of_measurement: "%"
# device_class: rate
# state_class: measurement
icon: "mdi:percent"
state: "{{ (state_attr('sensor.espalthermasensors','Water pump signal (0:max-100:stop)')|float(0) - 100.0) | abs }}"
- binary_sensor:
- name: "BUH 1"
unique_id: espaltherma_buh1
icon: "mdi:numeric-1-circle-outline"
state: "{{ True if state_attr('sensor.espalthermasensors','BUH Step1') == 'ON' else False }}"
- name: "BUH 2"
unique_id: espaltherma_buh2
icon: "mdi:numeric-1-circle-outline"
state: "{{ True if state_attr('sensor.espalthermasensors','BUH Step2') == 'ON' else False }}"
- name: "Defrosting"
unique_id: espaltherma_defrosting
icon: "mdi:snowflake-melt"
state: "{{ True if state_attr('sensor.espalthermasensors','Defrost Operation') == 'ON' else False }}"
- name: "Kontrola grzania"
unique_id: espaltherma_heating_switch_state
icon: "mdi:checkbox-marked-circle"
state: "{{ True if state_attr('sensor.espalthermasensors','Space heating Operation ON/OFF') == 'ON' else False }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment