From f183ca6883b6e8aa33e93a1e9498b7221d85c838 Mon Sep 17 00:00:00 2001 From: kr0ner Date: Mon, 9 Dec 2024 23:57:08 +0100 Subject: [PATCH] Adds support for WPL13 --- esp32-poe-technik.yaml | 3 +- src/communication.h | 3 +- src/property.h | 20 +++++++++ yaml/wp_temperature.yaml | 7 ++-- yaml/wpl13.yaml | 88 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 yaml/wpl13.yaml diff --git a/esp32-poe-technik.yaml b/esp32-poe-technik.yaml index 853a19f..93d2872 100644 --- a/esp32-poe-technik.yaml +++ b/esp32-poe-technik.yaml @@ -97,9 +97,10 @@ packages: watermeter: !include OneESP32ToRuleThemAll/yaml/watermeter.yaml sensors: !include OneESP32ToRuleThemAll/yaml/sensors.yaml # thz404: !include OneESP32ToRuleThemAll/yaml/thz404.yaml - thz504: !include OneESP32ToRuleThemAll/yaml/thz504.yaml +# thz504: !include OneESP32ToRuleThemAll/yaml/thz504.yaml # thz55eco: !include OneESP32ToRuleThemAll/yaml/thz5_5_eco.yaml # ttf07: !include OneESP32ToRuleThemAll/yaml/ttf07.yaml + wpl13: !include OneESP32ToRuleThemAll/yaml/wpl13.yaml kondensatpumpe: !include OneESP32ToRuleThemAll/yaml/kondensatpumpe.yaml ######################################### diff --git a/src/communication.h b/src/communication.h index 7d06579..2b978e9 100644 --- a/src/communication.h +++ b/src/communication.h @@ -25,8 +25,9 @@ static const CanMember Manager{MANAGER_ID, "Manager"}; static const CanMember Kessel{KESSEL_ID, "Kessel"}; static const CanMember HK1{HK1_ID, "HK1"}; static const CanMember HK2{HK2_ID, "HK2"}; +static const CanMember FET{0x402, "FET"}; -static const std::vector> canMembers{Kessel, HK1, HK2, Manager, ESPClient}; +static const std::vector> canMembers{Kessel, HK1, HK2, Manager, FET, ESPClient}; using Request = std::pair; static std::queue request_queue; diff --git a/src/property.h b/src/property.h index 6e3f13a..4bb11bc 100644 --- a/src/property.h +++ b/src/property.h @@ -56,6 +56,8 @@ struct Property : public detail::Property { Property(const std::uint16_t _id) : detail::Property{getProperty(_id)} {} PROPERTY(INDEX_NOT_FOUND, 0x0000); + +#if !defined(WPL_13) PROPERTY(FEHLERMELDUNG, 0x0001); PROPERTY(SPEICHERSOLLTEMP, 0x0003, Type::et_dec_val); PROPERTY(VORLAUFSOLLTEMP, 0x0004, Type::et_dec_val); @@ -97,6 +99,7 @@ struct Property : public detail::Property { PROPERTY(WAERMEERTRAG_HEIZ_TAG_KWH, 0x092f, Type::et_double_val); PROPERTY(WAERMEERTRAG_HEIZ_SUM_KWH, 0x0930); PROPERTY(WAERMEERTRAG_HEIZ_SUM_MWH, 0x0931, Type::et_double_val); +#endif #if defined(THZ_504) || defined(THZ_404) || defined(THZ_5_5_ECO) PROPERTY(RAUMSOLLTEMP_I, 0x0005, Type::et_dec_val); @@ -190,6 +193,23 @@ struct Property : public detail::Property { PROPERTY(ANLAGENFROST, 0x0a00, Type::et_dec_val); PROPERTY(WW_ECO, 0x0a06, Type::et_dec_val); #endif + +#if defined(WPL_13) + PROPERTY(AUSSENTEMP, 0x000c, Type::et_dec_val); + PROPERTY(PUFFERISTTEMPERATUR, 0x0078, Type::et_dec_val); + PROPERTY(KOMFORTTEMPERATUR, 0x4eb8, Type::et_dec_val); + PROPERTY(ISTTEMPERATUR, 0x4eb4, Type::et_dec_val); + PROPERTY(RAUMISTTEMP, 0x4ec7, Type::et_dec_val); + PROPERTY(RAUMSOLLTEMP, 0x4ece, Type::et_dec_val); + PROPERTY(RAUMFEUCHTE, 0x4ec8, Type::et_dec_val); + PROPERTY(HEAT_EFF_1D, 0x501d, Type::et_dec_val); + PROPERTY(HEAT_EFF_1Y, 0x501e, Type::et_dec_val); + PROPERTY(VORLAUFTEMP_QUELLE, 0x4fa7, Type::et_dec_val); + PROPERTY(QUELLENDRUCK, 0x4fa8, Type::et_dec_val); + PROPERTY(LEISTUNG_QUELLENPUMPE, 0x4fa9, Type::et_dec_val); + PROPERTY(STROM_INVERTER, 0x06b2, Type::et_dec_val); + PROPERTY(SPANNUNG_INVERTER, 0x06b1, Type::et_dec_val); +#endif }; #endif diff --git a/yaml/wp_temperature.yaml b/yaml/wp_temperature.yaml index 56c5e22..08492a2 100644 --- a/yaml/wp_temperature.yaml +++ b/yaml/wp_temperature.yaml @@ -1,11 +1,12 @@ defaults: interval: $interval_very_slow target: "Kessel" + name_suffix: "" sensor: - platform: template - name: ${property} - id: ${property} + name: ${property}${name_suffix} + id: ${property}${name_suffix} unit_of_measurement: "°C" icon: "mdi:thermometer-lines" device_class: "temperature" @@ -22,6 +23,6 @@ esphome: then: - lambda: |- CallbackHandler::instance().addCallback(std::make_pair(${target},Property::k${property}),[](const SimpleVariant& value){ - id(${property}).publish_state(value); + id(${property}${name_suffix}).publish_state(value); }); queueRequest(${target}, Property::k${property}); diff --git a/yaml/wpl13.yaml b/yaml/wpl13.yaml new file mode 100644 index 0000000..ba7ffd3 --- /dev/null +++ b/yaml/wpl13.yaml @@ -0,0 +1,88 @@ +esphome: + includes: + - OneESP32ToRuleThemAll/src/callback_handler.h + - OneESP32ToRuleThemAll/src/communication.h + - OneESP32ToRuleThemAll/src/mapper.h + - OneESP32ToRuleThemAll/src/mapper.cpp + - OneESP32ToRuleThemAll/src/property.h + - OneESP32ToRuleThemAll/src/property.cpp + - OneESP32ToRuleThemAll/src/simple_variant.h + - OneESP32ToRuleThemAll/src/type.h + - OneESP32ToRuleThemAll/src/type.cpp + platformio_options: + build_flags: + - "-DWPL_13" + - "-DESPCLIENT_ID=$espclient_can_id" + - "-DMANAGER_ID=$manager_can_id" + - "-DKESSEL_ID=$kessel_can_id" + - "-DHK1_ID=$hk1_can_id" + - "-DHK2_ID=$hk2_can_id" + +substitutions: + kessel_can_id: "0x180" + hk1_can_id: "0x601" + hk2_can_id: "0x602" + manager_can_id: "0x514" + espclient_can_id: "0x004" + +######################################### +# # +# Intervals # +# # +######################################### +interval: + - interval: 250ms + then: + - lambda: |- + // Request sensor value one after another. + if(!request_queue.empty()) { + constexpr auto use_extended_id{false}; + const auto request_element = request_queue.front(); + request_queue.pop(); + requestData(request_element.first, request_element.second); + } + +######################################### +# # +# CANbus configuration # +# # +######################################### +canbus: + - id: wp_can + can_id: $espclient_can_id + use_extended_id: false + bit_rate: 50kbps + on_frame: + - can_id: 0 + can_id_mask: 0 + then: + - lambda: |- + ESP_LOGD("CAN", "Can message received with CANId 0x%04lx", can_id); + const auto [property, value] = processCanMessage(x); + const auto canMember = getCanMemberByCanId(can_id); + if(canMember) { + auto callback = CallbackHandler::instance().getCallback(std::make_pair(canMember->get(),property)); + callback(value); + } else { + ESP_LOGD("CAN", "No CANMember with CANId 0x%04lx available.", can_id); + } + +packages: + AUSSENTEMP: !include { file: wp_temperature.yaml, vars: { property: "AUSSENTEMP" }} + ISTTEMPERATUR_HK1: !include { file: wp_temperature.yaml, vars: { property: "ISTTEMPERATUR" , name_suffix: "_HK1" , target: "HK1" }} + KOMFORTTEMPERATUR_HK1: !include { file: wp_temperature.yaml, vars: { property: "KOMFORTTEMPERATUR" , name_suffix: "_HK1" , target: "HK1" }} + ISTTEMPERATUR_HK2: !include { file: wp_temperature.yaml, vars: { property: "ISTTEMPERATUR" , name_suffix: "_HK2" , target: "HK2" }} + KOMFORTTEMPERATUR_HK2: !include { file: wp_temperature.yaml, vars: { property: "KOMFORTTEMPERATUR" , name_suffix: "_HK2" , target: "HK2" }} + PUFFERISTTEMPERATUR: !include { file: wp_temperature.yaml, vars: { property: "PUFFERISTTEMPERATUR" }} + RAUMISTTEMP_HK1: !include { file: wp_temperature.yaml, vars: { property: "RAUMISTTEMP" , name_suffix: "_HK1" , target: "HK1" }} + RAUMISTTEMP_HK2: !include { file: wp_temperature.yaml, vars: { property: "RAUMISTTEMP" , name_suffix: "_HK2" , target: "HK2" }} + RAUMSOLLTEMP_HK1: !include { file: wp_temperature.yaml, vars: { property: "RAUMSOLLTEMP" , name_suffix: "_HK1" , target: "HK1" }} + RAUMSOLLTEMP_HK2: !include { file: wp_temperature.yaml, vars: { property: "RAUMSOLLTEMP" , name_suffix: "_HK2" , target: "HK2" }} + RAUMFEUCHTE: !include { file: wp_generic.yaml, vars: { property: "RAUMFEUCHTE" , interval: $interval_very_slow, unit: "%", icon: "mdi:water-percent", accuracy_decimals: "1", target: "FET" }} + HEAT_EFF_1D: !include { file: wp_number.yaml, vars: { property: "HEAT_EFF_1D" }} + HEAT_EFF_1Y: !include { file: wp_number.yaml, vars: { property: "HEAT_EFF_1Y" }} + VORLAUFTEMP_QUELLE: !include { file: wp_temperature.yaml, vars: { property: "VORLAUFTEMP_QUELLE" }} + QUELLENDRUCK: !include { file: wp_generic.yaml, vars: { property: "QUELLENDRUCK" , interval: never, unit: "bar" , icon: "mdi:water-pressure" , accuracy_decimals: "1" }} + LEISTUNG_QUELLENPUMPE: !include { file: wp_generic.yaml, vars: { property: "LEISTUNG_QUELLENPUMPE" , interval: never, unit: "%" , icon: "mdi:water-percent", accuracy_decimals: "1", target: "Manager" }} + STROM_INVERTER: !include { file: wp_generic.yaml, vars: { property: "STROM_INVERTER" , interval: never, unit: "A" , target: "Manager"}} + SPANNUNG_INVERTER: !include { file: wp_generic.yaml, vars: { property: "SPANNUNG_INVERTER" , interval: never, unit: "V" , target: "Manager"}} \ No newline at end of file