FHEM Forum

FHEM - Anwendungen => Heizungssteuerung/Raumklima => Thema gestartet von: sunrise am 03 November 2025, 18:09:05

Titel: THZ Tecalor (LWZ Stiebel Eltron) Wärmepumpe: FHEM - Home Assistant
Beitrag von: sunrise am 03 November 2025, 18:09:05
Hallo zusammen!

Hier mal meine Einstellungen auf FHEM- und Home Assistant (HA)-Seite, um meine THZ 303 SOL (2er firmware) über FHEM von HA aus zu steuern; bisher realisiert für P01-P12.


Hintergrund-Infos:

Mein Heimnetzwerk ist von außen nicht erreichbar. FHEM läuft auf einem Raspberry Pi 2 mit USB-RS232 Adapter, der an meiner THZ per 5 m Kabel  (eigentlich zu lang, ich weiß) angeschlossen ist. Hin und wieder kommt es daher zu Kommunikations-Problemen, aber die Steuerung klappt trotzdem.

HA läuft in einer VM auf meiner Synology Diskstation (Snapshots sind nützlich), und ich plane, auch FHEM dorthin zu migrieren.

Die Kommunikation zwischen FHEM und HA läuft via MQTT.

Ich habe mir alles mithilfe von KI (ChatGPT) angeeignet, und mir ist bewusst, dass viele Foren-Nutzer über KI-generierten Code (häufig auch berechtigt) die Nase rümpfen. Wer also Verbesserungs- und Klarstellungsmöglichkeiten sieht, kann es mich hier gerne wissen lassen. Evtl. finde ich dann die Zeit, es zu verbessern. Mal sehen, ob ich langfristig ein GitHub-Repo dazu aufmache, zunächst aber bleibe ich hier im Forum.


Ausschnitt aus meiner fhem.cfg
(Lücken sind entfernte setuuid Zeilen, die ohnehin für jeden neu angelegt werden)

##### MQTT2 CLIENT connection to Home Assistant

define HA1_MQTT2 MQTT2_CLIENT 192.168.178.22:1883

attr HA1_MQTT2 clientId fhem
attr HA1_MQTT2 keepaliveTimeout 60
attr HA1_MQTT2 msgAfterConnect -r fhem/connection/status connected
attr HA1_MQTT2 msgBeforeDisconnect -r fhem/connection/status disconnected
attr HA1_MQTT2 qosMaxQueueLength 100
attr HA1_MQTT2 room MQTT
attr HA1_MQTT2 username mqttuser


##### MQTT generic bridge

define mqttGeneric MQTT_GENERIC_BRIDGE mqtt room=HomeAssistant

attr mqttGeneric IODev HA1_MQTT2
attr mqttGeneric globalDefaults sub:qos=2 pub:qos=0 retain=1 base={"fhem/$device"}
attr mqttGeneric globalPublish *:topic={"fhem/$device/$reading"}
attr mqttGeneric icon mqtt_bridge_2
attr mqttGeneric room MQTT
attr mqttGeneric verbose 0


### Mythz sensors + inbound MQTT commands (for Home Assistant write access)
### NOTE: We harmonize topic names for p01–p03 to match the "...RoomSetTemp..." scheme used by p10–p12.
###       The THZ device exposes p01–p03 as p01RoomTemp...; we mirror them (numeric, no unit) to ...RoomSetTemp...
###       so Home Assistant gets consistent state/command topics across p01–p12.
###       All other publishing remains handled by MQTT_GENERIC_BRIDGE.


### P01–P03: Normalize THZ readings to MQTT naming (...RoomSetTemp...) and strip "°C"


# Initial retained push on FHEM startup (so Home Assistant has values immediately)

