mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
Merge remote-tracking branch 'upstream/dev' into MM10
This commit is contained in:
@@ -8,11 +8,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [1.9.5 beta]
|
||||
|
||||
### Added
|
||||
- Solar Module SM200 support
|
||||
- `set master_thermostat <product id>` to choose with thermostat is master when there are multiple on the bus
|
||||
|
||||
### Fixed
|
||||
- set boiler warm water temp on Junkers/Bosch HT3
|
||||
|
||||
### Changed
|
||||
|
||||
- improved MQTT publishing to stop flooding
|
||||
|
||||
### Removed
|
||||
|
||||
|
||||
|
||||
@@ -524,7 +524,7 @@ void MyESP::_wifi_setup() {
|
||||
WiFi.setSleepMode(WIFI_NONE_SLEEP); // added to possibly fix wifi dropouts in arduino core 2.5.0
|
||||
// ref: https://github.com/esp8266/Arduino/issues/6471
|
||||
// ref: https://github.com/esp8266/Arduino/issues/6366
|
||||
// high tx power causing weird behavior, slighly lowering from 20.5 to 20.0 may help stability
|
||||
// high tx power causing weird behavior, slightly lowering from 20.5 to 20.0 may help stability
|
||||
WiFi.setOutputPower(20.0); // in DBM
|
||||
#endif
|
||||
|
||||
|
||||
102
src/ems-esp.cpp
102
src/ems-esp.cpp
@@ -69,15 +69,16 @@ typedef struct {
|
||||
uint8_t dallas_sensors; // count of dallas sensors
|
||||
|
||||
// custom params
|
||||
bool shower_timer; // true if we want to report back on shower times
|
||||
bool shower_alert; // true if we want the alert of cold water
|
||||
bool led; // LED on/off
|
||||
bool listen_mode; // stop automatic Tx on/off
|
||||
uint16_t publish_time; // frequency of MQTT publish in seconds
|
||||
uint8_t led_gpio; // pin for LED
|
||||
uint8_t dallas_gpio; // pin for attaching external dallas temperature sensors
|
||||
bool dallas_parasite; // on/off is using parasite
|
||||
uint8_t tx_mode; // TX mode 1,2 or 3
|
||||
bool shower_timer; // true if we want to report back on shower times
|
||||
bool shower_alert; // true if we want the alert of cold water
|
||||
bool led; // LED on/off
|
||||
bool listen_mode; // stop automatic Tx on/off
|
||||
uint16_t publish_time; // frequency of MQTT publish in seconds
|
||||
uint8_t led_gpio; // pin for LED
|
||||
uint8_t dallas_gpio; // pin for attaching external dallas temperature sensors
|
||||
bool dallas_parasite; // on/off is using parasite
|
||||
uint8_t tx_mode; // TX mode 1,2 or 3
|
||||
uint8_t master_thermostat; // Product ID of master thermostat to use
|
||||
} _EMSESP_Settings;
|
||||
|
||||
typedef struct {
|
||||
@@ -99,6 +100,7 @@ static const command_t project_cmds[] PROGMEM = {
|
||||
{true, "shower_alert <on | off>", "stop hot water to send 3 cold burst warnings after max shower time is exceeded"},
|
||||
{true, "publish_time <seconds>", "set frequency for publishing data to MQTT (0=automatic)"},
|
||||
{true, "tx_mode <n>", "changes Tx logic. 1=EMS generic, 2=EMS+, 3=HT3"},
|
||||
{true, "master_thermostat [product id]", "product id to use as the master thermostat. Use no args for list."},
|
||||
|
||||
{false, "info", "show current values deciphered from the EMS messages"},
|
||||
{false, "log <n | b | t | s | r | j | v | w [type ID]", "set logging to none, basic, thermostat, solar module, raw, jabber, verbose or watch a specific type"},
|
||||
@@ -252,7 +254,7 @@ void showInfo() {
|
||||
myDebug_P(PSTR("\n%sEMS Bus stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
|
||||
|
||||
if (ems_getBusConnected()) {
|
||||
myDebug_P(PSTR(" Bus is connected, protocol: %s"), ((EMS_Sys_Status.emsIDMask == 0x80) ? "HT3" : "Buderus"));
|
||||
myDebug_P(PSTR(" Bus is connected, protocol: %s"), (ems_isHT3() ? "HT3" : "Buderus"));
|
||||
myDebug_P(PSTR(" Rx: # successful read requests=%d, # CRC errors=%d"), EMS_Sys_Status.emsRxPgks, EMS_Sys_Status.emxCrcErr);
|
||||
|
||||
if (ems_getTxCapable()) {
|
||||
@@ -361,7 +363,7 @@ void showInfo() {
|
||||
EMS_Boiler.UBAuptime % 60);
|
||||
}
|
||||
|
||||
// For SM10/SM100 Solar Module
|
||||
// For SM10/SM100/SM200 Solar Module
|
||||
if (ems_getSolarModuleEnabled()) {
|
||||
myDebug_P(PSTR("")); // newline
|
||||
myDebug_P(PSTR("%sSolar Module stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
|
||||
@@ -772,7 +774,7 @@ void publishEMSValues(bool force) {
|
||||
ems_Device_remove_flags(EMS_DEVICE_UPDATE_FLAG_MIXING); // unset flag
|
||||
}
|
||||
|
||||
// For SM10 and SM100 Solar Modules
|
||||
// For SM10 and SM100/SM200 Solar Modules
|
||||
if (ems_getSolarModuleEnabled() && (ems_Device_has_flags(EMS_DEVICE_UPDATE_FLAG_SOLAR) || force)) {
|
||||
// build new json object
|
||||
doc.clear();
|
||||
@@ -863,7 +865,6 @@ void do_publishValues() {
|
||||
myDebugLog("Starting scheduled MQTT publish...");
|
||||
publishEMSValues(false);
|
||||
publishSensorValues();
|
||||
do_publishShowerData();
|
||||
}
|
||||
|
||||
// callback to light up the LED, called via Ticker every second
|
||||
@@ -954,19 +955,23 @@ bool LoadSaveCallback(MYESP_FSACTION_t action, JsonObject settings) {
|
||||
EMSESP_Settings.tx_mode = settings["tx_mode"] | EMS_TXMODE_DEFAULT; // default to 1 (generic)
|
||||
ems_setTxMode(EMSESP_Settings.tx_mode);
|
||||
|
||||
EMSESP_Settings.master_thermostat = settings["master_thermostat"] | 0; // default to 0 (none)
|
||||
ems_setMasterThermostat(EMSESP_Settings.master_thermostat);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == MYESP_FSACTION_SAVE) {
|
||||
settings["led"] = EMSESP_Settings.led;
|
||||
settings["led_gpio"] = EMSESP_Settings.led_gpio;
|
||||
settings["dallas_gpio"] = EMSESP_Settings.dallas_gpio;
|
||||
settings["dallas_parasite"] = EMSESP_Settings.dallas_parasite;
|
||||
settings["listen_mode"] = EMSESP_Settings.listen_mode;
|
||||
settings["shower_timer"] = EMSESP_Settings.shower_timer;
|
||||
settings["shower_alert"] = EMSESP_Settings.shower_alert;
|
||||
settings["publish_time"] = EMSESP_Settings.publish_time;
|
||||
settings["tx_mode"] = EMSESP_Settings.tx_mode;
|
||||
settings["led"] = EMSESP_Settings.led;
|
||||
settings["led_gpio"] = EMSESP_Settings.led_gpio;
|
||||
settings["dallas_gpio"] = EMSESP_Settings.dallas_gpio;
|
||||
settings["dallas_parasite"] = EMSESP_Settings.dallas_parasite;
|
||||
settings["listen_mode"] = EMSESP_Settings.listen_mode;
|
||||
settings["shower_timer"] = EMSESP_Settings.shower_timer;
|
||||
settings["shower_alert"] = EMSESP_Settings.shower_alert;
|
||||
settings["publish_time"] = EMSESP_Settings.publish_time;
|
||||
settings["tx_mode"] = EMSESP_Settings.tx_mode;
|
||||
settings["master_thermostat"] = EMSESP_Settings.master_thermostat;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1084,6 +1089,27 @@ bool SetListCallback(MYESP_FSACTION_t action, uint8_t wc, const char * setting,
|
||||
myDebug_P(PSTR("Error. Usage: set tx_mode <1 | 2 | 3>"));
|
||||
}
|
||||
}
|
||||
|
||||
// master_thermostat
|
||||
if (strcmp(setting, "master_thermostat") == 0) {
|
||||
if (wc == 1) {
|
||||
// show list
|
||||
char device_string[100];
|
||||
myDebug_P(PSTR("Available thermostat Product ids:"));
|
||||
for (std::list<_Detected_Device>::iterator it = Devices.begin(); it != Devices.end(); ++it) {
|
||||
if (it->device_type == EMS_DEVICE_TYPE_THERMOSTAT) {
|
||||
strlcpy(device_string, (it)->device_desc_p, sizeof(device_string));
|
||||
myDebug_P(PSTR(" %d = %s"), (it)->product_id, device_string);
|
||||
}
|
||||
}
|
||||
myDebug_P(PSTR("Usage: set master_thermostat <product id>"));
|
||||
} else if (wc == 2) {
|
||||
uint8_t pid = atoi(value);
|
||||
EMSESP_Settings.master_thermostat = pid;
|
||||
ems_setMasterThermostat(pid);
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (action == MYESP_FSACTION_LIST) {
|
||||
@@ -1095,11 +1121,18 @@ bool SetListCallback(MYESP_FSACTION_t action, uint8_t wc, const char * setting,
|
||||
myDebug_P(PSTR(" listen_mode=%s"), EMSESP_Settings.listen_mode ? "on" : "off");
|
||||
myDebug_P(PSTR(" shower_timer=%s"), EMSESP_Settings.shower_timer ? "on" : "off");
|
||||
myDebug_P(PSTR(" shower_alert=%s"), EMSESP_Settings.shower_alert ? "on" : "off");
|
||||
|
||||
if (EMSESP_Settings.publish_time) {
|
||||
myDebug_P(PSTR(" publish_time=%d"), EMSESP_Settings.publish_time);
|
||||
} else {
|
||||
myDebug_P(PSTR(" publish_time=0 (always publish on data received)"), EMSESP_Settings.publish_time);
|
||||
}
|
||||
|
||||
if (EMSESP_Settings.master_thermostat) {
|
||||
myDebug_P(PSTR(" master_thermostat=%d"), EMSESP_Settings.master_thermostat);
|
||||
} else {
|
||||
myDebug_P(PSTR(" master_thermostat=0 (use first one detected)"), EMSESP_Settings.master_thermostat);
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
@@ -1368,7 +1401,7 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) {
|
||||
// this is used for example for comfort, flowtemp
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD);
|
||||
|
||||
// these three need to be unqiue topics
|
||||
// these three need to be unique topics
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWACTIVATED);
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWONETIME);
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWTEMP);
|
||||
@@ -1404,6 +1437,8 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) {
|
||||
const char * command = doc["cmd"];
|
||||
|
||||
// Check whatever the command is and act accordingly
|
||||
|
||||
// we only have one now, this is for the shower coldshot
|
||||
if (strcmp(command, TOPIC_SHOWER_COLDSHOT) == 0) {
|
||||
_showerColdShotStart();
|
||||
return;
|
||||
@@ -1716,7 +1751,7 @@ void WebCallback(JsonObject root) {
|
||||
boiler["ok"] = false;
|
||||
}
|
||||
|
||||
// For SM10/SM100 Solar Module
|
||||
// For SM10/SM100/SM200 Solar Module
|
||||
JsonObject sm = root.createNestedObject("sm");
|
||||
if (ems_getSolarModuleEnabled()) {
|
||||
sm["ok"] = true;
|
||||
@@ -1774,15 +1809,16 @@ void WebCallback(JsonObject root) {
|
||||
// Most of these will be overwritten after the SPIFFS config file is loaded
|
||||
void initEMSESP() {
|
||||
// general settings
|
||||
EMSESP_Settings.shower_timer = false;
|
||||
EMSESP_Settings.shower_alert = false;
|
||||
EMSESP_Settings.led = true; // LED is on by default
|
||||
EMSESP_Settings.listen_mode = false;
|
||||
EMSESP_Settings.publish_time = DEFAULT_PUBLISHTIME;
|
||||
EMSESP_Settings.dallas_sensors = 0;
|
||||
EMSESP_Settings.led_gpio = EMSESP_LED_GPIO;
|
||||
EMSESP_Settings.dallas_gpio = EMSESP_DALLAS_GPIO;
|
||||
EMSESP_Settings.tx_mode = EMS_TXMODE_DEFAULT; // default tx mode
|
||||
EMSESP_Settings.shower_timer = false;
|
||||
EMSESP_Settings.shower_alert = false;
|
||||
EMSESP_Settings.led = true; // LED is on by default
|
||||
EMSESP_Settings.listen_mode = false;
|
||||
EMSESP_Settings.publish_time = DEFAULT_PUBLISHTIME;
|
||||
EMSESP_Settings.dallas_sensors = 0;
|
||||
EMSESP_Settings.led_gpio = EMSESP_LED_GPIO;
|
||||
EMSESP_Settings.dallas_gpio = EMSESP_DALLAS_GPIO;
|
||||
EMSESP_Settings.tx_mode = EMS_TXMODE_DEFAULT; // default tx mode
|
||||
EMSESP_Settings.master_thermostat = 0;
|
||||
|
||||
// shower settings
|
||||
EMSESP_Shower.timerStart = 0;
|
||||
|
||||
58
src/ems.cpp
58
src/ems.cpp
@@ -71,6 +71,11 @@ void ems_Device_remove_flags(unsigned int flags) {
|
||||
EMS_Sys_Status.emsRefreshedFlags &= ~flags;
|
||||
}
|
||||
|
||||
// returns true if HT3, other Buderus protocol
|
||||
bool ems_isHT3() {
|
||||
return (EMS_Sys_Status.emsIDMask == 0x80);
|
||||
}
|
||||
|
||||
// init stats and counters and buffers
|
||||
void ems_init() {
|
||||
ems_clearDeviceList(); // init the device map
|
||||
@@ -173,9 +178,9 @@ void ems_init() {
|
||||
EMS_Boiler.pump_mod_min = EMS_VALUE_INT_NOTSET; // Boiler circuit pump modulation min. power %
|
||||
|
||||
// Solar Module values
|
||||
EMS_SolarModule.collectorTemp = EMS_VALUE_SHORT_NOTSET; // collector temp from SM10/SM100
|
||||
EMS_SolarModule.bottomTemp = EMS_VALUE_SHORT_NOTSET; // bottom temp from SM10/SM100
|
||||
EMS_SolarModule.pumpModulation = EMS_VALUE_INT_NOTSET; // modulation solar pump SM10/SM100
|
||||
EMS_SolarModule.collectorTemp = EMS_VALUE_SHORT_NOTSET; // collector temp from SM10/SM100/SM200
|
||||
EMS_SolarModule.bottomTemp = EMS_VALUE_SHORT_NOTSET; // bottom temp from SM10/SM100/SM200
|
||||
EMS_SolarModule.pumpModulation = EMS_VALUE_INT_NOTSET; // modulation solar pump SM10/SM100/SM200
|
||||
EMS_SolarModule.pump = EMS_VALUE_BOOL_NOTSET; // pump active
|
||||
EMS_SolarModule.EnergyLastHour = EMS_VALUE_USHORT_NOTSET;
|
||||
EMS_SolarModule.EnergyToday = EMS_VALUE_USHORT_NOTSET;
|
||||
@@ -412,6 +417,10 @@ void ems_setTxMode(uint8_t mode) {
|
||||
EMS_Sys_Status.emsTxMode = mode;
|
||||
}
|
||||
|
||||
void ems_setMasterThermostat(uint8_t product_id) {
|
||||
EMS_Sys_Status.emsMasterThermostat = product_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* debug print a telegram to telnet/serial including the CRC
|
||||
*/
|
||||
@@ -1257,7 +1266,7 @@ void _process_RCPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
// the whole telegram
|
||||
// e.g. Thermostat -> all, telegram: 10 00 FF 00 01 A5 00 D7 21 00 00 00 00 30 01 84 01 01 03 01 84 01 F1 00 00 11 01 00 08 63 00
|
||||
// 10 00 FF 00 01 A5 80 00 01 30 28 00 30 28 01 54 03 03 01 01 54 02 A8 00 00 11 01 03 FF FF 00
|
||||
// or prtial, e.g. for modes:
|
||||
// or partial, e.g. for modes:
|
||||
// manual : 10 00 FF 0A 01 A5 02
|
||||
// auto : 10 00 FF 0A 01 A5 03
|
||||
_setValue(EMS_RxTelegram, &EMS_Thermostat.hc[hc].curr_roomTemp, EMS_OFFSET_RCPLUSStatusMessage_curr); // value is * 10
|
||||
@@ -1681,6 +1690,17 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
strlcat(version, ".", sizeof(version));
|
||||
strlcat(version, _smallitoa(EMS_RxTelegram->data[offset + 2], buf), sizeof(version));
|
||||
|
||||
// some devices store the protocol type (HT3, Buderus) in tbe last byte
|
||||
// we don't do anything with this yet.
|
||||
if (EMS_RxTelegram->data_length >= 10) {
|
||||
uint8_t protocol_type = EMS_RxTelegram->data[9];
|
||||
if (protocol_type == 2) {
|
||||
// it's a junkers
|
||||
} else if (protocol_type >= 3) {
|
||||
// it's buderus
|
||||
}
|
||||
}
|
||||
|
||||
// scan through known devices matching the productid
|
||||
uint8_t product_id = EMS_RxTelegram->data[offset];
|
||||
uint8_t i = 0;
|
||||
@@ -1693,7 +1713,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
i++;
|
||||
}
|
||||
|
||||
// if not found, just add it
|
||||
// if not found, just add it as an unknown device
|
||||
if (!typeFound) {
|
||||
(void)_addDevice(EMS_DEVICE_TYPE_UNKNOWN, product_id, device_id, nullptr, version);
|
||||
return;
|
||||
@@ -1717,13 +1737,17 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
strlcpy(EMS_Boiler.version, version, sizeof(EMS_Boiler.version));
|
||||
ems_getBoilerValues(); // get Boiler values that we would usually have to wait for
|
||||
} else if (type == EMS_DEVICE_TYPE_THERMOSTAT) {
|
||||
EMS_Thermostat.device_id = device_id;
|
||||
EMS_Thermostat.device_flags = (flags & 0x7F); // remove 7th bit
|
||||
EMS_Thermostat.write_supported = (flags & EMS_DEVICE_FLAG_NO_WRITE) == 0;
|
||||
EMS_Thermostat.product_id = product_id;
|
||||
EMS_Thermostat.device_desc_p = device_desc_p;
|
||||
strlcpy(EMS_Thermostat.version, version, sizeof(EMS_Thermostat.version));
|
||||
ems_getThermostatValues(); // get Thermostat values
|
||||
// we can only support a single thermostat currently, so check which product_id we may have chosen
|
||||
// to be the master - see https://github.com/proddy/EMS-ESP/issues/238
|
||||
if ((EMS_Sys_Status.emsMasterThermostat == 0) || (EMS_Sys_Status.emsMasterThermostat == product_id)) {
|
||||
EMS_Thermostat.device_id = device_id;
|
||||
EMS_Thermostat.device_flags = (flags & 0x7F); // remove 7th bit
|
||||
EMS_Thermostat.write_supported = (flags & EMS_DEVICE_FLAG_NO_WRITE) == 0;
|
||||
EMS_Thermostat.product_id = product_id;
|
||||
EMS_Thermostat.device_desc_p = device_desc_p;
|
||||
strlcpy(EMS_Thermostat.version, version, sizeof(EMS_Thermostat.version));
|
||||
ems_getThermostatValues(); // get Thermostat values
|
||||
}
|
||||
} else if (type == EMS_DEVICE_TYPE_SOLAR) {
|
||||
EMS_SolarModule.device_id = device_id;
|
||||
EMS_SolarModule.product_id = product_id;
|
||||
@@ -2475,8 +2499,14 @@ void ems_setWarmWaterActivated(bool activated) {
|
||||
EMS_TxTelegram.type = EMS_TYPE_UBAParameterWW;
|
||||
EMS_TxTelegram.offset = EMS_OFFSET_UBAParameterWW_wwactivated;
|
||||
EMS_TxTelegram.length = EMS_MIN_TELEGRAM_LENGTH;
|
||||
EMS_TxTelegram.type_validate = EMS_ID_NONE; // don't validate
|
||||
EMS_TxTelegram.dataValue = (activated ? 0xFF : 0x00); // 0xFF is on, 0x00 is off
|
||||
EMS_TxTelegram.type_validate = EMS_ID_NONE; // don't validate
|
||||
|
||||
// https://github.com/proddy/EMS-ESP/issues/268
|
||||
if (ems_isHT3()) {
|
||||
EMS_TxTelegram.dataValue = (activated ? 0x08 : 0x00); // 0x08 is on, 0x00 is off
|
||||
} else {
|
||||
EMS_TxTelegram.dataValue = (activated ? 0xFF : 0x00); // 0xFF is on, 0x00 is off
|
||||
}
|
||||
|
||||
EMS_TxQueue.push(EMS_TxTelegram);
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ typedef struct {
|
||||
uint8_t emsIDMask; // Buderus: 0x00, Junkers: 0x80
|
||||
uint8_t emsPollAck[1]; // acknowledge buffer for Poll
|
||||
uint8_t emsTxMode; // Tx mode 1, 2 or 3
|
||||
uint8_t emsMasterThermostat; // product ID for the default thermostat to use
|
||||
char emsDeviceMap[EMS_SYS_DEVICEMAP_LENGTH]; // contents of 0x07 telegram with bitmasks for all active EMS devices
|
||||
} _EMS_Sys_Status;
|
||||
|
||||
@@ -338,7 +339,7 @@ typedef struct {
|
||||
_EMS_Mixing_HC hc[EMS_THERMOSTAT_MAXHC]; // array for the 4 heating circuits
|
||||
} _EMS_Mixing;
|
||||
|
||||
// Solar Module - SM10/SM100/ISM1
|
||||
// Solar Module - SM10/SM100/SM200/ISM1
|
||||
typedef struct {
|
||||
uint8_t device_id; // the device ID of the Solar Module
|
||||
uint8_t device_flags; // Solar Module flags
|
||||
@@ -423,6 +424,7 @@ void ems_setWarmWaterModeComfort(uint8_t comfort);
|
||||
void ems_setModels();
|
||||
void ems_setTxDisabled(bool b);
|
||||
void ems_setTxMode(uint8_t mode);
|
||||
void ems_setMasterThermostat(uint8_t product_id);
|
||||
char * ems_getDeviceDescription(_EMS_DEVICE_TYPE device_type, char * buffer, bool name_only = false);
|
||||
bool ems_getDeviceTypeDescription(uint8_t device_id, char * buffer);
|
||||
void ems_getThermostatValues();
|
||||
@@ -446,6 +448,7 @@ bool ems_getTxDisabled();
|
||||
void ems_Device_add_flags(unsigned int flags);
|
||||
bool ems_Device_has_flags(unsigned int flags);
|
||||
void ems_Device_remove_flags(unsigned int flags);
|
||||
bool ems_isHT3();
|
||||
|
||||
// private functions
|
||||
uint8_t _crcCalculator(uint8_t * data, uint8_t len);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// Fixed EMS Device IDs
|
||||
#define EMS_ID_ME 0x0B // our device, hardcoded as the "Service Key"
|
||||
#define EMS_ID_BOILER 0x08 // all UBA Boilers have 0x08
|
||||
#define EMS_ID_SM 0x30 // Solar Module SM10, SM100 and ISM1
|
||||
#define EMS_ID_SM 0x30 // Solar Module SM10, SM100, SM200 and ISM1
|
||||
#define EMS_ID_HP 0x38 // HeatPump
|
||||
#define EMS_ID_GATEWAY 0x48 // Gateway e.g. KM200 Web Gateway
|
||||
#define EMS_ID_MIXING1 0x20 // Mixing
|
||||
@@ -85,6 +85,7 @@ const _EMS_Device_Types EMS_Devices_Types[] = {
|
||||
#define EMS_OFFSET_UBASetPoints_flowtemp 0 // flow temp
|
||||
|
||||
// SM and HP Types
|
||||
// Assuming SM100 behaves like SM200
|
||||
#define EMS_TYPE_SM10Monitor 0x97 // SM10Monitor
|
||||
#define EMS_TYPE_SM100Monitor 0x0262 // SM100Monitor
|
||||
#define EMS_TYPE_SM100Status 0x0264 // SM100Status
|
||||
@@ -230,6 +231,7 @@ static const _EMS_Device EMS_Devices[] = {
|
||||
//
|
||||
{73, EMS_DEVICE_TYPE_SOLAR, "SM10 Solar Module", EMS_DEVICE_FLAG_SM10},
|
||||
{163, EMS_DEVICE_TYPE_SOLAR, "SM100 Solar Module", EMS_DEVICE_FLAG_SM100},
|
||||
{164, EMS_DEVICE_TYPE_SOLAR, "SM200 Solar Module", EMS_DEVICE_FLAG_SM100},
|
||||
{101, EMS_DEVICE_TYPE_SOLAR, "Junkers ISM1 Solar Module", EMS_DEVICE_FLAG_SM100},
|
||||
{162, EMS_DEVICE_TYPE_SOLAR, "SM50 Solar Module", EMS_DEVICE_FLAG_SM100},
|
||||
|
||||
@@ -269,7 +271,7 @@ static const _EMS_Device EMS_Devices[] = {
|
||||
{189, EMS_DEVICE_TYPE_GATEWAY, "Web Gateway KM200", EMS_DEVICE_FLAG_NONE}, // 0x48
|
||||
|
||||
//
|
||||
// Thermostats, typically device id of 0x10, 0x17 and 0x18
|
||||
// Thermostats, typically device id of 0x10, 0x17, 0x18 and 0x39 (easy)
|
||||
//
|
||||
|
||||
// Easy devices - not currently supporting write operations
|
||||
|
||||
@@ -224,27 +224,27 @@ _EMS_TX_STATUS ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
||||
}
|
||||
emsuart_tx_brk(); // send <BRK>
|
||||
} else if (EMS_Sys_Status.emsTxMode == EMS_TXMODE_DEFAULT) {
|
||||
/*
|
||||
* based on code from https://github.com/proddy/EMS-ESP/issues/103 by @susisstrolch
|
||||
* we emit the whole telegram, with Rx interrupt disabled, collecting busmaster response in FIFO.
|
||||
* after sending the last char we poll the Rx status until either
|
||||
* - size(Rx FIFO) == size(Tx-Telegram)
|
||||
* - <BRK> is detected
|
||||
* At end of receive we re-enable Rx-INT and send a Tx-BRK in loopback mode.
|
||||
*
|
||||
* EMS-Bus error handling
|
||||
* 1. Busmaster stops echoing on Tx w/o permission
|
||||
* 2. Busmaster cancel telegram by sending a BRK
|
||||
*
|
||||
* Case 1. is handled by a watchdog counter which is reset on each
|
||||
* Tx attempt. The timeout should be 20x EMSUART_BIT_TIME plus
|
||||
* some smart guess for processing time on targeted EMS device.
|
||||
* We set EMS_Sys_Status.emsTxStatus to EMS_TX_WTD_TIMEOUT and return
|
||||
*
|
||||
* Case 2. is handled via a BRK chk during transmission.
|
||||
* We set EMS_Sys_Status.emsTxStatus to EMS_TX_BRK_DETECT and return
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* based on code from https://github.com/proddy/EMS-ESP/issues/103 by @susisstrolch
|
||||
* we emit the whole telegram, with Rx interrupt disabled, collecting busmaster response in FIFO.
|
||||
* after sending the last char we poll the Rx status until either
|
||||
* - size(Rx FIFO) == size(Tx-Telegram)
|
||||
* - <BRK> is detected
|
||||
* At end of receive we re-enable Rx-INT and send a Tx-BRK in loopback mode.
|
||||
*
|
||||
* EMS-Bus error handling
|
||||
* 1. Busmaster stops echoing on Tx w/o permission
|
||||
* 2. Busmaster cancel telegram by sending a BRK
|
||||
*
|
||||
* Case 1. is handled by a watchdog counter which is reset on each
|
||||
* Tx attempt. The timeout should be 20x EMSUART_BIT_TIME plus
|
||||
* some smart guess for processing time on targeted EMS device.
|
||||
* We set EMS_Sys_Status.emsTxStatus to EMS_TX_WTD_TIMEOUT and return
|
||||
*
|
||||
* Case 2. is handled via a BRK chk during transmission.
|
||||
* We set EMS_Sys_Status.emsTxStatus to EMS_TX_BRK_DETECT and return
|
||||
*
|
||||
*/
|
||||
uint16_t wdc = EMS_TX_TO_COUNT;
|
||||
ETS_UART_INTR_DISABLE(); // disable rx interrupt
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
// MQTT for mixing device
|
||||
#define TOPIC_MIXING_DATA "mixing_data" // for sending mixing device values to MQTT
|
||||
|
||||
// MQTT for SM10/SM100 Solar Module
|
||||
// MQTT for SM10/SM100/SM200 Solar Module
|
||||
#define TOPIC_SM_DATA "sm_data" // topic name
|
||||
#define SM_COLLECTORTEMP "collectortemp" // collector temp
|
||||
#define SM_BOTTOMTEMP "bottomtemp" // bottom temp
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define APP_VERSION "1.9.5b5"
|
||||
#define APP_VERSION "1.9.5b6"
|
||||
|
||||
Reference in New Issue
Block a user