Skip to content

Commit

Permalink
add ahs valve positions 0-100%
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Jul 26, 2022
1 parent beae2a2 commit 0d69a0a
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 27 deletions.
44 changes: 31 additions & 13 deletions src/devices/boiler.cpp
Expand Up @@ -39,11 +39,13 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
register_device_value(DeviceValueTAG::TAG_AHS, &cylTopTemp_, DeviceValueType::SHORT, FL_(div10), FL_(aCylTopTemp), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_AHS, &cylCenterTemp_, DeviceValueType::SHORT, FL_(div10), FL_(aCylCenterTemp), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_AHS, &cylBottomTemp_, DeviceValueType::SHORT, FL_(div10), FL_(aCylBottomTemp), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_AHS, &valveByPass_, DeviceValueType::BOOL, nullptr, FL_(valveByPass), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_AHS, &valveBuffer_, DeviceValueType::BOOL, nullptr, FL_(valveBuffer), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_AHS, &valveReturn_, DeviceValueType::BOOL, nullptr, FL_(valveReturn), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_AHS, &aPump_, DeviceValueType::UINT, nullptr, FL_(aPump), DeviceValueUOM::PERCENT);
register_device_value(DeviceValueTAG::TAG_AHS, &heatSource_, DeviceValueType::BOOL, nullptr, FL_(heatSource), DeviceValueUOM::NONE);
// register_device_value(DeviceValueTAG::TAG_AHS, &valveByPass_, DeviceValueType::BOOL, nullptr, FL_(valveByPass), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_AHS, &valveBuffer_, DeviceValueType::UINT, nullptr, FL_(valveBuffer), DeviceValueUOM::PERCENT);
register_device_value(DeviceValueTAG::TAG_AHS, &valveReturn_, DeviceValueType::UINT, nullptr, FL_(valveReturn), DeviceValueUOM::PERCENT);
register_device_value(DeviceValueTAG::TAG_AHS, &aPumpMod_, DeviceValueType::UINT, nullptr, FL_(aPumpMod), DeviceValueUOM::PERCENT);
// register_device_value(DeviceValueTAG::TAG_AHS, &heatSource_, DeviceValueType::BOOL, nullptr, FL_(heatSource), DeviceValueUOM::NONE);
// register_device_value(DeviceValueTAG::TAG_AHS, &setValveBuffer_, DeviceValueType::ENUM, FL_(enum_am200valve), FL_(setValveBuffer), DeviceValueUOM::NONE, MAKE_CF_CB(set_valveBuffer));
// register_device_value(DeviceValueTAG::TAG_AHS, &setValveReturn_, DeviceValueType::ENUM, FL_(enum_am200valve), FL_(setValveReturn), DeviceValueUOM::NONE, MAKE_CF_CB(set_valveReturn));
return;
}
// cascaded heatingsources, only some values per individual heatsource (hs)
Expand Down Expand Up @@ -1172,21 +1174,37 @@ void Boiler::process_amTempMessage(std::shared_ptr<const Telegram> telegram) {
// 0x054E AM200 status (6 bytes long)
// Rx: 60 00 FF 00 04 4E 00 00 00 00 00 00 86
void Boiler::process_amStatusMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, aPump_, 0);
// actually we dont know the offset of the valves
// has_update(telegram, valveByPass_, 1);
// has_update(telegram, valveBuffer_, 2);
// has_update(telegram, valveReturn_, 3);
has_update(telegram, aPumpMod_, 0); // PR1
// offset 1: bitfield 01-pump on, 02-VR1 opening, 04-VR1 closing, 08-VB1 opening, 10-VB1 closing
// uint8_t stat = aPump_ | setValveBuffer_ << 3 | setValveReturn_ << 1;
// if (telegram->read_value(stat, 1)) {
// has_update(aPump_, stat & 0x01);
// has_update(valveBuffer_, (stat >> 3) & 0x03);
// has_update(valveReturn_, (stat >> 1) & 0x03);
// }
// actually we dont know the offset of VR2
// has_update(telegram, valveByPass_, ?); // VR2
has_update(telegram, valveReturn_, 4); // VR1, percent
has_update(telegram, valveBuffer_, 5); // VB1, percent
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"

// 0x054F AM200 not broadcasted message
void Boiler::process_amSettingMessage(std::shared_ptr<const Telegram> telegram) {
// has_update(telegram, setValveBuffer_, 3); // VB1 0-off, 1-open, 2-close
// has_update(telegram, setValveReturn_, 2); // VR1 0-off, 1-open, 2-close
}

