Skip to content

Commit

Permalink
Add support for wpl13
Browse files Browse the repository at this point in the history
  • Loading branch information
kr0ner committed Dec 7, 2024
1 parent 46a9c93 commit 34b0f43
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 137 deletions.
3 changes: 2 additions & 1 deletion esp32-poe-technik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

#########################################
Expand Down
19 changes: 14 additions & 5 deletions src/communication.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ struct CanMember {
std::uint16_t getResponseId() const { return getWriteId() | 0x200; }
};

static const CanMember ESPClient{0x6a2, "ESPClient"};
static const CanMember Anfrage{0x6a1, "Anfrage"};
static const CanMember ESPClient{0x680, "ESPClient"};
static const CanMember Kessel{0x180, "Kessel"};
static const CanMember HK1{0x301, "HK1"};
static const CanMember HK2{0x302, "HK2"};
static const CanMember HK1{0x500, "HK1"};
static const CanMember HK2{0x480, "HK2"};
static const CanMember Anfrage{0x700, "Anfrage"};

using Request = std::pair<const CanMember, const Property>;
static std::queue<Request> request_queue;
Expand All @@ -40,6 +40,14 @@ bool isRequest(const std::vector<std::uint8_t>& msg) {
return it != members.cend();
}

bool isResponse(const std::vector<std::uint8_t>& msg) {
const auto id{msg[1U] | (msg[0U] << 8U)};
const std::vector<CanMember> members = {ESPClient, Anfrage, Kessel, HK1, HK2};
const auto it = std::find_if(members.cbegin(), members.cend(),
[id](const auto& member) { return member.getResponseId() == id; });
return it != members.cend();
}

