Merge pull request #1177 from proddy/dev

formatting
This commit is contained in:
Proddy
2023-05-27 09:43:41 +02:00
committed by GitHub
34 changed files with 191 additions and 196 deletions

View File

@@ -25,7 +25,7 @@
"@mui/material": "^5.13.2",
"@table-library/react-table-library": "4.1.4",
"@types/lodash-es": "^4.17.7",
"@types/node": "^20.2.3",
"@types/node": "^20.2.5",
"@types/react": "^18.2.7",
"@types/react-dom": "^18.2.4",
"@types/react-router-dom": "^5.3.3",
@@ -64,7 +64,7 @@
"prettier": "^2.8.8",
"rollup-plugin-visualizer": "^5.9.0",
"terser": "^5.17.6",
"vite": "^4.3.8",
"vite": "^4.3.9",
"vite-plugin-svgr": "^3.2.0",
"vite-tsconfig-paths": "^4.2.0"
},

View File

@@ -1281,10 +1281,10 @@ __metadata:
languageName: node
linkType: hard
"@types/node@npm:^20.2.3":
version: 20.2.3
resolution: "@types/node@npm:20.2.3"
checksum: de79ce435f28354dd80f1203db2a5a0606543964400738007fe653d6248a75a9bbec7e7d9b350c475f3b0de514f4d2adbd642abe14f4a6dd40de92c0b8533b5e
"@types/node@npm:^20.2.5":
version: 20.2.5
resolution: "@types/node@npm:20.2.5"
checksum: 1c3db8a4ceb5e5d12e7cb140e37c14a16ce013084c6d65579b91cefbe0ecaca57d85093d968172b11c3d1d95bcbc5d972b08aa3dc3935206fb39bc6c10751102
languageName: node
linkType: hard
@@ -1528,7 +1528,7 @@ __metadata:
"@mui/material": ^5.13.2
"@table-library/react-table-library": 4.1.4
"@types/lodash-es": ^4.17.7
"@types/node": ^20.2.3
"@types/node": ^20.2.5
"@types/react": ^18.2.7
"@types/react-dom": ^18.2.4
"@types/react-router-dom": ^5.3.3
@@ -1565,7 +1565,7 @@ __metadata:
terser: ^5.17.6
typesafe-i18n: ^5.24.3
typescript: ^5.0.4
vite: ^4.3.8
vite: ^4.3.9
vite-plugin-svgr: ^3.2.0
vite-tsconfig-paths: ^4.2.0
languageName: unknown
@@ -5793,9 +5793,9 @@ __metadata:
languageName: node
linkType: hard
"vite@npm:^4.3.8":
version: 4.3.8
resolution: "vite@npm:4.3.8"
"vite@npm:^4.3.9":
version: 4.3.9
resolution: "vite@npm:4.3.9"
dependencies:
esbuild: ^0.17.5
fsevents: ~2.3.2
@@ -5826,7 +5826,7 @@ __metadata:
optional: true
bin:
vite: bin/vite.js
checksum: 7eb7e28b8485ee30ceb2a758ad816d741d21a0e377ca7cc98d1db0a8686076e6bf3e620767afe4d9c497fc4d5fa1fe5f95a422c24c61fd92ac5368a78af43b31
checksum: 9eb1c99f16992e1b29e3eea76df312983f2e59915c369fede0f1e6716b80827857f88cfc75092aac807d20c73033c65be82a315a14ab312a52d22a9bdad1ca82
languageName: node
linkType: hard

View File

@@ -57,8 +57,5 @@ def buildWeb():
finally:
os.chdir("..")
if (len(BUILD_TARGETS) == 0 or "upload" in BUILD_TARGETS):
if not (env.IsCleanTarget()):
buildWeb()
else:
print("Skipping build web interface for target(s): " + ", ".join(BUILD_TARGETS))

View File