// 0x0550 AM200 broadcasted message, all 27 bytes unkown
// Rx: 60 00 FF 00 04 50 00 FF 00 FF FF 00 0D 00 01 00 00 00 00 01 03 01 00 03 00 2D 19 C8 02 94 00 4A
// Rx: 60 00 FF 19 04 50 00 FF FF 39
void Boiler::process_amSettingMessage(std::shared_ptr<const Telegram> telegram) {
// has_update(telegram, setRetTemp_, ?);
// has_update(telegram, setFlowTemp_, ?);
void Boiler::process_amDataMessage(std::shared_ptr<const Telegram> telegram) {
}

#pragma GCC diagnostic pop

/*
* Hybrid heatpump with telegram 0xBB is readable and writeable in boiler and thermostat
* thermostat always overwrites settings in boiler
Expand Down
28 changes: 15 additions & 13 deletions src/devices/boiler.h
Expand Up @@ -199,20 +199,21 @@ class Boiler : public EMSdevice {
int8_t poolSetTemp_;

// Alternative Heatsource AM200
int16_t cylTopTemp_; // TB1
int16_t cylCenterTemp_; // TB2
int16_t cylBottomTemp_; // TB3
int16_t aFlowTemp_; // TA1
int16_t aRetTemp_; // TR1
uint8_t aPump_; // PR1 - percent
uint8_t valveByPass_; // VR2
uint8_t valveBuffer_; // VB1
uint8_t valveReturn_; // VR1
uint8_t heatSource_; // OEV
// int8_t setRetTemp_;
int16_t cylTopTemp_; // TB1
int16_t cylCenterTemp_; // TB2
int16_t cylBottomTemp_; // TB3
int16_t aFlowTemp_; // TA1
int16_t aRetTemp_; // TR1
// uint8_t aPump_; // PR1 - on/off
uint8_t aPumpMod_; // PR1 - percent
// uint8_t valveByPass_; // VR2
uint8_t valveBuffer_; // VB1
uint8_t valveReturn_; // VR1
// uint8_t heatSource_; // OEV
// uint8_t setValveBuffer_; // VB1
// uint8_t setValveReturn_; // VR1


/*
/*
* Hybrid heatpump with telegram 0xBB is readable and writeable in boiler and thermostat
* thermostat always overwrites settings in boiler
* enable settings here if no thermostat is used in system
Expand Down Expand Up @@ -259,6 +260,7 @@ class Boiler : public EMSdevice {
void process_amTempMessage(std::shared_ptr<const Telegram> telegram);
void process_amStatusMessage(std::shared_ptr<const Telegram> telegram);
void process_amSettingMessage(std::shared_ptr<const Telegram> telegram);
void process_amDataMessage(std::shared_ptr<const Telegram> telegram);

// commands - none of these use the additional id parameter
bool set_ww_mode(const char * value, const int8_t id);
Expand Down
16 changes: 16 additions & 0 deletions src/locale_DE.h
Expand Up @@ -224,6 +224,7 @@ MAKE_PSTR(tag_wwc7, "wwc7")
MAKE_PSTR(tag_wwc8, "wwc8")
MAKE_PSTR(tag_wwc9, "wwc9")
MAKE_PSTR(tag_wwc10, "wwc10")
MAKE_PSTR(tag_ahs, "ahs")
MAKE_PSTR(tag_hs1, "hs1")
MAKE_PSTR(tag_hs2, "hs2")
MAKE_PSTR(tag_hs3, "hs3")
Expand All @@ -243,6 +244,7 @@ MAKE_PSTR(tag_hs16, "hs16")

// MQTT topic names
// MAKE_PSTR(tag_heartbeat_mqtt, "heartbeat")
// MAKE_PSTR(tag_boiler_data_mqtt, "")
MAKE_PSTR(tag_boiler_data_ww_mqtt, "ww")
MAKE_PSTR(tag_device_data_ww_mqtt, "")

Expand Down Expand Up @@ -546,6 +548,20 @@ MAKE_PSTR_LIST(electricFactor, F("electricfactor"), F("electric energy factor"))
MAKE_PSTR_LIST(delayBoiler, F("delayboiler"), F("delay boiler support"))
MAKE_PSTR_LIST(tempDiffBoiler, F("tempdiffboiler"), F("tempediff boiler support"))

// alternative heatsource AM200
MAKE_PSTR_LIST(aCylTopTemp, F("cyltoptemp"), F("Zylinder oben Temperatur"))
MAKE_PSTR_LIST(aCylCenterTemp, F("cylcentertemp"), F("Zylinder mitte Temperatur"))
MAKE_PSTR_LIST(aCylBottomTemp, F("cylbottomtemp"), F("Zylinder unten Temperatur"))
MAKE_PSTR_LIST(aFlowTemp, F("altflowtemp"), F("Alternativ hs Flusstemperatur"))
MAKE_PSTR_LIST(aRetTemp, F("altrettemp"), F("Alternativ hs Rücktemperatur"))
MAKE_PSTR_LIST(sysFlowTemp, F("sysflowtemp"), F("System Flusstemperature"))
MAKE_PSTR_LIST(sysRetTemp, F("sysrettemp"), F("System Rücktemperature"))
MAKE_PSTR_LIST(valveByPass, F("valvebypass"), F("bypass Ventil"))
MAKE_PSTR_LIST(valveBuffer, F("valvebuffer"), F("Puffer Ventil"))
MAKE_PSTR_LIST(valveReturn, F("valvereturn"), F("Rückfluss Ventil"))
MAKE_PSTR_LIST(aPumpMod, F("altpumpmod"), F("Alternativ hs Pumpenmodulation"))
MAKE_PSTR_LIST(heatSource, F("heatsource"), F("Alternativ Heizung"))

// the following are dhw for the boiler and automatically tagged with 'ww'
MAKE_PSTR_LIST(wWSelTemp, F("wwseltemp"), F("gewählte Temperatur"))
MAKE_PSTR_LIST(wwSelTempLow, F("wwseltemplow"), F("selected lower temperature"))
Expand Down
2 changes: 1 addition & 1 deletion src/locale_EN.h
Expand Up @@ -548,7 +548,7 @@ MAKE_PSTR_LIST(sysRetTemp, F("sysrettemp"), F("system return temperature"))
MAKE_PSTR_LIST(valveByPass, F("valvebypass"), F("bypass valve"))
MAKE_PSTR_LIST(valveBuffer, F("valvebuffer"), F("buffer valve"))
MAKE_PSTR_LIST(valveReturn, F("valvereturn"), F("return valve"))
MAKE_PSTR_LIST(aPump, F("altpump"), F("alternative hs pump"))
MAKE_PSTR_LIST(aPumpMod, F("altpumpmod"), F("alternative hs pump modulation"))
MAKE_PSTR_LIST(heatSource, F("heatsource"), F("alternative heating active"))

// the following are dhw for the boiler and automatically tagged with 'ww'
Expand Down

0 comments on commit 0d69a0a

Please sign in to comment.