/**
* @brief Puts a request towards the \c member for the given \c property in the request queue.
* This will effectively prevent that requests are all sent at the same time, which might
Expand Down Expand Up @@ -80,7 +88,8 @@ std::pair<Property, SimpleVariant> processCanMessage(const std::vector<std::uint
ESP_LOGI("Communication",
"Message received: Read/Write ID 0x%02x 0x%02x(0x%04x) for property %s (0x%04x) with raw value: %d",
msg[0U], msg[1U], canId, std::string(property.name).c_str(), property.id, value);
if (isRequest(msg)) {
if (!isResponse(msg)) {
ESP_LOGI("Communication", "Message is not a response. Dropping it!");
return {Property::kINDEX_NOT_FOUND, value};
}
return {property, GetValueByType(value, property.type)};
Expand Down
141 changes: 10 additions & 131 deletions src/property.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,138 +56,17 @@ struct Property : public detail::Property {
Property(const std::uint16_t _id) : detail::Property{getProperty(_id)} {}

PROPERTY(INDEX_NOT_FOUND, 0x0000);
PROPERTY(FEHLERMELDUNG, 0x0001);
PROPERTY(SPEICHERSOLLTEMP, 0x0003, Type::et_dec_val);
PROPERTY(VORLAUFSOLLTEMP, 0x0004, Type::et_dec_val);
PROPERTY(AUSSENTEMP, 0x000c, Type::et_dec_val);
PROPERTY(SPEICHERISTTEMP, 0x000e, Type::et_dec_val);
PROPERTY(FEUCHTE, 0x0075, Type::et_dec_val);
PROPERTY(WOCHENTAG, 0x0121, Type::et_little_endian);
PROPERTY(TAG, 0x0122, Type::et_little_endian);
PROPERTY(MONAT, 0x0123, Type::et_little_endian);
PROPERTY(JAHR, 0x0124, Type::et_little_endian);
PROPERTY(STUNDE, 0x0125, Type::et_little_endian);
PROPERTY(MINUTE, 0x0126, Type::et_little_endian);
PROPERTY(RAUMISTTEMP, 0x0011, Type::et_dec_val);
PROPERTY(VERSTELLTE_RAUMSOLLTEMP, 0x0012, Type::et_dec_val);
PROPERTY(VERDAMPFERTEMP, 0x0014, Type::et_dec_val);
PROPERTY(RUECKLAUFISTTEMP, 0x0016, Type::et_dec_val);
PROPERTY(RAUMEINFLUSS, 0x010f, Type::et_little_endian);
PROPERTY(EL_AUFNAHMELEISTUNG_WW_TAG_WH, 0x091a);
PROPERTY(EL_AUFNAHMELEISTUNG_WW_TAG_KWH, 0x091b, Type::et_double_val);
PROPERTY(EL_AUFNAHMELEISTUNG_WW_SUM_KWH, 0x091c);
PROPERTY(EL_AUFNAHMELEISTUNG_WW_SUM_MWH, 0x091d, Type::et_double_val);
PROPERTY(EL_AUFNAHMELEISTUNG_HEIZ_TAG_WH, 0x091e);
PROPERTY(EL_AUFNAHMELEISTUNG_HEIZ_TAG_KWH, 0x091f, Type::et_double_val);
PROPERTY(EL_AUFNAHMELEISTUNG_HEIZ_SUM_KWH, 0x0920);
PROPERTY(EL_AUFNAHMELEISTUNG_HEIZ_SUM_MWH, 0x0921, Type::et_double_val);
PROPERTY(WAERMEERTRAG_2WE_WW_TAG_WH, 0x0922);
PROPERTY(WAERMEERTRAG_2WE_WW_TAG_KWH, 0x0923, Type::et_double_val);
PROPERTY(WAERMEERTRAG_2WE_WW_SUM_KWH, 0x0924);
PROPERTY(WAERMEERTRAG_2WE_WW_SUM_MWH, 0x0925, Type::et_double_val);
PROPERTY(WAERMEERTRAG_2WE_HEIZ_TAG_WH, 0x0926);
PROPERTY(WAERMEERTRAG_2WE_HEIZ_TAG_KWH, 0x0927, Type::et_double_val);
PROPERTY(WAERMEERTRAG_2WE_HEIZ_SUM_KWH, 0x0928);
PROPERTY(WAERMEERTRAG_2WE_HEIZ_SUM_MWH, 0x0929, Type::et_double_val);
PROPERTY(WAERMEERTRAG_WW_TAG_WH, 0x092a);
PROPERTY(WAERMEERTRAG_WW_TAG_KWH, 0x092b, Type::et_double_val);
PROPERTY(WAERMEERTRAG_WW_SUM_KWH, 0x092c);
PROPERTY(WAERMEERTRAG_WW_SUM_MWH, 0x092d, Type::et_double_val);
PROPERTY(WAERMEERTRAG_HEIZ_TAG_WH, 0x092e);
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);

#if defined(THZ_504) || defined(THZ_404) || defined(THZ_5_5_ECO)
PROPERTY(RAUMSOLLTEMP_I, 0x0005, Type::et_dec_val);
PROPERTY(RAUMSOLLTEMP_NACHT, 0x0008, Type::et_dec_val);
PROPERTY(SAMMLERISTTEMP, 0x000d, Type::et_dec_val);
PROPERTY(VORLAUFISTTEMP, 0x000f, Type::et_dec_val);
PROPERTY(EINSTELL_SPEICHERSOLLTEMP, 0x0013, Type::et_dec_val);
PROPERTY(PROGRAMMSCHALTER, 0x0112, Type::et_betriebsart);
PROPERTY(HYSTERESE_WW, 0x0140, Type::et_dec_val);
PROPERTY(BETRIEBS_STATUS, 0x0176);
PROPERTY(VOLUMENSTROM, 0x01da, Type::et_dec_val);
PROPERTY(TAUPUNKT_HK1, 0x0264, Type::et_dec_val);
PROPERTY(KUEHLMODE, 0x0287);
PROPERTY(PUMPENDREHZAHL_HEIZEN, 0x02cb, Type::et_dec_val);
PROPERTY(LAUFZEIT_FILTER_TAGE, 0x0341);
PROPERTY(WAERMEERTRAG_RUECKGE_TAG_WH, 0x03ae);
PROPERTY(WAERMEERTRAG_RUECKGE_TAG_KWH, 0x03af);
PROPERTY(WAERMEERTRAG_RUECKGE_SUM_KWH, 0x03b0);
PROPERTY(WAERMEERTRAG_RUECKGE_SUM_MWH, 0x03b1);
PROPERTY(KUEHL_RAUMSOLL_TAG, 0x0569, Type::et_dec_val);
PROPERTY(KUEHL_RAUMSOLL_ABWESEND, 0x056a, Type::et_dec_val);
PROPERTY(KUEHL_RAUMSOLL_NACHT, 0x056b, Type::et_dec_val);
PROPERTY(LUEFT_STUFE_TAG, 0x056c);
PROPERTY(LUEFT_STUFE_NACHT, 0x056d);
PROPERTY(LUEFT_STUFE_PARTY, 0x0570);
PROPERTY(PASSIVKUEHLUNG, 0x0575);
PROPERTY(NE_STUFE_WW, 0x058a);
PROPERTY(ZULUFT_SOLL, 0x0596);
PROPERTY(ZULUFT_IST, 0x0597);
PROPERTY(ABLUFT_SOLL, 0x0598);
PROPERTY(ABLUFT_IST, 0x0599);
PROPERTY(FORTLUFT_SOLL, 0x059a);
PROPERTY(FORTLUFT_IST, 0x059b);
PROPERTY(PUMPENZYKLEN_MIN_AUSSENT, 0x05bb);
PROPERTY(KUEHLSYSTEM, 0x0613);
PROPERTY(DRUCK_HEIZKREIS, 0x064a, Type::et_dec_val);
PROPERTY(LEISTUNG_AUSLEGUNG_KUEHLEN, 0x0692);
PROPERTY(MOTORSTROM, 0x069f);
PROPERTY(MOTORLEISTUNG, 0x06a0, Type::et_cent_val);
PROPERTY(MOTORSPANNUNG, 0x06a1);
PROPERTY(ABLUFTTEMP, 0x0694, Type::et_dec_val);
PROPERTY(ANZEIGE_NIEDERDRUCK, 0x07a7, Type::et_dec_val);
PROPERTY(HEIZ_KUEHL_LEISTUNG, 0xc0ee, Type::et_cent_val);
PROPERTY(ABLUFTFEUCHTE, 0xc0ef);
PROPERTY(LEISTUNG_AUSLEGUNG_HEIZUNG, 0xc0f1);
PROPERTY(VERDICHTER_STARTS, 0xc0f4);
PROPERTY(VERDICHTER_STARTS_K, 0xc0f5);
PROPERTY(ABLUFT_TAUPUNKT, 0xc0f6, Type::et_dec_val);
PROPERTY(LAUFZEIT_FILTER, 0xc111);
PROPERTY(DIFFERENZDRUCK, 0xc11e);
PROPERTY(BETRIEBS_STATUS_2, 0xc356);
#endif

#if defined(THZ_5_5_ECO)
PROPERTY(SOMMERBETRIEB_TEMP, 0x0116, Type::et_dec_val);
PROPERTY(LUEFT_STUFE_BEREITSCHAFT, 0x056f);
PROPERTY(LUEFT_ZEIT_AUSSERPLAN_STUFE1, 0x0572);
PROPERTY(LUEFT_ZEIT_AUSSERPLAN_STUFE2, 0x0573);
PROPERTY(LUEFT_ZEIT_AUSSERPLAN_STUFE3, 0x0574);
PROPERTY(LUEFT_ZULUFT_STUFE1, 0x0576);
PROPERTY(LUEFT_ZULUFT_STUFE2, 0x0577);
PROPERTY(LUEFT_ZULUFT_STUFE3, 0x0578);
PROPERTY(LUEFT_ABLUFT_STUFE1, 0x0579);
PROPERTY(LUEFT_ABLUFT_STUFE2, 0x057a);
PROPERTY(LUEFT_ABLUFT_STUFE3, 0x057b);
PROPERTY(SOMMERBETRIEB_HYSTERESE, 0x05a2, Type::et_dec_val);
PROPERTY(LUEFT_STUFE_HAND, 0x0612);
#endif

#if defined(TTF_07_C)
PROPERTY(PROGRAMMSCHALTER, 0x005a);
PROPERTY(PUFFERISTTEMP, 0x0078, Type::et_dec_val);
PROPERTY(QUELLE_IST, 0x01d4, Type::et_dec_val);
PROPERTY(PUFFERSOLLTEMP, 0x01d5, Type::et_dec_val);
PROPERTY(HKSOLLTEMP, 0x01d7, Type::et_dec_val);
PROPERTY(HEIZGASTEMP, 0x0265, Type::et_dec_val);
PROPERTY(DRUCK_HOCHDRUCK, 0x0268, Type::et_dec_val);
PROPERTY(HKISTTEMP, 0x02ca, Type::et_dec_val);
PROPERTY(VOLUMENSTROM, 0x0673, Type::et_cent_val);
PROPERTY(DRUCK_HEIZKREIS, 0x0674, Type::et_cent_val);
PROPERTY(QUELLENDRUCK, 0x0675, Type::et_cent_val);
PROPERTY(VORLAUFISTTEMP, 0x06a1, Type::et_dec_val);
PROPERTY(VERDICHTER_STARTS, 0x071d);
PROPERTY(VERDICHTER_STARTS_K, 0x071c);
PROPERTY(DRUCK_NIEDERDRUCK, 0x07a5, Type::et_dec_val);
PROPERTY(HEIZEN, 0x07fc);
PROPERTY(KUEHLEN, 0x07ff);
PROPERTY(WARMWASSER, 0x0802);
PROPERTY(ANLAGENFROST, 0x0a00, Type::et_dec_val);
PROPERTY(WW_ECO, 0x0a06, Type::et_dec_val);
#endif
PROPERTY(RUECKLAUFISTTEMP, 0x0016, Type::et_dec_val);
PROPERTY(AUSSENTEMP, 0x000c, Type::et_dec_val);
PROPERTY(QUELLENDRUCK, 0x79c1, Type::et_cent_val);
PROPERTY(TAUPUNKTTEMPERATUR, 0x4fa6, Type::et_dec_val);
PROPERTY(KOMFORTTEMPERATUR_HK1, 0xc2d5,Type::et_dec_val);
// Here we can gradually add new values and then add the sensors in the yaml
// We would need to find out which id belongs to for example VORLAUF_IST to be able to identify the can ID for HK1
// also nice would be BETRIEBSSCHALTER to know which can id is kessel. Once these wotk we can try to request the data actively
// by sending messages to the heatpump
// to find new values you need to navigate through the diplay in the heatpump and match the values (e.g. 322 for 32.2°)
};

#endif
1 change: 1 addition & 0 deletions src/simple_variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string>
#include <tuple>
#include <type_traits>
#include <typeinfo>

template <typename T>
struct is_string
Expand Down
56 changes: 56 additions & 0 deletions yaml/wpl13.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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"

#########################################
# #
# 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: 680
use_extended_id: false
bit_rate: 20kbps
on_frame:
- can_id: 0
can_id_mask: 0
then:
- lambda: |-
ESP_LOGI("CAN", "message received with CAN-Id 0x%04x", can_id);
const auto property_value_pair = processCanMessage(x);
packages:
AUSSENTEMP: !include { file: wp_temperature.yaml, vars: { property: "AUSSENTEMP" }}
RUECKLAUFISTTEMP: !include { file: wp_temperature.yaml, vars: { property: "RUECKLAUFISTTEMP" }}
TAUPUNKTTEMPERATUR: !include { file: wp_temperature.yaml, vars: { property: "TAUPUNKTTEMPERATUR", target: "HK1" }}
QUELLENDRUCK: !include { file: wp_generic.yaml, vars: { property: "QUELLENDRUCK" , unit: "bar" , icon: "mdi:water-pressure", accuracy_decimals: "1" }}
# add new sensors that you want to expose to HA here ... look at the parameters that you can pass to them ... maybe you need to override target with HK1, or HK2. Depends where the values are incoming

0 comments on commit 34b0f43

Please sign in to comment.