@@ -260,7 +260,7 @@ void AnalogSensor::measure() {
for (auto & sensor : sensors_) {
if (sensor.type() == AnalogType::DIGITAL_IN || sensor.type() == AnalogType::COUNTER || sensor.type() == AnalogType::TIMER
|| sensor.type() == AnalogType::RATE) {
auto old_value = sensor.value(); // remember current value before reading
auto old_value = sensor.value(); // remember current value before reading
auto current_reading = digitalRead(sensor.gpio());
if (sensor.poll_ != current_reading) { // check for pinchange
sensor.polltime_ = uuid::get_uptime(); // remember time of pinchange
@@ -274,7 +274,7 @@ void AnalogSensor::measure() {
} else if (!sensor.poll_) { // falling edge
if (sensor.type() == AnalogType::COUNTER) {
sensor.set_value(old_value + sensor.factor());
} else if (sensor.type() == AnalogType::RATE) { // dafault uom: Hz (1/sec) with factor 1
} else if (sensor.type() == AnalogType::RATE) { // dafault uom: Hz (1/sec) with factor 1
sensor.set_value(sensor.factor() * 1000 / (sensor.polltime_ - sensor.last_polltime_));
} else if (sensor.type() == AnalogType::TIMER) { // default seconds with factor 1
sensor.set_value(sensor.factor() * (sensor.polltime_ - sensor.last_polltime_) / 1000);
@@ -676,7 +676,7 @@ bool AnalogSensor::command_info(const char * value, const int8_t id, JsonObject
dataSensor["value"] = sensor.value();
} else if (id == 0) { // output values command
output[sensor.name()] = sensor.value();
} else { // if someone wants gpio numbers
} else { // if someone wants gpio numbers
char gpio_str[9];
snprintf(gpio_str, sizeof(gpio_str), "gpio_%02d", sensor.gpio());
output[gpio_str] = sensor.value();

View File

@@ -46,7 +46,7 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
if (!strncmp(path, Mqtt::base().c_str(), Mqtt::base().length())) {
char new_path[Mqtt::MQTT_TOPIC_MAX_SIZE];
strlcpy(new_path, path, sizeof(new_path));
p.parse(new_path + Mqtt::base().length() + 1); // re-parse the stripped path
p.parse(new_path + Mqtt::base().length() + 1); // re-parse the stripped path
} else {
return message(CommandRet::ERROR, "unrecognized path", output); // error
}
@@ -194,7 +194,7 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
} else if (data.isNull()) {
return_code = Command::call(device_type, command_p, "", is_admin, id_n, output); // empty, will do a query instead
} else {
return message(CommandRet::ERROR, "cannot parse command", output); // can't process
return message(CommandRet::ERROR, "cannot parse command", output); // can't process
}
return return_code;
}

View File

@@ -56,7 +56,7 @@ class Command {
struct CmdFunction {
uint8_t device_type_; // DeviceType::
uint8_t device_id_;
uint8_t flags_; // mqtt flags for command subscriptions
uint8_t flags_; // mqtt flags for command subscriptions
const char * cmd_;
cmd_function_p cmdfunction_;
cmd_json_function_p cmdfunction_json_;

View File

@@ -43,7 +43,8 @@ static inline EMSESP & to_app(Shell & shell) {
}
#define NO_ARGUMENTS \
std::vector<std::string> {}
std::vector<std::string> { \
}
// add static functions here....
@@ -430,11 +431,11 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
if (!arguments.empty()) {
// get raw/pretty
if (arguments[0] == (F_(raw))) {
to_app(shell).watch(to_app(shell).WATCH_RAW); // raw
to_app(shell).watch(to_app(shell).WATCH_RAW); // raw
} else if (arguments[0] == (FL_(on)[0])) {
to_app(shell).watch(to_app(shell).WATCH_ON); // on
to_app(shell).watch(to_app(shell).WATCH_ON); // on
} else if (arguments[0] == (FL_(off)[0])) {
to_app(shell).watch(to_app(shell).WATCH_OFF); // off
to_app(shell).watch(to_app(shell).WATCH_OFF); // off
} else if (arguments[0] == (FL_(unknown)[0])) {
to_app(shell).watch(to_app(shell).WATCH_UNKNOWN); // unknown
watch_id = WATCH_ID_NONE;
@@ -442,7 +443,7 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
watch_id = Helpers::hextoint(arguments[0].c_str());
if (watch_id > 0
&& ((to_app(shell).watch() == to_app(shell).WATCH_OFF) || (to_app(shell).watch() == to_app(shell).WATCH_UNKNOWN))) {
to_app(shell).watch(to_app(shell).WATCH_ON); // on
to_app(shell).watch(to_app(shell).WATCH_ON); // on
} else if (watch_id == 0) {
to_app(shell).watch(to_app(shell).WATCH_OFF); // off
return;
@@ -477,7 +478,7 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
} else if (watch == to_app(shell).WATCH_RAW) {
shell.printfln("Watching incoming telegrams, displayed as raw bytes"); // WATCH_RAW
} else {
shell.printfln("Watching unknown telegrams"); // WATCH_UNKNOWN
shell.printfln("Watching unknown telegrams"); // WATCH_UNKNOWN
}
watch_id = to_app(shell).watch_id();

View File

@@ -980,13 +980,13 @@ void Boiler::process_UBASettingsWW(std::shared_ptr<const Telegram> telegram) {
// Boiler(0x08) -> Me(0x0B), UBAParameterWW(0x33), data: 08 FF 30 FB FF 28 FF 07 46 00 00
void Boiler::process_UBAParameterWW(std::shared_ptr<const Telegram> telegram) {
// has_bitupdate(telegram, wwEquipt_,0,3); // 8=boiler has ww
has_update(telegram, wwActivated_, 1); // 0xFF means on
has_update(telegram, wwActivated_, 1); // 0xFF means on
has_update(telegram, wwSelTemp_, 2);
has_update(telegram, wwHystOn_, 3); // Hyst on (default -5)
has_update(telegram, wwHystOff_, 4); // Hyst off (default -1)
has_update(telegram, wwFlowTempOffset_, 5); // default 40
has_update(telegram, wwCircPump_, 6); // 0xFF means on
has_update(telegram, wwCircMode_, 7); // 0=off, 1=1x3min 6=6x3min 7=continuous
has_update(telegram, wwHystOn_, 3); // Hyst on (default -5)
has_update(telegram, wwHystOff_, 4); // Hyst off (default -1)
has_update(telegram, wwFlowTempOffset_, 5); // default 40
has_update(telegram, wwCircPump_, 6); // 0xFF means on
has_update(telegram, wwCircMode_, 7); // 0=off, 1=1x3min 6=6x3min 7=continuous
has_update(telegram, wwDisinfectionTemp_, 8);
has_bitupdate(telegram, wwChargeType_, 10, 0); // 0 = charge pump, 0xff = 3-way valve
@@ -1089,7 +1089,7 @@ void Boiler::process_UBAMonitorSlow(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, outdoorTemp_, 0);
has_update(telegram, boilTemp_, 2);
has_update(telegram, exhaustTemp_, 4);
has_update(telegram, switchTemp_, 25); // only if there is a mixer module present
has_update(telegram, switchTemp_, 25); // only if there is a mixer module present
has_update(telegram, heatingPumpMod_, 9);
has_update(telegram, burnStarts_, 10, 3); // force to 3 bytes
has_update(telegram, burnWorkMin_, 13, 3); // force to 3 bytes
@@ -1414,7 +1414,7 @@ void Boiler::process_UBAErrorMessage(std::shared_ptr<const Telegram> telegram) {
// data: displaycode(2), errornumber(2), year, month, hour, day, minute, duration(2), src-addr
if (telegram->message_data[4] & 0x80) { // valid date
static uint32_t lastCodeDate_ = 0; // last code date
static uint32_t lastCodeDate_ = 0; // last code date
char code[3] = {0};
uint16_t codeNo = EMS_VALUE_SHORT_NOTSET;
code[0] = telegram->message_data[0];
@@ -1530,12 +1530,12 @@ void Boiler::process_HpSilentMode(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, wwAltOpPrioWw_, 3); // range 30-120 minutes on Buderus WSW196i
has_update(telegram, silentMode_, 10); // enum off-auto-on
has_update(telegram, minTempSilent_, 11);
has_update(telegram, hpHystHeat_, 37); // is / 5
has_update(telegram, hpHystCool_, 35); // is / 5, maybe offset swapped with pool
has_update(telegram, hpHystPool_, 33); // is / 5
has_update(telegram, hpHystHeat_, 37); // is / 5
has_update(telegram, hpHystCool_, 35); // is / 5, maybe offset swapped with pool
has_update(telegram, hpHystPool_, 33); // is / 5
has_update(telegram, hpCircPumpWw_, 46);
has_update(telegram, silentFrom_, 52); // in steps of 15 min
has_update(telegram, silentTo_, 53); // in steps of 15 min
has_update(telegram, silentFrom_, 52); // in steps of 15 min
has_update(telegram, silentTo_, 53); // in steps of 15 min
}
// Boiler(0x08) -B-> All(0x00), ?(0x0488), data: 8E 00 00 00 00 00 01 03
@@ -1556,7 +1556,7 @@ void Boiler::process_HpAdditionalHeater(std::shared_ptr<const Telegram> telegram
has_update(telegram, manDefrost_, 0); // off/on
has_update(telegram, auxHeaterOnly_, 1);
has_update(telegram, auxHeaterOff_, 2);
has_update(telegram, auxHeatMode_, 4); // eco/comfort
has_update(telegram, auxHeatMode_, 4); // eco/comfort
has_update(telegram, tempParMode_, 5);
has_update(telegram, auxMaxLimit_, 14); // is * 10
has_update(telegram, auxLimitStart_, 15); // is * 10

View File

@@ -87,9 +87,9 @@ class Boiler : public EMSdevice {
uint32_t wwWorkM_; // DHW minutes
int8_t wwHystOn_;
int8_t wwHystOff_;
uint8_t wwTapActivated_; // maintenance-mode to switch DHW off
uint16_t wwMixerTemp_; // mixing temperature
uint16_t wwCylMiddleTemp_; // Cyl middle temperature (TS3)
uint8_t wwTapActivated_; // maintenance-mode to switch DHW off
uint16_t wwMixerTemp_; // mixing temperature
uint16_t wwCylMiddleTemp_; // Cyl middle temperature (TS3)
uint16_t wwSolarTemp_;
uint8_t wwAlternatingOper_; // alternating operation on/off
uint8_t wwAltOpPrioHeat_; // alternating operation, prioritize heat time
@@ -208,7 +208,7 @@ class Boiler : public EMSdevice {
// Inputs
struct {
uint8_t state;
char option[16]; // logic, block_comp, block_dhw, block_heat, block_cool, overheat_protect, evu_blocktime1,2,3, block_heater, Solar, brine lowpressure, brine pump modulation
char option[16]; // logic, block_comp, block_dhw, block_heat, block_cool, overheat_protect, evu_blocktime1,2,3, block_heater, Solar, brine lowpressure, brine pump modulation
} hpInput[4];
// Heater limits
@@ -256,7 +256,7 @@ class Boiler : public EMSdevice {
uint16_t cwFlowRate_; // cold water flow rate *10
uint16_t netFlowTemp_; // heat network flow temperature *10
uint8_t keepWarmTemp_;
uint8_t setReturnTemp_;
uint8_t setReturnTemp_;
/*
// Hybrid heatpump with telegram 0xBB is readable and writeable in boiler and thermostat

View File

@@ -24,7 +24,6 @@ REGISTER_FACTORY(Heatsource, EMSdevice::DeviceType::HEATSOURCE);
Heatsource::Heatsource(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand)
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
// AM200 alternative heatsource
if (device_id == EMSdevice::EMS_DEVICE_ID_BOILER || (device_id >= EMSdevice::EMS_DEVICE_ID_AHS1 && device_id < EMSdevice::EMS_DEVICE_ID_HS1)) {
uint8_t tag = device_id == EMSdevice::EMS_DEVICE_ID_BOILER

View File

@@ -170,7 +170,7 @@ void Mixer::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> teleg
void Mixer::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, flowTempHc_, 0); // is * 10
has_bitupdate(telegram, pumpStatus_, 2, 0);
has_update(telegram, status_, 11); // temp status
has_update(telegram, status_, 11); // temp status
}
// Mixer IPM - 0x010C
@@ -220,7 +220,7 @@ void Mixer::process_MMStatusMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, flowTempHc_, 1); // is * 10
has_bitupdate(telegram, pumpStatus_, 3, 2); // is 0 or 0x64 (100%), check only bit 2
has_update(telegram, flowSetTemp_, 0);
has_update(telegram, status_, 4); // valve status -100 to 100
has_update(telegram, status_, 4); // valve status -100 to 100
}
/*

View File

@@ -685,9 +685,9 @@ void Solar::process_SM100Monitor(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, cylBottomTemp2_, 16); // is *10 - TS5: Temperature sensor 2 cylinder, bottom, or swimming pool
has_update(telegram, heatExchangerTemp_, 20); // is *10 - TS6: Heat exchanger temperature sensor
has_update(telegram, collector2Temp_, 6); // is *10 - TS7: Temperature sensor for collector array 2
has_update(telegram, cylMiddleTemp_, 8); // is *10 - TS14: cylinder middle temperature
has_update(telegram, retHeatAssist_, 10); // is *10 - TS15: return temperature heating assistance
has_update(telegram, collector2Temp_, 6); // is *10 - TS7: Temperature sensor for collector array 2
has_update(telegram, cylMiddleTemp_, 8); // is *10 - TS14: cylinder middle temperature
has_update(telegram, retHeatAssist_, 10); // is *10 - TS15: return temperature heating assistance
}
// SM100wwTemperature - 0x07D6
@@ -749,8 +749,8 @@ void Solar::process_SM100Monitor2(std::shared_ptr<const Telegram> telegram) {
has_update(telegram->read_value(heatCntFlowTemp_, 0)); // is *10
has_update(telegram->read_value(heatCntRetTemp_, 2)); // is *10
has_update(telegram->read_value(heatCnt_, 12));
has_update(telegram->read_value(swapRetTemp_, 6)); // is *10
has_update(telegram->read_value(swapFlowTemp_, 8)); // is *10
has_update(telegram->read_value(swapRetTemp_, 6)); // is *10
has_update(telegram->read_value(swapFlowTemp_, 8)); // is *10
}
#pragma GCC diagnostic push
@@ -879,7 +879,7 @@ void Solar::process_ISM1StatusMessage(std::shared_ptr<const Telegram> telegram)
has_update(telegram, collectorTemp_, 4); // Collector Temperature
has_update(telegram, cylBottomTemp_, 6); // Temperature Bottom of Solar Boiler cyl
uint16_t Wh = energyLastHour_ / 10;
telegram->read_value(Wh, 2); // Solar Energy produced in last hour only ushort, is not * 10
telegram->read_value(Wh, 2); // Solar Energy produced in last hour only ushort, is not * 10
if (energyLastHour_ != Wh * 10) {
energyLastHour_ = Wh * 10;
has_update(&energyLastHour_);

View File

@@ -58,9 +58,9 @@ class Solar : public EMSdevice {
uint32_t energyLastHour_;
uint32_t energyToday_;
uint32_t energyTotal_;
uint32_t pumpWorkTime_; // Total solar pump operating time
uint32_t pump2WorkTime_; // Total solar pump 2 operating time
uint32_t m1WorkTime_; // differential control work time
uint32_t pumpWorkTime_; // Total solar pump operating time
uint32_t pump2WorkTime_; // Total solar pump 2 operating time
uint32_t m1WorkTime_; // differential control work time
uint8_t cylHeated_;
uint8_t collectorShutdown_; // Collector shutdown on/off

View File

@@ -635,8 +635,8 @@ void Thermostat::process_RC20Set_2(std::shared_ptr<const Telegram> telegram) {
return;
}
has_update(telegram, hc->heatingtype, 0);
has_update(telegram, hc->nighttemp, 1); // is * 2,
has_update(telegram, hc->daytemp, 2); // is * 2,
has_update(telegram, hc->nighttemp, 1); // is * 2,
has_update(telegram, hc->daytemp, 2); // is * 2,
has_update(telegram, hc->mode, 3);
has_enumupdate(telegram, hc->program, 11, 1); // 1 .. 9 predefined programs
has_update(telegram, hc->tempautotemp, 13);
@@ -772,8 +772,8 @@ void Thermostat::process_RC35wwSettings(std::shared_ptr<const Telegram> telegram
has_update(telegram, wwDisinfecting_, 4); // 0-off, 0xFF on
has_update(telegram, wwDisinfectDay_, 5); // 0-6 Day of week, 7 every day
has_update(telegram, wwDisinfectHour_, 6);
has_update(telegram, wwMaxTemp_, 8); // Limiter 60 degrees
has_update(telegram, wwOneTimeKey_, 9); // 0-off, 0xFF on
has_update(telegram, wwMaxTemp_, 8); // Limiter 60 degrees
has_update(telegram, wwOneTimeKey_, 9); // 0-off, 0xFF on
}
// Settings WW 0x3A - RC30
@@ -925,7 +925,7 @@ void Thermostat::process_RC300Monitor(std::shared_ptr<const Telegram> telegram)
return;
}
has_update(telegram, hc->roomTemp, 0); // is * 10
has_update(telegram, hc->roomTemp, 0); // is * 10
has_bitupdate(telegram, hc->modetype, 10, 1);
has_bitupdate(telegram, hc->mode, 10, 0); // bit 1, mode (auto=1 or manual=0)
@@ -986,8 +986,8 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> telegram) {
}
has_update(hc->tempautotemp, tat);
has_update(telegram, hc->manualtemp, 10); // is * 2
has_enumupdate(telegram, hc->program, 11, 1); // timer program 1 or 2
has_update(telegram, hc->manualtemp, 10); // is * 2
has_enumupdate(telegram, hc->program, 11, 1); // timer program 1 or 2
has_enumupdate(telegram, hc->reducemode, 5, 1); // 1-outdoor temp threshold, 2-room temp threshold, 3-reduced mode
has_update(telegram, hc->reducetemp, 9);
@@ -1069,7 +1069,7 @@ void Thermostat::process_RC300WWtemp(std::shared_ptr<const Telegram> telegram) {
// RC300WWmode(0x2F5), data: 01 FF 04 00 00 00 08 05 00 08 04 00 00 00 00 00 00 00 00 00 01
void Thermostat::process_RC300WWmode(std::shared_ptr<const Telegram> telegram) {
// circulation pump see: https://github.com/Th3M3/buderus_ems-wiki/blob/master/Einstellungen%20der%20Bedieneinheit%20RC310.md
has_update(telegram, wwCircPump_, 1); // FF=off, 0=on ?
has_update(telegram, wwCircPump_, 1); // FF=off, 0=on ?
has_update(telegram, wwMode_, 2); // 0=off, 1=low, 2=high, 3=auto, 4=own prog
has_update(telegram, wwCircMode_, 3); // 0=off, 1=on, 2=auto, 4=own?
@@ -1159,11 +1159,11 @@ void Thermostat::process_RC30Set(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, mixingvalves_, 17); // Number of Mixing Valves: (0x00=0, 0x01=1, 0x02=2)
has_update(telegram, brightness_, 18); // Screen brightness 0F=dark F1=light
has_update(telegram, hc->mode, 23);
has_update(telegram, hc->nofrosttemp, 24); // Set Temperature when mode is Off / 10 (e.g.: 0x0F = 7.5 degrees Celsius)
has_update(telegram, heatingpid_, 25); // PID setting 00=1 01=2 02=3
has_update(telegram, preheating_, 26); // Preheating in the clock program: (0x00 = off, 0xFF = on)
has_update(telegram, hc->tempautotemp, 28); // is * 2
has_update(telegram, hc->manualtemp, 29); // manualtemp is * 2
has_update(telegram, hc->nofrosttemp, 24); // Set Temperature when mode is Off / 10 (e.g.: 0x0F = 7.5 degrees Celsius)
has_update(telegram, heatingpid_, 25); // PID setting 00=1 01=2 02=3
has_update(telegram, preheating_, 26); // Preheating in the clock program: (0x00 = off, 0xFF = on)
has_update(telegram, hc->tempautotemp, 28); // is * 2
has_update(telegram, hc->manualtemp, 29); // manualtemp is * 2
}
// type 0x40 (HC1) - for reading the operating mode from the RC30 thermostat (0x10)
@@ -1226,13 +1226,13 @@ void Thermostat::process_RC35Set(std::shared_ptr<const Telegram> telegram) {
return;
}
has_update(telegram, hc->heatingtype, 0); // 0- off, 1-radiator, 2-convector, 3-floor
has_update(telegram, hc->nighttemp, 1); // is * 2
has_update(telegram, hc->daytemp, 2); // is * 2
has_update(telegram, hc->holidaytemp, 3); // is * 2
has_update(telegram, hc->roominfluence, 4); // is * 1
has_update(telegram, hc->offsettemp, 6); // is * 2
has_update(telegram, hc->mode, 7); // night, day, auto
has_update(telegram, hc->heatingtype, 0); // 0- off, 1-radiator, 2-convector, 3-floor
has_update(telegram, hc->nighttemp, 1); // is * 2
has_update(telegram, hc->daytemp, 2); // is * 2
has_update(telegram, hc->holidaytemp, 3); // is * 2
has_update(telegram, hc->roominfluence, 4); // is * 1
has_update(telegram, hc->offsettemp, 6); // is * 2
has_update(telegram, hc->mode, 7); // night, day, auto
has_update(telegram, hc->wwprio, 21); // 0xFF for on
has_update(telegram, hc->summertemp, 22); // is * 1
@@ -1243,10 +1243,10 @@ void Thermostat::process_RC35Set(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, hc->control, 26); // 0-off, 1-RC20 (remote), 2-RC35
has_update(telegram, hc->controlmode, 33); // 0-outdoortemp, 1-roomtemp
has_update(telegram, hc->tempautotemp, 37);
has_update(telegram, hc->noreducetemp, 38); // outdoor temperature for no reduce
has_update(telegram, hc->reducetemp, 39); // temperature for off/reduce
has_update(telegram, hc->vacreducetemp, 40); // temperature for off/reduce in vacations
has_update(telegram, hc->vacreducemode, 41); // vacations reduce mode
has_update(telegram, hc->noreducetemp, 38); // outdoor temperature for no reduce
has_update(telegram, hc->reducetemp, 39); // temperature for off/reduce
has_update(telegram, hc->vacreducetemp, 40); // temperature for off/reduce in vacations
has_update(telegram, hc->vacreducemode, 41); // vacations reduce mode
has_update(telegram, hc->minflowtemp, 16);
// RC35 stores values for floorheating in different position
@@ -1368,7 +1368,7 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439
bool junkersclock = model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS;
time_t ttime = mktime(tm_); // thermostat time
time_t ttime = mktime(tm_); // thermostat time
// correct thermostat clock if we have valid ntp time, and could write the command
if (!ivtclock && !junkersclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) {
double difference = difftime(now, ttime);
@@ -1378,7 +1378,7 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
}
}
#ifndef EMSESP_STANDALONE
if (!tset_ && tm_->tm_year > 110) { // emsesp clock not set, but thermostat clock
if (!tset_ && tm_->tm_year > 110) { // emsesp clock not set, but thermostat clock
if (ivtclock) {
tm_->tm_isdst = -1; // determine dst
ttime = mktime(tm_); // thermostat time
@@ -2184,7 +2184,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) {
data[6] = (tm_->tm_wday + 6) % 7; // Bosch counts from Mo, time from Su
data[7] = tm_->tm_isdst + 2; // set DST and flag for ext. clock
if (model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
data[6]++; // Junkers use 1-7;
data[6]++; // Junkers use 1-7;
data[7] = 0;
}
} else if (dt.length() == 23) {
@@ -2382,7 +2382,7 @@ bool Thermostat::set_mode_n(const uint8_t mode, const uint8_t hc_num) {
if (mode == HeatingCircuit::Mode::AUTO) {
set_mode_value = 0xFF; // special value for auto
} else {
set_mode_value = 0; // everything else, like manual/day etc..
set_mode_value = 0; // everything else, like manual/day etc..
}
break;
case EMSdevice::EMS_DEVICE_FLAG_JUNKERS:
@@ -3003,7 +3003,7 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co
offset = 0x0A; // manual offset
break;
case HeatingCircuit::Mode::TEMPAUTO:
offset = 0x08; // auto offset
offset = 0x08; // auto offset
if (temperature == -1) {
factor = 1; // to write 0xFF
}

View File

@@ -247,9 +247,9 @@ class Thermostat : public EMSdevice {
static constexpr uint16_t EMS_TYPE_RCOutdoorTemp = 0xA3; // is an automatic thermostat broadcast, outdoor external temp
// Type offsets
static constexpr uint8_t EMS_OFFSET_RC10StatusMessage_setpoint = 1; // setpoint temp
static constexpr uint8_t EMS_OFFSET_RC10StatusMessage_curr = 2; // current temp
static constexpr uint8_t EMS_OFFSET_RC10Set_temp = 4; // position of thermostat setpoint temperature
static constexpr uint8_t EMS_OFFSET_RC10StatusMessage_setpoint = 1; // setpoint temp
static constexpr uint8_t EMS_OFFSET_RC10StatusMessage_curr = 2; // current temp
static constexpr uint8_t EMS_OFFSET_RC10Set_temp = 4; // position of thermostat setpoint temperature
static constexpr uint8_t EMS_OFFSET_RC20StatusMessage_setpoint = 1; // setpoint temp
static constexpr uint8_t EMS_OFFSET_RC20StatusMessage_curr = 2; // current temp
@@ -258,9 +258,9 @@ class Thermostat : public EMSdevice {
static constexpr uint8_t EMS_OFFSET_RC20Set_temp_auto = 28; // position of thermostat setpoint temperature
static constexpr uint8_t EMS_OFFSET_RC20Set_temp_manual = 29; // position of thermostat setpoint temperature
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_mode = 3; // ES72 - see https://github.com/emsesp/EMS-ESP/issues/334
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_temp_night = 1; // ES72
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_temp_day = 2; // ES72
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_mode = 3; // ES72 - see https://github.com/emsesp/EMS-ESP/issues/334
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_temp_night = 1; // ES72
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_temp_day = 2; // ES72
static constexpr uint8_t EMS_OFFSET_RC30StatusMessage_setpoint = 1; // setpoint temp
static constexpr uint8_t EMS_OFFSET_RC30StatusMessage_curr = 2; // current temp
@@ -299,8 +299,8 @@ class Thermostat : public EMSdevice {
static constexpr uint8_t EMS_OFFSET_RC35Set_temp_summer = 22;
static constexpr uint8_t EMS_OFFSET_RC35Set_temp_nofrost = 23;
static constexpr uint8_t EMS_OFFSET_EasyStatusMessage_setpoint = 10; // setpoint temp
static constexpr uint8_t EMS_OFFSET_EasyStatusMessage_curr = 8; // current temp
static constexpr uint8_t EMS_OFFSET_EasyStatusMessage_setpoint = 10; // setpoint temp
static constexpr uint8_t EMS_OFFSET_EasyStatusMessage_curr = 8; // current temp
static constexpr uint8_t EMS_OFFSET_RCPLUSStatusMessage_mode = 10; // thermostat mode (auto, manual)
static constexpr uint8_t EMS_OFFSET_RCPLUSStatusMessage_setpoint = 3; // setpoint temp

View File

@@ -36,15 +36,15 @@ class Ventilation : public EMSdevice {
uint16_t voc_;
uint8_t bypass_;
uint16_t filterRemain_;
uint8_t ventInSpeed_;
uint8_t ventOutSpeed_;
uint8_t ventInSpeed_;
uint8_t ventOutSpeed_;
// handlers: 0x056B 0x0575 0x0583 0x0585 0x0586 0x0587 0x0588 0x058D 0x058E 0x058F 0x0590 0x05CF 0x05D9 0x05E3
void process_SetMessage(std::shared_ptr<const Telegram> telegram);
void process_MonitorMessage(std::shared_ptr<const Telegram> telegram);
void process_ModeMessage(std::shared_ptr<const Telegram> telegram); // 0x56B
void process_ModeMessage(std::shared_ptr<const Telegram> telegram); // 0x56B
void process_BlowerMessage(std::shared_ptr<const Telegram> telegram); // 0x56B
void process_VOCMessage(std::shared_ptr<const Telegram> telegram); // 0x56B
void process_VOCMessage(std::shared_ptr<const Telegram> telegram); // 0x56B
bool set_ventMode(const char * value, const int8_t id);
bool set_filter(const char * value, const int8_t id);

View File

@@ -459,7 +459,7 @@ class EMSdevice {
std::vector<TelegramFunction> telegram_functions_; // each EMS device has its own set of registered telegram types
std::vector<DeviceValue> devicevalues_; // all the device values
std::vector<DeviceValue> devicevalues_; // all the device values
std::vector<uint16_t> handlers_ignored_;
};

View File

@@ -145,12 +145,12 @@ class DeviceValue {
DV_NUMOP_MUL15 = -15
};
uint8_t device_type; // EMSdevice::DeviceType
uint8_t tag; // DeviceValueTAG::*
void * value_p; // pointer to variable of any type
uint8_t type; // DeviceValueType::*
const char * const ** options; // options as a flash char array
const char * const * options_single; // options are not translated
uint8_t device_type; // EMSdevice::DeviceType
uint8_t tag; // DeviceValueTAG::*
void * value_p; // pointer to variable of any type
uint8_t type; // DeviceValueType::*
const char * const ** options; // options as a flash char array
const char * const * options_single; // options are not translated
int8_t numeric_operator;
uint8_t options_size; // number of options in the char array, calculated
const char * const short_name; // used in MQTT and API

View File

@@ -163,7 +163,7 @@ class EMSESP {
}
static void watch(uint8_t watch) {
watch_ = watch; // 0=off, 1=on, 2=raw
watch_ = watch; // 0=off, 1=on, 2=raw
if (watch == WATCH_OFF) {
watch_id_ = 0; // reset watch id if watch is disabled
}

View File

@@ -385,7 +385,7 @@ std::string Helpers::data_to_hex(const uint8_t * data, const uint8_t length) {
*p++ = buffer[1];
*p++ = ' '; // space
}
*--p = '\0'; // null terminate just in case, loosing the trailing space
*--p = '\0'; // null terminate just in case, loosing the trailing space
return std::string(str);
}

View File

@@ -593,7 +593,7 @@ void Mqtt::on_connect() {
// publish to the last will topic (see Mqtt::start() function) to say we're alive
queue_publish_retain("status", "online", true); // with retain on
mqtt_publish_fails_ = 0; // reset fail count to 0
mqtt_publish_fails_ = 0; // reset fail count to 0
/*
// for debugging only
@@ -774,7 +774,7 @@ void Mqtt::queue_remove_topic(const char * topic) {
if (ha_enabled_) {
queue_publish_message(Mqtt::discovery_prefix() + topic, "", true); // publish with retain to remove from broker
} else {
queue_publish_message(topic, "", true); // publish with retain to remove from broker
queue_publish_message(topic, "", true); // publish with retain to remove from broker
}
}
@@ -786,7 +786,7 @@ void Mqtt::queue_ha(const char * topic, const JsonObject & payload) {
std::string payload_text;
payload_text.reserve(measureJson(payload) + 1);
serializeJson(payload, payload_text); // convert json to string
serializeJson(payload, payload_text); // convert json to string
queue_publish_message(Mqtt::discovery_prefix() + topic, payload_text, true); // with retain true
}
@@ -1064,7 +1064,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
if (type == DeviceValueType::BOOL) {
snprintf(topic, sizeof(topic), "binary_sensor/%s", config_topic); // binary sensor (for booleans)
} else {
snprintf(topic, sizeof(topic), "sensor/%s", config_topic); // normal HA sensor
snprintf(topic, sizeof(topic), "sensor/%s", config_topic); // normal HA sensor
}
}
@@ -1079,13 +1079,13 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
// build the payload
StaticJsonDocument<EMSESP_JSON_SIZE_LARGE> doc;
doc["uniq_id"] = uniq_id;
doc["obj_id"] = uniq_id; // same as unique_id
doc["obj_id"] = uniq_id; // same as unique_id
const char * ic_ha = "ic"; // icon - only set this if there is no device class
const char * sc_ha = "stat_cla"; // state class
const char * uom_ha = "unit_of_meas"; // unit of measure
char sample_val[30] = "0"; // sample, correct(!) entity value, used only to prevent warning/error in HA if real value is not published yet
char sample_val[30] = "0"; // sample, correct(!) entity value, used only to prevent warning/error in HA if real value is not published yet
// handle commands, which are device entities that are writable
// we add the command topic parameter
@@ -1157,7 +1157,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
} else {
snprintf(ha_name, sizeof(ha_name), "%s", F_name); // no tag
}
free(F_name); // very important!
free(F_name); // very important!
doc["name"] = ha_name;
// value template
@@ -1371,7 +1371,7 @@ void Mqtt::publish_ha_climate_config(const uint8_t tag, const bool has_roomtemp,
if (Mqtt::entity_format() == entitiyFormat::MULTI_SHORT) {
snprintf(uniq_id_s, sizeof(uniq_id_s), "%s_thermostat_hc%d", mqtt_basename_.c_str(), hc_num); // add basename
} else {
snprintf(uniq_id_s, sizeof(uniq_id_s), "thermostat_hc%d", hc_num); // backward compatible with v3.4
snprintf(uniq_id_s, sizeof(uniq_id_s), "thermostat_hc%d", hc_num); // backward compatible with v3.4
}
snprintf(temp_cmd_s, sizeof(temp_cmd_s), "~/thermostat/hc%d/seltemp", hc_num);

View File

@@ -46,9 +46,9 @@ class Shower {
uint32_t shower_alert_coldshot_; // default 10 seconds for cold water before turning back hot water
bool ha_configdone_ = false; // for HA MQTT Discovery
bool shower_state_;
uint32_t timer_start_; // ms
uint32_t timer_pause_; // ms
uint32_t duration_; // ms
uint32_t timer_start_; // ms
uint32_t timer_pause_; // ms
uint32_t duration_; // ms
// cold shot
uint32_t alert_timer_start_; // ms

View File

@@ -658,14 +658,12 @@ void System::network_init(bool refresh) {
last_system_check_ = 0; // force the LED to go from fast flash to pulse
bool disableEth;
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & settings) {
disableEth = settings.ssid.length() > 0;
});
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & settings) { disableEth = settings.ssid.length() > 0; });
// no ethernet present or disabled
if (phy_type_ == PHY_type::PHY_TYPE_NONE || disableEth) {
return;
} // no ethernet present
} // no ethernet present
// configure Ethernet
int mdc = 23; // Pin# of the I²C clock signal for the Ethernet PHY - hardcoded
@@ -829,7 +827,7 @@ void System::led_monitor() {
}
if (led_on_) {
digitalWrite(led_gpio_, LED_ON); // LED off
digitalWrite(led_gpio_, LED_ON); // LED off
}
#endif
} else {
@@ -1413,25 +1411,25 @@ bool System::command_test(const char * value, const int8_t id) {
// 3 = RMII clock output from GPIO17, for 50hz inverted clock
bool System::load_board_profile(std::vector<int8_t> & data, const std::string & board_profile) {
if (board_profile == "S32") {
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // BBQKees Gateway S32
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // BBQKees Gateway S32
} else if (board_profile == "E32") {
data = {2, 4, 5, 17, 33, PHY_type::PHY_TYPE_LAN8720, 16, 1, 0}; // BBQKees Gateway E32
} else if (board_profile == "MH-ET") {
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // MH-ET Live D1 Mini
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // MH-ET Live D1 Mini
} else if (board_profile == "NODEMCU") {
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // NodeMCU 32S
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // NodeMCU 32S
} else if (board_profile == "LOLIN") {
data = {2, 18, 17, 16, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin D32
data = {2, 18, 17, 16, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin D32
} else if (board_profile == "OLIMEX") {
data = {0, 0, 36, 4, 34, PHY_type::PHY_TYPE_LAN8720, -1, 0, 0}; // Olimex ESP32-EVB (uses U1TXD/U1RXD/BUTTON, no LED or Temperature sensor)
} else if (board_profile == "OLIMEXPOE") {
data = {0, 0, 36, 4, 34, PHY_type::PHY_TYPE_LAN8720, 12, 0, 3}; // Olimex ESP32-POE
} else if (board_profile == "C3MINI") {
data = {7, 1, 4, 5, 9, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin C3 Mini
data = {7, 1, 4, 5, 9, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin C3 Mini
} else if (board_profile == "S2MINI") {
data = {15, 7, 11, 12, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin S2 Mini
data = {15, 7, 11, 12, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin S2 Mini
} else if (board_profile == "S3MINI") {
data = {17, 18, 8, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Liligo S3
data = {17, 18, 8, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Liligo S3
} else if (board_profile == "CUSTOM") {
// send back current values
data = {(int8_t)EMSESP::system_.led_gpio_,

View File

@@ -148,11 +148,11 @@ void RxService::add(uint8_t * data, uint8_t length) {
// validate the CRC. if it fails then increment the number of corrupt/incomplete telegrams and only report to console/syslog
uint8_t crc = calculate_crc(data, length - 1);
if (data[length - 1] != crc) {
if ((data[0] & 0x7F) != ems_bus_id()) { // do not count echos as errors
if ((data[0] & 0x7F) != ems_bus_id()) { // do not count echos as errors
telegram_error_count_++;
LOG_WARNING("Incomplete Rx: %s", Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC
} else {
LOG_TRACE("Incomplete Rx: %s", Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC
LOG_TRACE("Incomplete Rx: %s", Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC
}
return;
}
@@ -347,7 +347,7 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) {
telegram_raw[5] = (telegram->type_id >> 8) - 1; // type, 1st byte, high-byte, subtract 0x100
telegram_raw[6] = telegram->type_id & 0xFF; // type, 2nd byte, low-byte
message_p = 7;
copy_data = false; // there are no more data values after the type_id when reading on EMS+
copy_data = false; // there are no more data values after the type_id when reading on EMS+
}
} else {
// EMS 1.0
@@ -396,11 +396,11 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) {
if (status == EMS_TX_STATUS_ERR) {
LOG_ERROR("Failed to transmit Tx via UART.");
if (telegram->operation == Telegram::Operation::TX_READ) {
increment_telegram_read_fail_count(); // another Tx fail
increment_telegram_read_fail_count(); // another Tx fail
} else {
increment_telegram_write_fail_count(); // another Tx fail
}
tx_state(Telegram::Operation::NONE); // nothing send, tx not in wait state
tx_state(Telegram::Operation::NONE); // nothing send, tx not in wait state
return;
}
@@ -456,7 +456,7 @@ void TxService::add(const uint8_t operation,
if (front) {
tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram), false, validateid); // add to front of queue
} else {
tx_telegrams_.emplace_back(tx_telegram_id_++, std::move(telegram), false, validateid); // add to back of queue
tx_telegrams_.emplace_back(tx_telegram_id_++, std::move(telegram), false, validateid); // add to back of queue
}
if (validateid != 0) {
EMSESP::wait_validate(validateid);
@@ -608,14 +608,14 @@ bool TxService::send_raw(const char * telegram_data) {
void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const uint8_t length) {
// have we reached the limit? if so, reset count and give up
if (++retry_count_ > MAXIMUM_TX_RETRIES) {
reset_retry_count(); // give up
EMSESP::wait_validate(0); // do not wait for validation
reset_retry_count(); // give up
EMSESP::wait_validate(0); // do not wait for validation
if (operation == Telegram::Operation::TX_READ) {
if (telegram_last_->offset > 0) { // ignore errors for higher offsets
LOG_DEBUG("Last Tx Read operation failed after %d retries. Ignoring request: %s", MAXIMUM_TX_RETRIES, telegram_last_->to_string().c_str());
return;
}
increment_telegram_read_fail_count(); // another Tx fail
increment_telegram_read_fail_count(); // another Tx fail
} else {
increment_telegram_write_fail_count(); // another Tx fail
}

View File

@@ -48,8 +48,8 @@ static constexpr int16_t EMS_VALUE_SHORT_NOTSET = 0x7D00; // 32000: for 2-
static constexpr uint32_t EMS_VALUE_ULONG_NOTSET = 0x00FFFFFF; // for 3-byte longs
static constexpr uint32_t EMS_VALUE_ULLONG_NOTSET = 0xFFFFFFFF; // for 4-byte longs
static constexpr uint8_t EMS_MAX_TELEGRAM_LENGTH = 32; // max length of a complete EMS telegram
static constexpr uint8_t EMS_MAX_TELEGRAM_MESSAGE_LENGTH = 27; // max length of message block, assuming EMS1.0
static constexpr uint8_t EMS_MAX_TELEGRAM_LENGTH = 32; // max length of a complete EMS telegram
static constexpr uint8_t EMS_MAX_TELEGRAM_MESSAGE_LENGTH = 27; // max length of message block, assuming EMS1.0
#define EMS_VALUE_DEFAULT_INT EMS_VALUE_INT_NOTSET
#define EMS_VALUE_DEFAULT_UINT EMS_VALUE_UINT_NOTSET
@@ -232,13 +232,13 @@ class EMSbus {
private:
static constexpr uint32_t EMS_BUS_TIMEOUT = 30000; // timeout in ms before recognizing the ems bus is offline (30 seconds)
static uint32_t last_bus_activity_; // timestamp of last time a valid Rx came in
static uint32_t bus_uptime_start_; // timestamp of first time we connected to the bus
static bool bus_connected_; // start assuming the bus hasn't been connected
static uint8_t ems_mask_; // unset=0xFF, buderus=0x00, junkers/ht3=0x80
static uint8_t ems_bus_id_; // the bus id, which configurable and stored in settings
static uint8_t tx_mode_; // local copy of the tx mode
static uint8_t tx_state_; // state of the Tx line (NONE or waiting on a TX_READ or TX_WRITE)
static uint32_t last_bus_activity_; // timestamp of last time a valid Rx came in
static uint32_t bus_uptime_start_; // timestamp of first time we connected to the bus
static bool bus_connected_; // start assuming the bus hasn't been connected
static uint8_t ems_mask_; // unset=0xFF, buderus=0x00, junkers/ht3=0x80
static uint8_t ems_bus_id_; // the bus id, which configurable and stored in settings
static uint8_t tx_mode_; // local copy of the tx mode
static uint8_t tx_state_; // state of the Tx line (NONE or waiting on a TX_READ or TX_WRITE)
};
class RxService : public EMSbus {
@@ -433,17 +433,17 @@ class TxService : public EMSbus {
private:
std::deque<QueuedTxTelegram> tx_telegrams_; // the Tx queue
uint32_t telegram_read_count_ = 0; // # Tx successful reads
uint32_t telegram_write_count_ = 0; // # Tx successful writes
uint32_t telegram_read_fail_count_ = 0; // # Tx unsuccessful transmits
uint32_t telegram_write_fail_count_ = 0; // # Tx unsuccessful transmits
uint32_t telegram_read_count_ = 0; // # Tx successful reads
uint32_t telegram_write_count_ = 0; // # Tx successful writes
uint32_t telegram_read_fail_count_ = 0; // # Tx unsuccessful transmits
uint32_t telegram_write_fail_count_ = 0; // # Tx unsuccessful transmits
std::shared_ptr<Telegram> telegram_last_;
uint16_t telegram_last_post_send_query_; // which type ID to query after a successful send, to read back the values just written
uint8_t retry_count_ = 0; // count for # Tx retries
uint32_t delayed_send_ = 0; // manage delay for post send query
uint8_t tx_telegram_id_ = 0; // queue counter
uint8_t tx_telegram_id_ = 0; // queue counter
void send_telegram(const QueuedTxTelegram & tx_telegram);
};

View File

@@ -214,7 +214,7 @@ void TemperatureSensor::loop() {
// LOG_DEBUG("Adding %d sensor(s) from first scan", firstscan_);
} else if ((scancnt_ <= 0) && (firstscan_ != sensors_.size())) { // check 2 times for no change of sensor #
scancnt_ = SCAN_START;
sensors_.clear(); // restart scanning and clear to get correct numbering
sensors_.clear(); // restart scanning and clear to get correct numbering
}
state_ = State::IDLE;
}

View File

@@ -132,7 +132,7 @@ class TemperatureSensor {
static constexpr uint8_t TYPE_DS18B20 = 0x28;
static constexpr uint8_t TYPE_DS18S20 = 0x10;
static constexpr uint8_t TYPE_DS1822 = 0x22;
static constexpr uint8_t TYPE_DS1825 = 0x3B; // also DS1826
static constexpr uint8_t TYPE_DS1825 = 0x3B; // also DS1826
static constexpr uint32_t READ_INTERVAL_MS = 5000; // 5 seconds
static constexpr uint32_t CONVERSION_MS = 1000; // 1 seconds

View File

@@ -1005,10 +1005,10 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
EMSESP::mqtt_.incoming("ems-esp/thermostat_hc1", "22"); // HA only
EMSESP::mqtt_.incoming("ems-esp/thermostat_hc1", "off"); // HA only
EMSESP::mqtt_.incoming("ems-esp/system/send", "11 12 13");
EMSESP::mqtt_.incoming("ems-esp/boiler/syspress"); // empty payload, sends reponse
EMSESP::mqtt_.incoming("ems-esp/thermostat/mode"); // empty payload, sends reponse
EMSESP::mqtt_.incoming("ems-esp/boiler/syspress"); // empty payload, sends reponse
EMSESP::mqtt_.incoming("ems-esp/thermostat/mode"); // empty payload, sends reponse
EMSESP::mqtt_.incoming("ems-esp/system/publish");
EMSESP::mqtt_.incoming("ems-esp/thermostat/seltemp"); // empty payload, sends reponse
EMSESP::mqtt_.incoming("ems-esp/thermostat/seltemp"); // empty payload, sends reponse
EMSESP::mqtt_.incoming("ems-esp/boiler/wwseltemp", "59");
EMSESP::mqtt_.incoming("ems-esp/boiler/wwseltemp");
@@ -1204,7 +1204,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
uart_telegram("30 00 FF 0A 02 6A 04"); // SM100 pump on 1
uart_telegram("30 00 FF 00 02 64 00 00 00 04 00 00 FF 00 00 1E 0B 09 64 00 00 00 00"); // SM100 modulation
uart_telegram("30 00 FF 0A 02 6A 03"); // SM100 pump off 0
uart_telegram("30 00 FF 0A 02 6A 03"); // SM100 pump off 0
shell.invoke_command("show");
ok = true;
@@ -1446,7 +1446,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
shell.invoke_command("call");
shell.invoke_command("call system info");
EMSESP::mqtt_.incoming("ems-esp/system", "{\"cmd\":\"info\"}"); // this should fail
EMSESP::mqtt_.incoming("ems-esp/system", "{\"cmd\":\"info\"}"); // this should fail
EMSESP::mqtt_.incoming("ems-esp/thermostat", "{\"cmd\":\"temp\",\"data\":23.45}"); // this should work just fine
EMSESP::mqtt_.incoming("ems-esp/thermostat", "{\"cmd\":\"TeMP\",\"data\":23.45}"); // test mix cased cmd
@@ -1559,7 +1559,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
// EMSESP::mqtt_.incoming(system_topic, "{\"cmd\":\"pin\",\"id\":12,\"data\":\"1\"}");
EMSESP::mqtt_.incoming(thermostat_topic, "{\"cmd\":\"wwmode\",\"data\":\"auto\"}");
EMSESP::mqtt_.incoming(thermostat_topic, "{\"cmd\":\"mode\",\"data\":\"typo\",\"id\":2}"); // invalid mode
EMSESP::mqtt_.incoming(thermostat_topic, "{\"cmd\":\"mode\",\"data\":\"typo\",\"id\":2}"); // invalid mode
EMSESP::mqtt_.incoming(thermostat_topic, "{\"cmd\":\"mode\",\"data\":\"auto\",\"id\":2}");
EMSESP::mqtt_.incoming(thermostat_topic, "{\"cmd\":\"mode\",\"data\":\"auto\",\"hc\":2}"); // hc as number
EMSESP::mqtt_.incoming(thermostat_topic, "{\"cmd\":\"seltemp\",\"data\":19.5,\"hc\":1}"); // data as number

View File

@@ -86,7 +86,7 @@ void EMSuart::start(const uint8_t tx_mode, const uint8_t rx_gpio, const uint8_t
uart_set_pin(EMSUART_NUM, tx_gpio, rx_gpio, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
uart_driver_install(EMSUART_NUM, 129, 0, (EMS_MAXBUFFERSIZE + 1) * 2, &uart_queue, 0); // buffer must be > fifo
uart_set_rx_full_threshold(EMSUART_NUM, 1);
uart_set_rx_timeout(EMSUART_NUM, 0); // disable
uart_set_rx_timeout(EMSUART_NUM, 0); // disable
// note esp32s3 crashes with 2k stacksize, stack overflow here sometimes wipes settingsfiles.
xTaskCreate(uart_event_task, "uart_event_task", 2560, NULL, configMAX_PRIORITIES - 1, NULL);

View File

@@ -24,7 +24,7 @@
#ifndef EMSESP_EMSUART_H
#define EMSESP_EMSUART_H
#define EMS_MAXBUFFERSIZE 33 // max size of the buffer. EMS packets are max 32 bytes, plus extra for BRK
#define EMS_MAXBUFFERSIZE 33 // max size of the buffer. EMS packets are max 32 bytes, plus extra for BRK
#define EMSUART_NUM UART_NUM_1 // on C3 and S2 there is no UART2, use UART1 for all
#define EMSUART_BAUD 9600 // uart baud rate for the EMS circuit

View File

@@ -67,7 +67,7 @@ class WebLogService : public uuid::log::Handler {
void setValues(AsyncWebServerRequest * request, JsonVariant & json);
AsyncCallbackJsonWebHandler setValues_; // for POSTs
AsyncCallbackJsonWebHandler setValues_; // for POSTs
uint64_t last_transmit_ = 0; // Last transmit time
size_t maximum_log_messages_ = MAX_LOG_MESSAGES; // Maximum number of log messages to buffer before they are output

View File

@@ -85,7 +85,7 @@ StateUpdateResult WebScheduler::update(JsonObject & root, WebScheduler & webSche
// calculated elapsed minutes
si.elapsed_min = Helpers::string2minutes(si.time);
si.retry_cnt = 0xFF; // no startup retries
si.retry_cnt = 0xFF; // no startup retries
webScheduler.scheduleItems.push_back(si); // add to list
if (!webScheduler.scheduleItems.back().name.empty()) {

View File

@@ -22,8 +22,8 @@
#define EMSESP_SCHEDULER_FILE "/config/emsespScheduler.json"
#define EMSESP_SCHEDULER_SERVICE_PATH "/rest/schedule" // GET and POST
#define SCHEDULEFLAG_SCHEDULE_TIMER 0x80 // 7th bit for Timer
#define MAX_STARTUP_RETRIES 3 // retry the start-up commands x times
#define SCHEDULEFLAG_SCHEDULE_TIMER 0x80 // 7th bit for Timer
#define MAX_STARTUP_RETRIES 3 // retry the start-up commands x times
namespace emsesp {

View File

@@ -228,61 +228,61 @@ void WebStatusService::mDNS_start() const {
const char * WebStatusService::disconnectReason(uint8_t code) {
#ifndef EMSESP_STANDALONE
switch (code) {
case WIFI_REASON_UNSPECIFIED: // = 1,
case WIFI_REASON_UNSPECIFIED: // = 1,
return "unspecifiied";
case WIFI_REASON_AUTH_EXPIRE: // = 2,
case WIFI_REASON_AUTH_EXPIRE: // = 2,
return "auth expire";
case WIFI_REASON_AUTH_LEAVE: // = 3,
case WIFI_REASON_AUTH_LEAVE: // = 3,
return "auth leave";
case WIFI_REASON_ASSOC_EXPIRE: // = 4,
case WIFI_REASON_ASSOC_EXPIRE: // = 4,
return "assoc expired";
case WIFI_REASON_ASSOC_TOOMANY: // = 5,
case WIFI_REASON_ASSOC_TOOMANY: // = 5,
return "assoc too many";
case WIFI_REASON_NOT_AUTHED: // = 6,
case WIFI_REASON_NOT_AUTHED: // = 6,
return "not authed";
case WIFI_REASON_NOT_ASSOCED: // = 7,
case WIFI_REASON_NOT_ASSOCED: // = 7,
return "not assoced";
case WIFI_REASON_ASSOC_LEAVE: // = 8,
case WIFI_REASON_ASSOC_LEAVE: // = 8,
return "assoc leave";
case WIFI_REASON_ASSOC_NOT_AUTHED: // = 9,
case WIFI_REASON_ASSOC_NOT_AUTHED: // = 9,
return "assoc not authed";
case WIFI_REASON_DISASSOC_PWRCAP_BAD: // = 10,
case WIFI_REASON_DISASSOC_PWRCAP_BAD: // = 10,
return "disassoc powerCAP bad";
case WIFI_REASON_DISASSOC_SUPCHAN_BAD: // = 11,
case WIFI_REASON_DISASSOC_SUPCHAN_BAD: // = 11,
return "disassoc supchan bad";
case WIFI_REASON_IE_INVALID: // = 13,
case WIFI_REASON_IE_INVALID: // = 13,
return "IE invalid";
case WIFI_REASON_MIC_FAILURE: // = 14,
case WIFI_REASON_MIC_FAILURE: // = 14,
return "MIC failure";
case WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT: // = 15,
case WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT: // = 15,
return "4way handshake timeout";
case WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT: // = 16,
return "group key-update timeout";
case WIFI_REASON_IE_IN_4WAY_DIFFERS: // = 17,
case WIFI_REASON_IE_IN_4WAY_DIFFERS: // = 17,
return "IE in 4way differs";
case WIFI_REASON_GROUP_CIPHER_INVALID: // = 18,
case WIFI_REASON_GROUP_CIPHER_INVALID: // = 18,
return "group cipher invalid";
case WIFI_REASON_PAIRWISE_CIPHER_INVALID: // = 19,
case WIFI_REASON_PAIRWISE_CIPHER_INVALID: // = 19,
return "pairwise cipher invalid";
case WIFI_REASON_AKMP_INVALID: // = 20,
case WIFI_REASON_AKMP_INVALID: // = 20,
return "AKMP invalid";
case WIFI_REASON_UNSUPP_RSN_IE_VERSION: // = 21,
case WIFI_REASON_UNSUPP_RSN_IE_VERSION: // = 21,
return "unsupported RSN_IE version";
case WIFI_REASON_INVALID_RSN_IE_CAP: // = 22,
case WIFI_REASON_INVALID_RSN_IE_CAP: // = 22,
return "invalid RSN_IE_CAP";
case WIFI_REASON_802_1X_AUTH_FAILED: // = 23,
case WIFI_REASON_802_1X_AUTH_FAILED: // = 23,
return "802 X1 auth failed";
case WIFI_REASON_CIPHER_SUITE_REJECTED: // = 24,
case WIFI_REASON_CIPHER_SUITE_REJECTED: // = 24,
return "cipher suite rejected";
case WIFI_REASON_BEACON_TIMEOUT: // = 200,
case WIFI_REASON_BEACON_TIMEOUT: // = 200,
return "beacon timeout";
case WIFI_REASON_NO_AP_FOUND: // = 201,
case WIFI_REASON_NO_AP_FOUND: // = 201,
return "no AP found";
case WIFI_REASON_AUTH_FAIL: // = 202,
case WIFI_REASON_AUTH_FAIL: // = 202,
return "auth fail";
case WIFI_REASON_ASSOC_FAIL: // = 203,
case WIFI_REASON_ASSOC_FAIL: // = 203,
return "assoc fail";
case WIFI_REASON_HANDSHAKE_TIMEOUT: // = 204,
case WIFI_REASON_HANDSHAKE_TIMEOUT: // = 204,
return "handshake timeout";
default:
return "unknown";