define n_THZ_p01_state_init notify global:INITIALIZED { my $v = ReadingsVal("Mythz","p01RoomTempDay","");; $v =~ s/°C//g;; fhem("set HA1_MQTT2 publish -r fhem/Mythz/p01RoomSetTempDay $v");; }
define n_THZ_p02_state_init notify global:INITIALIZED { my $v = ReadingsVal("Mythz","p02RoomTempNight","");; $v =~ s/°C//g;; fhem("set HA1_MQTT2 publish -r fhem/Mythz/p02RoomSetTempNight $v");; }
define n_THZ_p03_state_init notify global:INITIALIZED { my $v = ReadingsVal("Mythz","p03RoomTempStandby","");; $v =~ s/°C//g;; fhem("set HA1_MQTT2 publish -r fhem/Mythz/p03RoomSetTempStandby $v");; }


# STATE mapping while running

define n_THZ_p01_state_map notify Mythz:p01RoomTempDay:.* { my $v = ReadingsVal("Mythz","p01RoomTempDay","");; $v =~ s/°C//g;; fhem("set HA1_MQTT2 publish -r fhem/Mythz/p01RoomSetTempDay $v");; }
define n_THZ_p02_state_map notify Mythz:p02RoomTempNight:.* { my $v = ReadingsVal("Mythz","p02RoomTempNight","");; $v =~ s/°C//g;; fhem("set HA1_MQTT2 publish -r fhem/Mythz/p02RoomSetTempNight $v");; }
define n_THZ_p03_state_map notify Mythz:p03RoomTempStandby:.* { my $v = ReadingsVal("Mythz","p03RoomTempStandby","");; $v =~ s/°C//g;; fhem("set HA1_MQTT2 publish -r fhem/Mythz/p03RoomSetTempStandby $v");; }


# Commands coming from Home Assistant (write-back to THZ)

define n_THZ_p01 notify HA1_MQTT2_THZ_CMD_p01:p01RoomSetTempDay_cmd:.* set Mythz p01RoomTempDay $EVTPART1
define n_THZ_p02 notify HA1_MQTT2_THZ_CMD_p02:p02RoomSetTempNight_cmd:.* set Mythz p02RoomTempNight $EVTPART1
define n_THZ_p03 notify HA1_MQTT2_THZ_CMD_p03:p03RoomSetTempStandby_cmd:.* set Mythz p03RoomTempStandby $EVTPART1



# --- p01: Room set temp (Day) ------------------------------------
define HA1_MQTT2_THZ_CMD_p01 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p01 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p01 readingList fhem/Mythz/p01RoomSetTempDay/cmd:.* p01RoomSetTempDay_cmd
attr HA1_MQTT2_THZ_CMD_p01 room MQTT
attr HA1_MQTT2_THZ_CMD_p01 stateFormat { ReadingsVal($name,'p01RoomSetTempDay_cmd','-') }
### p01 controls the desired room set temperature for day mode (~10–30 °C).

# --- p02: Room set temp (Night) ----------------------------------
define HA1_MQTT2_THZ_CMD_p02 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p02 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p02 readingList fhem/Mythz/p02RoomSetTempNight/cmd:.* p02RoomSetTempNight_cmd
attr HA1_MQTT2_THZ_CMD_p02 room MQTT
attr HA1_MQTT2_THZ_CMD_p02 stateFormat { ReadingsVal($name,'p02RoomSetTempNight_cmd','-') }
### p02 controls the desired room set temperature for night mode (~10–30 °C).

# --- p03: Room set temp (Standby) --------------------------------
define HA1_MQTT2_THZ_CMD_p03 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p03 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p03 readingList fhem/Mythz/p03RoomSetTempStandby/cmd:.* p03RoomSetTempStandby_cmd
attr HA1_MQTT2_THZ_CMD_p03 room MQTT
attr HA1_MQTT2_THZ_CMD_p03 stateFormat { ReadingsVal($name,'p03RoomSetTempStandby_cmd','-') }
### p03 controls the room set temperature for standby/setback mode (~10–30 °C).

# --- p04: DHW set temp (Day) -------------------------------------
define HA1_MQTT2_THZ_CMD_p04 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p04 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p04 readingList fhem/Mythz/p04DHWsetTempDay/cmd:.* p04DHWsetTempDay_cmd
attr HA1_MQTT2_THZ_CMD_p04 room MQTT
attr HA1_MQTT2_THZ_CMD_p04 stateFormat { ReadingsVal($name,'p04DHWsetTempDay_cmd','-') }
define n_THZ_p04 notify HA1_MQTT2_THZ_CMD_p04:p04DHWsetTempDay_cmd:.* set Mythz p04DHWsetTempDay $EVTPART1
attr n_THZ_p04 room MQTT
### p04 controls the DHW set temperature for day mode (~10–55 °C).

# --- p05: DHW set temp (Night) -----------------------------------
define HA1_MQTT2_THZ_CMD_p05 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p05 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p05 readingList fhem/Mythz/p05DHWsetTempNight/cmd:.* p05DHWsetTempNight_cmd
attr HA1_MQTT2_THZ_CMD_p05 room MQTT
attr HA1_MQTT2_THZ_CMD_p05 stateFormat { ReadingsVal($name,'p05DHWsetTempNight_cmd','-') }
define n_THZ_p05 notify HA1_MQTT2_THZ_CMD_p05:p05DHWsetTempNight_cmd:.* set Mythz p05DHWsetTempNight $EVTPART1
attr n_THZ_p05 room MQTT
### p05 controls the DHW set temperature for night mode (~10–55 °C).

# --- p06: DHW set temp (Standby) ---------------------------------
define HA1_MQTT2_THZ_CMD_p06 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p06 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p06 readingList fhem/Mythz/p06DHWsetTempStandby/cmd:.* p06DHWsetTempStandby_cmd
attr HA1_MQTT2_THZ_CMD_p06 room MQTT
attr HA1_MQTT2_THZ_CMD_p06 stateFormat { ReadingsVal($name,'p06DHWsetTempStandby_cmd','-') }
define n_THZ_p06 notify HA1_MQTT2_THZ_CMD_p06:p06DHWsetTempStandby_cmd:.* set Mythz p06DHWsetTempStandby $EVTPART1
attr n_THZ_p06 room MQTT
### p06 controls the DHW set temperature for standby/setback mode (~10–55 °C).

# --- p07: Fan stage (Day) ----------------------------------------
define HA1_MQTT2_THZ_CMD_p07 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p07 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p07 readingList fhem/Mythz/p07FanStageDay/cmd:.* p07FanStageDay_cmd
attr HA1_MQTT2_THZ_CMD_p07 room MQTT
attr HA1_MQTT2_THZ_CMD_p07 stateFormat { ReadingsVal($name,'p07FanStageDay_cmd','-') }
define n_THZ_p07 notify HA1_MQTT2_THZ_CMD_p07:p07FanStageDay_cmd:.* set Mythz p07FanStageDay $EVTPART1
attr n_THZ_p07 room MQTT
### p07 sets the ventilation stage for day mode (0–3).

# --- p08: Fan stage (Night) --------------------------------------
define HA1_MQTT2_THZ_CMD_p08 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p08 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p08 readingList fhem/Mythz/p08FanStageNight/cmd:.* p08FanStageNight_cmd
attr HA1_MQTT2_THZ_CMD_p08 room MQTT
attr HA1_MQTT2_THZ_CMD_p08 stateFormat { ReadingsVal($name,'p08FanStageNight_cmd','-') }
define n_THZ_p08 notify HA1_MQTT2_THZ_CMD_p08:p08FanStageNight_cmd:.* set Mythz p08FanStageNight $EVTPART1
attr n_THZ_p08 room MQTT
### p08 sets the ventilation stage for night mode (0–3).

# --- p09: Fan stage (Standby) ------------------------------------
define HA1_MQTT2_THZ_CMD_p09 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p09 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p09 readingList fhem/Mythz/p09FanStageStandby/cmd:.* p09FanStageStandby_cmd
attr HA1_MQTT2_THZ_CMD_p09 room MQTT
attr HA1_MQTT2_THZ_CMD_p09 stateFormat { ReadingsVal($name,'p09FanStageStandby_cmd','-') }
define n_THZ_p09 notify HA1_MQTT2_THZ_CMD_p09:p09FanStageStandby_cmd:.* set Mythz p09FanStageStandby $EVTPART1
attr n_THZ_p09 room MQTT
### p09 sets the ventilation stage for standby/setback mode (0–3).

# --- p10: HC temperature (manual) --------------------------------
define HA1_MQTT2_THZ_CMD_p10 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p10 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p10 readingList fhem/Mythz/p10HCTempManual/cmd:.* p10HCTempManual_cmd
attr HA1_MQTT2_THZ_CMD_p10 room MQTT
attr HA1_MQTT2_THZ_CMD_p10 stateFormat { ReadingsVal($name,'p10HCTempManual_cmd','-') }
define n_THZ_p10 notify HA1_MQTT2_THZ_CMD_p10:p10HCTempManual_cmd:.* set Mythz p10HCTempManual $EVTPART1
attr n_THZ_p10 room MQTT

# --- p11: DHW temperature (manual) --------------------------------
define HA1_MQTT2_THZ_CMD_p11 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p11 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p11 readingList fhem/Mythz/p11DHWsetTempManual/cmd:.* p11DHWsetTempManual_cmd
attr HA1_MQTT2_THZ_CMD_p11 room MQTT
attr HA1_MQTT2_THZ_CMD_p11 stateFormat { ReadingsVal($name,'p11DHWsetTempManual_cmd','-') }
define n_THZ_p11 notify HA1_MQTT2_THZ_CMD_p11:p11DHWsetTempManual_cmd:.* set Mythz p11DHWsetTempManual $EVTPART1
attr n_THZ_p11 room MQTT

# --- p12: Fan stage (manual) -------------------------------------
define HA1_MQTT2_THZ_CMD_p12 MQTT2_DEVICE
attr HA1_MQTT2_THZ_CMD_p12 IODev HA1_MQTT2
attr HA1_MQTT2_THZ_CMD_p12 readingList fhem/Mythz/p12FanStageManual/cmd:.* p12FanStageManual_cmd
attr HA1_MQTT2_THZ_CMD_p12 room MQTT
attr HA1_MQTT2_THZ_CMD_p12 stateFormat { ReadingsVal($name,'p12FanStageManual_cmd','-') }
define n_THZ_p12 notify HA1_MQTT2_THZ_CMD_p12:p12FanStageManual_cmd:.* set Mythz p12FanStageManual $EVTPART1
attr n_THZ_p12 room MQTT
Titel: Aw: THZ Tecalor (LWZ Stiebel Eltron) Wärmepumpe: FHEM - Home Assistant
Beitrag von: sunrise am 03 November 2025, 18:10:06
HA-Seite:

Die folgenden Dateien sind per include in configuration.yaml eingebunden:
mqtt:
  sensor: !include_dir_merge_list mqtt/
  number: !include_dir_merge_list mqtt_numbers/

/homeassistant/mqtt/heating/mqtt_heating_thz.yaml
### FHEM

# MyTHZ sensors – heat pump metrics via MQTT

- name: "MyTHZ Outside Temperature"
  unique_id: mythz_outside_temperature
  state_topic: "fhem/Mythz/outsideTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: &vt_numeric >-
    {# Accept only numeric (dot/comma); else -> unavailable #}
    {% set v = value | default('') | string | trim %}
    {% if v | regex_match('^[-+]?[0-9]+([.,][0-9]+)?$') %}
      {{ (v | replace(',', '.')) | float }}
    {% else %}
      {{ none }}
    {% endif %}

- name: "MyTHZ Flow Temperature"
  unique_id: mythz_flow_temperature
  state_topic: "fhem/Mythz/flowTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ Return Temperature"
  unique_id: mythz_return_temperature
  state_topic: "fhem/Mythz/returnTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ Hot Gas Temperature"
  unique_id: mythz_hot_gas_temperature
  state_topic: "fhem/Mythz/hotGasTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ DHW Temperature"
  unique_id: mythz_dhw_temperature
  state_topic: "fhem/Mythz/dhwTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ Flow Temperature HC2"
  unique_id: mythz_flow_temperature_hc2
  state_topic: "fhem/Mythz/flowTempHC2"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ Evaporator Temperature"
  unique_id: mythz_evaporator_temperature
  state_topic: "fhem/Mythz/evaporatorTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ Condenser Temperature"
  unique_id: mythz_condenser_temperature
  state_topic: "fhem/Mythz/condenserTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ Mixer Open"
  unique_id: mythz_mixer_open
  state_topic: "fhem/Mythz/mixerOpen"

- name: "MyTHZ Mixer Closed"
  unique_id: mythz_mixer_closed
  state_topic: "fhem/Mythz/mixerClosed"

- name: "MyTHZ Heat Pipe Valve"
  unique_id: mythz_heat_pipe_valve
  state_topic: "fhem/Mythz/heatPipeValve"

- name: "MyTHZ Diverter Valve"
  unique_id: mythz_diverter_valve
  state_topic: "fhem/Mythz/diverterValve"

- name: "MyTHZ DHW Pump"
  unique_id: mythz_dhw_pump
  state_topic: "fhem/Mythz/dhwPump"

- name: "MyTHZ Heating Circuit Pump"
  unique_id: mythz_heating_circuit_pump
  state_topic: "fhem/Mythz/heatingCircuitPump"

- name: "MyTHZ Solar Pump"
  unique_id: mythz_solar_pump
  state_topic: "fhem/Mythz/solarPump"

- name: "MyTHZ Compressor"
  unique_id: mythz_compressor
  state_topic: "fhem/Mythz/compressor"

- name: "MyTHZ Booster Stage 3"
  unique_id: mythz_booster_stage_3
  state_topic: "fhem/Mythz/boosterStage3"

- name: "MyTHZ Booster Stage 2"
  unique_id: mythz_booster_stage_2
  state_topic: "fhem/Mythz/boosterStage2"

- name: "MyTHZ Booster Stage 1"
  unique_id: mythz_booster_stage_1
  state_topic: "fhem/Mythz/boosterStage1"

- name: "MyTHZ High Pressure Sensor"
  unique_id: mythz_high_pressure_sensor
  state_topic: "fhem/Mythz/highPressureSensor"

- name: "MyTHZ Low Pressure Sensor"
  unique_id: mythz_low_pressure_sensor
  state_topic: "fhem/Mythz/lowPressureSensor"

- name: "MyTHZ Evaporator Ice Monitor"
  unique_id: mythz_evaporator_ice_monitor
  state_topic: "fhem/Mythz/evaporatorIceMonitor"

- name: "MyTHZ Signal Anode"
  unique_id: mythz_signal_anode
  state_topic: "fhem/Mythz/signalAnode"

- name: "MyTHZ EVU Release"
  unique_id: mythz_evu_release
  state_topic: "fhem/Mythz/evuRelease"

- name: "MyTHZ Oven Fireplace"
  unique_id: mythz_oven_fireplace
  state_topic: "fhem/Mythz/ovenFireplace"

- name: "MyTHZ STB"
  unique_id: mythz_stb
  state_topic: "fhem/Mythz/STB"

### Ventilator sensors (power + speed, all in percent)
# Common template for percent values (accepts "47", "47%", "47.0 %")
- name: "MyTHZ Output Ventilator Power"
  unique_id: mythz_output_ventilator_power
  state_topic: "fhem/Mythz/outputVentilatorPower"
  unit_of_measurement: "%"
  state_class: measurement
  value_template: &vt_percent >-
    {% set v = (value | default('') | string).strip() %}
    {% if v | regex_match('^[-+]?[0-9]+([.,][0-9]+)?\s*%?$') %}
      {{ (v.replace('%','').replace(',','.')) | float }}
    {% else %}
      {{ none }}
    {% endif %}

- name: "MyTHZ Input Ventilator Power"
  unique_id: mythz_input_ventilator_power
  state_topic: "fhem/Mythz/inputVentilatorPower"
  unit_of_measurement: "%"
  state_class: measurement
  value_template: *vt_percent

- name: "MyTHZ Main Ventilator Power"
  unique_id: mythz_main_ventilator_power
  state_topic: "fhem/Mythz/mainVentilatorPower"
  unit_of_measurement: "%"
  state_class: measurement
  value_template: *vt_percent

- name: "MyTHZ Output Ventilator Speed"
  unique_id: mythz_output_ventilator_speed
  state_topic: "fhem/Mythz/outputVentilatorSpeed"
  unit_of_measurement: "%"
  state_class: measurement
  value_template: *vt_percent

- name: "MyTHZ Input Ventilator Speed"
  unique_id: mythz_input_ventilator_speed
  state_topic: "fhem/Mythz/inputVentilatorSpeed"
  unit_of_measurement: "%"
  state_class: measurement
  value_template: *vt_percent

- name: "MyTHZ Main Ventilator Speed"
  unique_id: mythz_main_ventilator_speed
  state_topic: "fhem/Mythz/mainVentilatorSpeed"
  unit_of_measurement: "%"
  state_class: measurement
  value_template: *vt_percent

- name: "MyTHZ Outside Temperature Filtered"
  unique_id: mythz_outside_temperature_filtered
  state_topic: "fhem/Mythz/outsideTempFiltered"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ Relative Humidity"
  unique_id: mythz_relative_humidity
  state_topic: "fhem/Mythz/relHumidity"
  # only accept numeric values, otherwise sensor is unavailable
  value_template: >-
    {% set v = value | default('') %}
    {% if v is match('^[0-9]+(\.[0-9]+)?$') %}
      {{ v }}
    {% else %}
      {{ none }}
    {% endif %}
  unit_of_measurement: "%"
  device_class: humidity

- name: "MyTHZ Dew Point"
  unique_id: mythz_dew_point
  state_topic: "fhem/Mythz/dewPoint"

- name: "MyTHZ P Nd"
  unique_id: mythz_p_nd
  state_topic: "fhem/Mythz/P_Nd"

- name: "MyTHZ P Hd"
  unique_id: mythz_p_hd
  state_topic: "fhem/Mythz/P_Hd"

- name: "MyTHZ Actual Power Qc"
  unique_id: mythz_actual_power_qc
  state_topic: "fhem/Mythz/actualPower_Qc"

- name: "MyTHZ Actual Power Pel"
  unique_id: mythz_actual_power_pel
  state_topic: "fhem/Mythz/actualPower_Pel"

- name: "MyTHZ Collector Temperature"
  unique_id: mythz_collector_temperature
  state_topic: "fhem/Mythz/collectorTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ Inside Temperature"
  unique_id: mythz_inside_temperature
  state_topic: "fhem/Mythz/insideTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ Number of Faults"
  unique_id: mythz_number_of_faults
  state_topic: "fhem/Mythz/number_of_faults"

- name: "MyTHZ Fault 0 Code"
  unique_id: mythz_fault_0_code
  state_topic: "fhem/Mythz/fault0CODE"

- name: "MyTHZ Fault 0 Time"
  unique_id: mythz_fault_0_time
  state_topic: "fhem/Mythz/fault0TIME"

- name: "MyTHZ Fault 0 Date"
  unique_id: mythz_fault_0_date
  state_topic: "fhem/Mythz/fault0DATE"
  value_template: "{{ value }}."

- name: "MyTHZ Fault 1 Code"
  unique_id: mythz_fault_1_code
  state_topic: "fhem/Mythz/fault1CODE"

- name: "MyTHZ Fault 1 Time"
  unique_id: mythz_fault_1_time
  state_topic: "fhem/Mythz/fault1TIME"

- name: "MyTHZ Fault 1 Date"
  unique_id: mythz_fault_1_date
  state_topic: "fhem/Mythz/fault1DATE"
  value_template: "{{ value }}."

- name: "MyTHZ Fault 2 Code"
  unique_id: mythz_fault_2_code
  state_topic: "fhem/Mythz/fault2CODE"

- name: "MyTHZ Fault 2 Time"
  unique_id: mythz_fault_2_time
  state_topic: "fhem/Mythz/fault2TIME"

- name: "MyTHZ Fault 2 Date"
  unique_id: mythz_fault_2_date
  state_topic: "fhem/Mythz/fault2DATE"
  value_template: "{{ value }}."

- name: "MyTHZ Fault 3 Code"
  unique_id: mythz_fault_3_code
  state_topic: "fhem/Mythz/fault3CODE"

- name: "MyTHZ Fault 3 Time"
  unique_id: mythz_fault_3_time
  state_topic: "fhem/Mythz/fault3TIME"

- name: "MyTHZ Fault 3 Date"
  unique_id: mythz_fault_3_date
  state_topic: "fhem/Mythz/fault3DATE"
  value_template: "{{ value }}."

- name: "MyTHZ Fault 4 Code"
  unique_id: mythz_fault_4_code
  state_topic: "fhem/Mythz/fault4CODE"

- name: "MyTHZ Fault 4 Time"
  unique_id: mythz_fault_4_time
  state_topic: "fhem/Mythz/fault4TIME"

- name: "MyTHZ Fault 4 Date"
  unique_id: mythz_fault_4_date
  state_topic: "fhem/Mythz/fault4DATE"
  value_template: "{{ value }}."

- name: "MyTHZ Fault 5 Code"
  unique_id: mythz_fault_5_code
  state_topic: "fhem/Mythz/fault5CODE"

- name: "MyTHZ Fault 5 Time"
  unique_id: mythz_fault_5_time
  state_topic: "fhem/Mythz/fault5TIME"

- name: "MyTHZ Fault 5 Date"
  unique_id: mythz_fault_5_date
  state_topic: "fhem/Mythz/fault5DATE"
  value_template: "{{ value }}."

- name: "MyTHZ Fault 6 Code"
  unique_id: mythz_fault_6_code
  state_topic: "fhem/Mythz/fault6CODE"

- name: "MyTHZ Fault 6 Time"
  unique_id: mythz_fault_6_time
  state_topic: "fhem/Mythz/fault6TIME"

- name: "MyTHZ Fault 6 Date"
  unique_id: mythz_fault_6_date
  state_topic: "fhem/Mythz/fault6DATE"
  value_template: "{{ value }}."

- name: "MyTHZ Fault 7 Code"
  unique_id: mythz_fault_7_code
  state_topic: "fhem/Mythz/fault7CODE"

- name: "MyTHZ Fault 7 Time"
  unique_id: mythz_fault_7_time
  state_topic: "fhem/Mythz/fault7TIME"

- name: "MyTHZ Fault 7 Date"
  unique_id: mythz_fault_7_date
  state_topic: "fhem/Mythz/fault7DATE"
  value_template: "{{ value }}."

- name: "MyTHZ Fault 8 Code"
  unique_id: mythz_fault_8_code
  state_topic: "fhem/Mythz/fault8CODE"

- name: "MyTHZ Fault 8 Time"
  unique_id: mythz_fault_8_time
  state_topic: "fhem/Mythz/fault8TIME"

- name: "MyTHZ Fault 8 Date"
  unique_id: mythz_fault_8_date
  state_topic: "fhem/Mythz/fault8DATE"
  value_template: "{{ value }}."

- name: "MyTHZ Fault 9 Code"
  unique_id: mythz_fault_9_code
  state_topic: "fhem/Mythz/fault9CODE"

- name: "MyTHZ Fault 9 Time"
  unique_id: mythz_fault_9_time
  state_topic: "fhem/Mythz/fault9TIME"

- name: "MyTHZ Fault 9 Date"
  unique_id: mythz_fault_9_date
  state_topic: "fhem/Mythz/fault9DATE"
  value_template: "{{ value }}."

- name: "MyTHZ DHW Booster Stage"
  unique_id: mythz_dhw_booster_stage
  state_topic: "fhem/Mythz/dhwBoosterStage"

- name: "MyTHZ DHW Operation Mode"
  unique_id: mythz_dhw_op_mode
  state_topic: "fhem/Mythz/dhwOpMode"

- name: "MyTHZ Integral Heat"
  unique_id: mythz_integral_heat
  state_topic: "fhem/Mythz/integralHeat"
  unit_of_measurement: "Kmin"
  state_class: measurement

- name: "MyTHZ Heat Set Temperature"
  unique_id: mythz_heat_set_temperature
  state_topic: "fhem/Mythz/heatSetTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement
  value_template: *vt_numeric

- name: "MyTHZ Heat Temperature"
  unique_id: mythz_heat_temperature
  state_topic: "fhem/Mythz/heatTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement

- name: "MyTHZ Season Mode"
  unique_id: mythz_season_mode
  state_topic: "fhem/Mythz/seasonMode"

- name: "MyTHZ Integral Switch"
  unique_id: mythz_integral_switch
  state_topic: "fhem/Mythz/integralSwitch"
  unit_of_measurement: "Kmin"
  state_class: measurement

- name: "MyTHZ Heating Circuit Operation Mode"
  unique_id: mythz_hc_op_mode
  state_topic: "fhem/Mythz/hcOpMode"

- name: "MyTHZ Room Set Temperature"
  unique_id: mythz_room_set_temperature
  state_topic: "fhem/Mythz/roomSetTemp"
  unit_of_measurement: "°C"
  device_class: temperature
  state_class: measurement

- name: "MyTHZ On Hysteresis Number"
  unique_id: mythz_on_hysteresis_number
  state_topic: "fhem/Mythz/onHysteresisNo"

- name: "MyTHZ Off Hysteresis Number"
  unique_id: mythz_off_hysteresis_number
  state_topic: "fhem/Mythz/offHysteresisNo"

- name: "MyTHZ HC Booster Stage"
  unique_id: mythz_hc_booster_stage
  state_topic: "fhem/Mythz/hcBoosterStage"

- name: "MyTHZ DHW Heating"
  unique_id: mythz_dhw_heating
  state_topic: "fhem/Mythz/dhw_heating"
  state_class: total_increasing
  unit_of_measurement: h

- name: "MyTHZ DHW Hours"
  unique_id: mythz_dhw_hours
  state_topic: "fhem/Mythz/dhw_hours"
  state_class: total_increasing
  unit_of_measurement: h
Titel: Aw: THZ Tecalor (LWZ Stiebel Eltron) Wärmepumpe: FHEM - Home Assistant
Beitrag von: sunrise am 03 November 2025, 18:13:58
/homeassistant/mqtt_numbers/heating/mqtt_heating_thz_controls.yaml

# =============================================================================
# THZ 303 SOL – MQTT Number Controls (harmonized)  p01–p12
# File: homeassistant/mqtt_numbers/heating/mqtt_heating_thz_controls.yaml
# Schema / conventions:
#   - State & Command Topics:  fhem/Mythz/<Reading>   and   fhem/Mythz/<Reading>/cmd
#   - HA entity naming:        number.mythz_pXX_<function>_<mode>
#   - THZ parameter ranges (taken from THZ 303 SOL manual):
#       p01–p03  (room setpoints, auto modes):        10..30 °C
#       p04–p06  (DHW setpoints, auto modes):         10..55 °C
#       p07–p09  (ventilation stages):                0..3
#       p10      (heating circuit, manual mode):      15..30 °C
#       p11      (DHW, manual mode):                  35..60 °C
#       p12      (ventilation, manual mode):          0..3
#   - Note:
#       FHEM sometimes still sends values with unit, e.g. "45 °C" or "23 °C".
#       Therefore ALL temperature number entities below normalize the payload:
#         1) cast to string
#         2) remove "°C"
#         3) remove "°"
#         4) remove spaces
#         5) cast to float with default 0
#       Fan stages get the same protection (int(0)) because FHEM can emit "step1".
# =============================================================================

# --- p01: Room setpoint (Day) -----------------------------------------------
- name: "MyTHZ p01 Room Set Temp (Day)"
  unique_id: mythz_p01_room_set_temp_day
  state_topic: "fhem/Mythz/p01RoomSetTempDay"
  command_topic: "fhem/Mythz/p01RoomSetTempDay/cmd"
  unit_of_measurement: "°C"
  min: 10
  max: 30
  step: 0.5
  value_template: >
    {{ (value | string | replace('°C','') | replace('°','') | replace(' ','') | float(0)) }}
  command_template: "{{ [[value | float(0), 30] | min, 10] | max }}"

# --- p02: Room setpoint (Night) ---------------------------------------------
- name: "MyTHZ p02 Room Set Temp (Night)"
  unique_id: mythz_p02_room_set_temp_night
  state_topic: "fhem/Mythz/p02RoomSetTempNight"
  command_topic: "fhem/Mythz/p02RoomSetTempNight/cmd"
  unit_of_measurement: "°C"
  min: 10
  max: 30
  step: 0.5
  value_template: >
    {{ (value | string | replace('°C','') | replace('°','') | replace(' ','') | float(0)) }}
  command_template: "{{ [[value | float(0), 30] | min, 10] | max }}"

# --- p03: Room setpoint (Standby) -------------------------------------------
- name: "MyTHZ p03 Room Set Temp (Standby)"
  unique_id: mythz_p03_room_set_temp_standby
  state_topic: "fhem/Mythz/p03RoomSetTempStandby"
  command_topic: "fhem/Mythz/p03RoomSetTempStandby/cmd"
  unit_of_measurement: "°C"
  min: 10
  max: 30
  step: 0.5
  value_template: >
    {{ (value | string | replace('°C','') | replace('°','') | replace(' ','') | float(0)) }}
  command_template: "{{ [[value | float(0), 30] | min, 10] | max }}"

# --- p04: DHW setpoint (Day) ------------------------------------------------
- name: "MyTHZ p04 DHW Set Temp (Day)"
  unique_id: mythz_p04_dhw_set_temp_day
  state_topic: "fhem/Mythz/p04DHWsetTempDay"
  command_topic: "fhem/Mythz/p04DHWsetTempDay/cmd"
  unit_of_measurement: "°C"
  min: 10
  max: 55
  step: 0.5
  value_template: >
    {{ (value | string | replace('°C','') | replace('°','') | replace(' ','') | float(0)) }}
  command_template: "{{ [[value | float(0), 55] | min, 10] | max }}"

# --- p05: DHW setpoint (Night) ----------------------------------------------
- name: "MyTHZ p05 DHW Set Temp (Night)"
  unique_id: mythz_p05_dhw_set_temp_night
  state_topic: "fhem/Mythz/p05DHWsetTempNight"
  command_topic: "fhem/Mythz/p05DHWsetTempNight/cmd"
  unit_of_measurement: "°C"
  min: 10
  max: 55
  step: 0.5
  value_template: >
    {{ (value | string | replace('°C','') | replace('°','') | replace(' ','') | float(0)) }}
  command_template: "{{ [[value | float(0), 55] | min, 10] | max }}"

# --- p06: DHW setpoint (Standby) --------------------------------------------
- name: "MyTHZ p06 DHW Set Temp (Standby)"
  unique_id: mythz_p06_dhw_set_temp_standby
  state_topic: "fhem/Mythz/p06DHWsetTempStandby"
  command_topic: "fhem/Mythz/p06DHWsetTempStandby/cmd"
  unit_of_measurement: "°C"
  min: 10
  max: 55
  step: 0.5
  value_template: >
    {{ (value | string | replace('°C','') | replace('°','') | replace(' ','') | float(0)) }}
  command_template: "{{ [[value | float(0), 55] | min, 10] | max }}"

# --- p07: Fan stage (Day) ---------------------------------------------------
- name: "MyTHZ p07 Fan Stage (Day)"
  unique_id: mythz_p07_fan_stage_day
  state_topic: "fhem/Mythz/p07FanStageDay"
  command_topic: "fhem/Mythz/p07FanStageDay/cmd"
  min: 0
  max: 3
  step: 1
  value_template: "{{ value | int(0) }}"
  command_template: "{{ [[value | int(0), 3] | min, 0] | max }}"

# --- p08: Fan stage (Night) -------------------------------------------------
- name: "MyTHZ p08 Fan Stage (Night)"
  unique_id: mythz_p08_fan_stage_night
  state_topic: "fhem/Mythz/p08FanStageNight"
  command_topic: "fhem/Mythz/p08FanStageNight/cmd"
  min: 0
  max: 3
  step: 1
  value_template: "{{ value | int(0) }}"
  command_template: "{{ [[value | int(0), 3] | min, 0] | max }}"

# --- p09: Fan stage (Standby) ----------------------------------------------
- name: "MyTHZ p09 Fan Stage (Standby)"
  unique_id: mythz_p09_fan_stage_standby
  state_topic: "fhem/Mythz/p09FanStageStandby"
  command_topic: "fhem/Mythz/p09FanStageStandby/cmd"
  min: 0
  max: 3
  step: 1
  value_template: "{{ value | int(0) }}"
  command_template: "{{ [[value | int(0), 3] | min, 0] | max }}"

# --- p10: HC setpoint (Manual) ----------------------------------------------
- name: "MyTHZ p10 HC Set Temp (Manual)"
  unique_id: mythz_p10_hc_set_temp_manual
  state_topic: "fhem/Mythz/p10HCTempManual"
  command_topic: "fhem/Mythz/p10HCTempManual/cmd"
  unit_of_measurement: "°C"
  min: 15
  max: 30
  step: 0.5
  value_template: >
    {{ (value | string | replace('°C','') | replace('°','') | replace(' ','') | float(0)) }}
  command_template: "{{ [[value | float(0), 30] | min, 15] | max }}"

# --- p11: DHW setpoint (Manual) ---------------------------------------------
- name: "MyTHZ p11 DHW Set Temp (Manual)"
  unique_id: mythz_p11_dhw_set_temp_manual
  state_topic: "fhem/Mythz/p11DHWsetTempManual"
  command_topic: "fhem/Mythz/p11DHWsetTempManual/cmd"
  unit_of_measurement: "°C"
  min: 35
  max: 60
  step: 0.5
  value_template: >
    {{ (value | string | replace('°C','') | replace('°','') | replace(' ','') | float(0)) }}
  command_template: "{{ [[value | float(0), 60] | min, 35] | max }}"

# --- p12: Fan stage (Manual) -----------------------------------------------
- name: "MyTHZ p12 Fan Stage (Manual)"
  unique_id: mythz_p12_fan_stage_manual
  state_topic: "fhem/Mythz/p12FanStageManual"
  command_topic: "fhem/Mythz/p12FanStageManual/cmd"
  min: 0
  max: 3
  step: 1
  value_template: "{{ value | int(0) }}"
  command_template: "{{ [[value | int(0), 3] | min, 0] | max }}"
Titel: Aw: THZ Tecalor (LWZ Stiebel Eltron) Wärmepumpe: FHEM - Home Assistant
Beitrag von: sunrise am 03 November 2025, 18:20:52
HA-Dashboard:

Code: thz-control.yaml

Der Code ist zu lang zum Einfügen als Code-Block. Er ist so lang, weil pro Parameter (P01-P12) jeweils 5 conditional Karten definiert werden, so dass - abhängig vom jeweiligen Wert - unterschiedliche Icons und Farben angezeigt werden. Wem das zu aufwändig ist, der kann statische Karten nutzen, dann eben nur 12 Stück.

EDIT:
Benötigt werden aus HACS:
custom:mushroom-number-card
custom:mushroom-template-card

HA_THZ.png