esphome: name: kaminofen-pumpensteuerung friendly_name: Kaminofen Pumpensteuerung esp32: board: esp32dev framework: type: arduino # Enable logging logger: # Enable Home Assistant API api: encryption: key: "" ota: - platform: esphome password: "" wifi: ssid: !secret wifi_ssid password: !secret wifi_password # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Kaminofen-Pumpensteuerung" password: "wetZ2Vv3WE20" web_server: port: 80 captive_portal: # LED exposed as binary light output: - platform: gpio pin: GPIO23 id: output_led light: - platform: binary id: light_led name: LED output: output_led # Relays exposed as switches switch: - platform: gpio pin: GPIO16 id: Pumpe_Kamin name: Pumpe_Ralay1 - platform: gpio pin: GPIO17 id: relay_2 name: Relay 2 # Temp Sensor on GPIO18 (Alternative to GPIO5) one_wire: - platform: gpio pin: 18 id: bus1 - platform: gpio pin: 27 id: bus2 globals: - id: energie_BWP type: float initial_value: '100' restore_value: true - id: energie_BWP_temp type: float initial_value: '0.0' - id: energie_Kamin type: float initial_value: '100' restore_value: true - id: energie_Kamin_temp type: float initial_value: '0.0' # Individual sensors using dallas_temp sensor: - platform: dallas_temp address: 0xf366f1d4457bd128 update_interval: 10s name: Kamin_Taschen_temperatur unit_of_measurement: "°C" accuracy_decimals: 2 id: kamin_temp one_wire_id: bus1 - platform: dallas_temp address: 0xe63ce1e380dfc028 update_interval: 10s name: Pufferspeicher_Temperatur_1 unit_of_measurement: "°C" accuracy_decimals: 2 id: puffer_temp one_wire_id: bus1 - platform: dallas_temp address: 0x103ce104579d7828 update_interval: 10s name: Pufferspeicher_Temperatur_2 unit_of_measurement: "°C" accuracy_decimals: 2 id: puffer_temp_2 one_wire_id: bus1 - platform: dallas_temp address: 0x243c01f096ec0c28 update_interval: 10s name: Pufferspeicher_Temperatur_4 unit_of_measurement: "°C" accuracy_decimals: 2 id: puffer_temp_4 one_wire_id: bus1 - platform: dallas_temp address: 0x0f3ce10457184d28 update_interval: 10s name: Pufferspeicher_Temperatur_5 unit_of_measurement: "°C" accuracy_decimals: 2 id: puffer_temp_5 one_wire_id: bus1 - platform: dallas_temp address: 0xfd73ead4453a3328 update_interval: 10s name: Wohnzimmer_Temperatur unit_of_measurement: "°C" accuracy_decimals: 2 id: Wohnzimmer_Temperatur one_wire_id: bus1 - platform: dallas_temp address: 0x6900000035462c28 update_interval: 10s name: Kamin_Vorlauf_temp unit_of_measurement: "°C" accuracy_decimals: 2 id: Kamin_Vorlauf_temp one_wire_id: bus2 - platform: dallas_temp address: 0xc4000000385ba128 update_interval: 10s name: Kamin_Ruecklauf_temp unit_of_measurement: "°C" accuracy_decimals: 2 id: Kamin_Ruecklauf one_wire_id: bus2 - platform: dallas_temp address: 0x193ce1e380863528 update_interval: 10s name: BWP_Ruecklauf_temp unit_of_measurement: "°C" accuracy_decimals: 2 id: BWP_Ruecklauf_temp one_wire_id: bus2 - platform: dallas_temp address: 0xa24132d4456ad928 update_interval: 10s name: BWP_Vorlauf_temp unit_of_measurement: "°C" accuracy_decimals: 2 id: BWP_Vorlauf_temp one_wire_id: bus2 - platform: pulse_counter pin: GPIO14 # Pin für Hallsensor / Durchflusssensor name: "Durchfluss_Kamin" update_interval: 10s unit_of_measurement: "L/min" device_class: water filters: - multiply: 0.00309917355371591 accuracy_decimals: 1 id: durchfluss_kamin - platform: pulse_counter pin: GPIO26 # Pin für Hallsensor / Durchflusssensor name: "Durchfluss_BWP" update_interval: 10s unit_of_measurement: "L/min" device_class: water filters: - multiply: 0.00252525252525 accuracy_decimals: 1 id: durchfluss_BWP - platform: template name: "Leistung_Kamin_Wasser" update_interval: 10s device_class: "power" unit_of_measurement: "W" id: "Leistung_Kamin_Wasser" lambda: |- float ruecklauf = id(Kamin_Ruecklauf)->state; float vorlauf = id(Kamin_Vorlauf_temp)->state; float delta_T = vorlauf-ruecklauf; //spreizung in K float volumenstrom = id(durchfluss_kamin)->state; //l/min float leistung = volumenstrom*69.7*delta_T; return leistung; //Leistung in W - platform: template name: "Leistung_BWP" update_interval: 10s device_class: "power" unit_of_measurement: "W" lambda: |- float ruecklauf = id(BWP_Ruecklauf_temp)->state; float vorlauf = id(BWP_Vorlauf_temp)->state; float delta_T = vorlauf-ruecklauf; //spreizung in K float volumenstrom = id(durchfluss_BWP)->state; //l/min float leistung = volumenstrom*69.7*delta_T; return leistung; //Leistung in W - platform: template name: "Leistung_Kamin_Luft" update_interval: 10s device_class: "power" unit_of_measurement: "W" id: "Leistung_Kamin_Luft" lambda: |- float leistung=id(Leistung_Kamin_Wasser)->state; return leistung / 0.6 * 0.4; - platform: template name: "Leistung_Kamin_Gesamt" update_interval: 10s device_class: "power" unit_of_measurement: "W" id: "Leistung_Kamin_Gesamt" lambda: |- float leistung=id(Leistung_Kamin_Wasser)->state; return leistung / 0.6 * 1.0; # Input für Home Assistant, um die Steuerparameter einzustellen number: - platform: template name: "Mindesttemperatur für Pumpe" id: min_temp initial_value: 60.0 min_value: 5.0 max_value: 90.0 step: 1.0 optimistic: true - platform: template name: "Spreizung" id: spreizung initial_value: 6.0 min_value: 1.0 max_value: 20.0 step: 0.5 optimistic: true - platform: template name: "Hysterese" id: hysterese initial_value: 4.0 min_value: 1.0 max_value: 10.0 step: 0.5 optimistic: true - platform: template name: "Maximaltemperatur damit Pumpe dauerhaft an" id: max_temp initial_value: 85.0 min_value: 60 max_value: 100 step: 1.0 optimistic: true # Regelmäßige Prüfung der Steuerlogik für die Pumpe interval: - interval: 10s then: - lambda: |- auto kamin_temp_sensor = id(kamin_temp); auto puffer_temp_sensor = id(puffer_temp); auto min_temp_number = id(min_temp); auto spreizung_number = id(spreizung); auto hysterese_number = id(hysterese); auto max_temp_number = id(max_temp); float kamin_temp = kamin_temp_sensor->state; float puffer_temp = puffer_temp_sensor->state; float min_temp = min_temp_number->state; float spreizung = spreizung_number->state; float hysterese = hysterese_number->state; float max_temp = max_temp_number->state; float einschalt_temp; float ausschalt_temp; // Debug-Ausgabe ESP_LOGD("debug", "Kamin Temp: %.1f", kamin_temp); ESP_LOGD("debug", "Puffer Temp: %.1f", puffer_temp); ESP_LOGD("debug", "Mindesttemperatur: %.1f", min_temp); ESP_LOGD("debug", "Spreizung: %.1f", spreizung); ESP_LOGD("debug", "Hysterese: %.1f", hysterese); ESP_LOGD("debug", "max_temp: %.1f", max_temp); //Einschalt_temp tempertur festelgen if ((puffer_temp + spreizung + hysterese) > (min_temp+hysterese)) { einschalt_temp = puffer_temp + spreizung + hysterese; } else { einschalt_temp=min_temp+hysterese; } ESP_LOGD("debug", "Einschalt_temp: %.1f", einschalt_temp); // Pumpe einschalten, wenn die Bedingungen erfüllt sind if (kamin_temp >= min_temp) { if (kamin_temp > einschalt_temp) { id(Pumpe_Kamin).turn_on(); ESP_LOGI("Pumpensteuerung", "Pumpe eingeschaltet: Kamin ist heißer als Einschlattemperatur."); } } //Aus-schalt_temp tempertur festelgen if ((puffer_temp + spreizung) > (min_temp)) { ausschalt_temp=puffer_temp + spreizung; } else { ausschalt_temp=min_temp; } ESP_LOGD("debug", "Ausschalt_temp: %.1f", ausschalt_temp); //Pumpe ausschalten, wenn die Temperaturdifferenz unter das Soll fällt if (kamin_temp <=ausschalt_temp) { id(Pumpe_Kamin).turn_off(); ESP_LOGI("Pumpensteuerung", "Pumpe ausgeschaltet: Temperatur unter Ausschalttemperatur."); } // Pumpe immer aus, wenn die Kamin-Temperatur unter Mindesttemperatur liegt if (kamin_temp < min_temp) { id(Pumpe_Kamin).turn_off(); ESP_LOGI("Pumpensteuerung", "Pumpe ausgeschaltet: Kamin-Temperatur unter Mindesttemperatur."); } if(kamin_temp > max_temp) { id(Pumpe_Kamin).turn_on(); ESP_LOGI("Pumpensteuerung", "Pumpe dauerhaft eingeschaltet: Kamin-Temperatur zu hoch."); }