Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
minor updates to solar cfg - #616
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Nov 17, 2020
1 parent 4504f25 commit 52e120a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 32 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- `wwonetime` for RC300 thermostat
- expose test framework via api (#611)
- SysLog has enable/disable flag in WebUI
- Add solar configuration telegrams (#616) [thanks @hpanther]

### Fixed
- mixer IPM pumpstatus
Expand Down
60 changes: 32 additions & 28 deletions src/devices/solar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s
register_telegram_type(0x07AA, F("SM100wwStatus"), false, [&](std::shared_ptr<const Telegram> t) { process_SM100wwStatus(t); });
register_telegram_type(0x07AB, F("SM100wwCommand"), false, [&](std::shared_ptr<const Telegram> t) { process_SM100wwCommand(t); });
} else {
register_telegram_type(EMS_TYPE_ParamCfg, F("ParamCfg"), false, [&](std::shared_ptr<const Telegram> t) { process_SM100ParamCfg(t); });
register_telegram_type(0xF9, F("ParamCfg"), false, [&](std::shared_ptr<const Telegram> t) { process_SM100ParamCfg(t); });
register_telegram_type(0x0358, F("SM100SystemConfig"), true, [&](std::shared_ptr<const Telegram> t) { process_SM100SystemConfig(t); });
register_telegram_type(0x035A, F("SM100SolarCircuitConfig"), true, [&](std::shared_ptr<const Telegram> t) { process_SM100SolarCircuitConfig(t); });
register_telegram_type(0x0362, F("SM100Monitor"), true, [&](std::shared_ptr<const Telegram> t) { process_SM100Monitor(t); });
Expand Down Expand Up @@ -217,7 +217,7 @@ bool Solar::export_values(JsonObject & json) {
if (Helpers::hasValue(tank1MaxTempCurrent_)) {
json["tank1MaxTempCurrent"] = tank1MaxTempCurrent_;
}

if (Helpers::hasValue(heatExchangerTemp_)) {
json["heatExchangerTemp"] = (float)heatExchangerTemp_ / 10;
}
Expand Down Expand Up @@ -288,28 +288,28 @@ void Solar::process_SM10Monitor(std::shared_ptr<const Telegram> telegram) {
* e.g. B0 0B FF 00 02 58 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 00 FF 01 00 00
*/
void Solar::process_SM100SystemConfig(std::shared_ptr<const Telegram> telegram) {
changed_ |= telegram->read_value(heatTransferSystem_ , 5, 1);
changed_ |= telegram->read_value(externalTank_ , 9, 1);
changed_ |= telegram->read_value(thermalDisinfect_ , 10, 1);
changed_ |= telegram->read_value(heatMetering_ , 14, 1);
changed_ |= telegram->read_value(solarIsEnabled_ , 19, 1);
changed_ |= telegram->read_value(heatTransferSystem_, 5, 1);
changed_ |= telegram->read_value(externalTank_, 9, 1);
changed_ |= telegram->read_value(thermalDisinfect_, 10, 1);
changed_ |= telegram->read_value(heatMetering_, 14, 1);
changed_ |= telegram->read_value(solarIsEnabled_, 19, 1);
}

/*
* process_SM100SolarCircuitConfig - type 0x035A EMS+ - for MS/SM100 and MS/SM200
* e.g. B0 0B FF 00 02 5A 64 05 00 58 14 01 01 32 64 00 00 00 5A 0C
*/
void Solar::process_SM100SolarCircuitConfig(std::shared_ptr<const Telegram> telegram) {
changed_ |= telegram->read_value(collectorTempMax_ , 0, 1);
changed_ |= telegram->read_value(tank1MaxTempCurrent_ , 3, 1);
changed_ |= telegram->read_value(collectorTempMin_ , 4, 1);
changed_ |= telegram->read_value(solarPumpMode_ , 5, 1);
changed_ |= telegram->read_value(solarPumpMinRPM_ , 6, 1);
changed_ |= telegram->read_value(collectorTempMax_, 0, 1);
changed_ |= telegram->read_value(tank1MaxTempCurrent_, 3, 1);
changed_ |= telegram->read_value(collectorTempMin_, 4, 1);
changed_ |= telegram->read_value(solarPumpMode_, 5, 1);
changed_ |= telegram->read_value(solarPumpMinRPM_, 6, 1);
changed_ |= telegram->read_value(solarPumpTurnoffDiff_, 7, 1);
changed_ |= telegram->read_value(solarPumpTurnonDiff_ , 8, 1);
changed_ |= telegram->read_value(solarPumpKick_ , 9, 1);
changed_ |= telegram->read_value(plainWaterMode_ , 10, 1);
changed_ |= telegram->read_value(doubleMatchFlow_ , 11, 1);
changed_ |= telegram->read_value(solarPumpTurnonDiff_, 8, 1);
changed_ |= telegram->read_value(solarPumpKick_, 9, 1);
changed_ |= telegram->read_value(plainWaterMode_, 10, 1);
changed_ |= telegram->read_value(doubleMatchFlow_, 11, 1);
}

/* process_SM100ParamCfg - type 0xF9 EMS 1.0
Expand All @@ -329,19 +329,18 @@ void Solar::process_SM100SolarCircuitConfig(std::shared_ptr<const Telegram> tele
*/
void Solar::process_SM100ParamCfg(std::shared_ptr<const Telegram> telegram) {
uint16_t t_id;
uint8_t of;
int32_t min,def,max,cur;
uint8_t of;
int32_t min, def, max, cur;
telegram->read_value(t_id, 1);
telegram->read_value(of, 3);
telegram->read_value(min, 5);
telegram->read_value(def, 9);
telegram->read_value(max, 13);
telegram->read_value(cur, 17);

LOG_DEBUG(F("SM100ParamCfg param=0x%04X, offset=%d, min=%d, default=%d, max=%d, current=%d"),
t_id, of, min, def, max, cur);

// LOG_DEBUG(F("SM100ParamCfg param=0x%04X, offset=%d, min=%d, default=%d, max=%d, current=%d"), t_id, of, min, def, max, cur);
}

/*
* SM100Monitor - type 0x0362 EMS+ - for MS/SM100 and MS/SM200
* e.g. B0 0B FF 00 02 62 00 77 01 D4 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 F9 80 00 80 9E - for heat exchanger temp
Expand Down Expand Up @@ -378,11 +377,13 @@ void Solar::process_SM100wwTemperature(std::shared_ptr<const Telegram> telegram)
// changed_ |= telegram->read_value(wwTemp_5_, 8);
// changed_ |= telegram->read_value(wwTemp_7_, 12);
}

// SM100wwStatus - 0x07AA
// Solar Module(0x2A) -> (0x00), (0x7AA), data: 64 00 04 00 03 00 28 01 0F
void Solar::process_SM100wwStatus(std::shared_ptr<const Telegram> telegram) {
// changed_ |= telegram->read_value(wwPump_, 0);
}

// SM100wwCommand - 0x07AB
// Thermostat(0x10) -> Solar Module(0x2A), (0x7AB), data: 01 00 01
void Solar::process_SM100wwCommand(std::shared_ptr<const Telegram> telegram) {
Expand Down Expand Up @@ -444,7 +445,6 @@ void Solar::process_SM100CollectorConfig(std::shared_ptr<const Telegram> telegra
changed_ |= telegram->read_value(collector1Type_, 5, 1);
}


/*
* SM100Energy - type 0x038E EMS+ for energy readings
* e.g. 30 00 FF 00 02 8E 00 00 00 00 00 00 06 C5 00 00 76 35
Expand Down Expand Up @@ -489,15 +489,19 @@ void Solar::process_ISM1Set(std::shared_ptr<const Telegram> telegram) {
changed_ |= telegram->read_value(setpoint_maxBottomTemp_, 6);
}

// set temperature for tank
bool Solar::set_SM100Tank1MaxTemp(const char * value, const int8_t id) {
int temperature;
if(! Helpers::value2number(value, temperature)) return false;
tank1MaxTempCurrent_=temperature;
uint8_t data=(uint8_t) temperature;
if (!Helpers::value2number(value, temperature)) {
return false;
}

// write value
// 90 30 FF 03 02 5A 59 B3
EMSdevice::write_command(0x35A, 0x03, &data, sizeof(data), 0);
// note: optionally add the validate to 0x035A which will pick up the adjusted tank1MaxTempCurrent_
write_command(0x35A, 0x03, (uint8_t)temperature);

return true;
}


} // namespace emsesp
6 changes: 2 additions & 4 deletions src/emsdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,12 @@ class EMSdevice {
UNKNOWN
};

// device IDs
// static device IDs
static constexpr uint8_t EMS_DEVICE_ID_BOILER = 0x08; // fixed device_id for Master Boiler/UBA
static constexpr uint8_t EMS_DEVICE_ID_MODEM = 0x48; // gateways like the KM200

// type IDs
// generic type IDs
static constexpr uint16_t EMS_TYPE_VERSION = 0x02; // type ID for Version information. Generic across all EMS devices.
static constexpr uint16_t EMS_TYPE_UBADevices = 0x07; // EMS connected devices
static constexpr uint16_t EMS_TYPE_ParamCfg = 0xF9; // EMS parameter min/default/max/current

// device flags: The lower 4 bits hold the unique identifier, the upper 4 bits are used for specific flags
static constexpr uint8_t EMS_DEVICE_FLAG_NONE = 0;
Expand Down

0 comments on commit 52e120a

Please sign in to comment.