Skip to content

Commit

Permalink
add TA4/TW1, fix decimal, add EM100 values, update
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Oct 22, 2023
1 parent 6ab2cc6 commit 509d213
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 59 deletions.
4 changes: 2 additions & 2 deletions interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@table-library/react-table-library": "4.1.7",
"@types/lodash-es": "^4.17.10",
"@types/node": "^20.8.7",
"@types/react": "^18.2.30",
"@types/react": "^18.2.31",
"@types/react-dom": "^18.2.14",
"@types/react-router-dom": "^5.3.3",
"alova": "^2.13.1",
Expand All @@ -53,7 +53,7 @@
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"concurrently": "^8.2.2",
"eslint": "^8.51.0",
"eslint": "^8.52.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.0.0",
Expand Down
7 changes: 5 additions & 2 deletions interface/src/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ export enum DeviceValueUOM {
M3,
L,
KMIN,
K
K,
VOLTS
}

export const DeviceValueUOM_s = [
Expand All @@ -201,7 +202,8 @@ export const DeviceValueUOM_s = [
'm³',
'l',
'K*min',
'K'
'K',
'V'
];

export enum AnalogType {
Expand Down Expand Up @@ -238,6 +240,7 @@ type BoardProfiles = {
export const BOARD_PROFILES: BoardProfiles = {
S32: 'BBQKees Gateway S32',
E32: 'BBQKees Gateway E32',
E32V2: 'BBQKees Gateway E32 V2',
NODEMCU: 'NodeMCU 32S',
'MH-ET': 'MH-ET Live D1 Mini',
LOLIN: 'Lolin D32',
Expand Down
58 changes: 33 additions & 25 deletions interface/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -658,10 +658,10 @@ __metadata:
languageName: node
linkType: hard

"@eslint/js@npm:8.51.0":
version: 8.51.0
resolution: "@eslint/js@npm:8.51.0"
checksum: 1641f02c787a6477bf4b054afb8113abdca552b8c222520b5ee44d85352294dafd4a34f0e510b1e38a02fc27c1f68547cb6c2abbea891d20688f474440266af3
"@eslint/js@npm:8.52.0":
version: 8.52.0
resolution: "@eslint/js@npm:8.52.0"
checksum: 86beff213d0ae4ced203a922b74e2cc4d767d109e7815f985bf648946ba072198977102e32afc9fa04f7825a6de83a831874f6b6675ba0c1d0743ade2dc2d53d
languageName: node
linkType: hard

Expand Down Expand Up @@ -703,14 +703,14 @@ __metadata:
languageName: node
linkType: hard

"@humanwhocodes/config-array@npm:^0.11.11":
version: 0.11.11
resolution: "@humanwhocodes/config-array@npm:0.11.11"
"@humanwhocodes/config-array@npm:^0.11.13":
version: 0.11.13
resolution: "@humanwhocodes/config-array@npm:0.11.13"
dependencies:
"@humanwhocodes/object-schema": "npm:^1.2.1"
"@humanwhocodes/object-schema": "npm:^2.0.1"
debug: "npm:^4.1.1"
minimatch: "npm:^3.0.5"
checksum: 4aad64bc4c68ec99a72c91ad9a8a9070e8da47e8fc4f51eefa2eaf56f4b0cae17dfc3ff82eb9268298f687b5bb3b68669ff542203c77bcd400dc27924d56cad6
checksum: 9f655e1df7efa5a86822cd149ca5cef57240bb8ffd728f0c07cc682cc0a15c6bdce68425fbfd58f9b3e8b16f79b3fd8cb1e96b10c434c9a76f20b2a89f213272
languageName: node
linkType: hard

Expand All @@ -721,10 +721,10 @@ __metadata:
languageName: node
linkType: hard

"@humanwhocodes/object-schema@npm:^1.2.1":
version: 1.2.1
resolution: "@humanwhocodes/object-schema@npm:1.2.1"
checksum: b48a8f87fcd5fdc4ac60a31a8bf710d19cc64556050575e6a35a4a48a8543cf8cde1598a65640ff2cdfbfd165b38f9db4fa3782bea7848eb585cc3db824002e6
"@humanwhocodes/object-schema@npm:^2.0.1":
version: 2.0.1
resolution: "@humanwhocodes/object-schema@npm:2.0.1"
checksum: dbddfd0465aecf92ed845ec30d06dba3f7bb2496d544b33b53dac7abc40370c0e46b8787b268d24a366730d5eeb5336ac88967232072a183905ee4abf7df4dab
languageName: node
linkType: hard

Expand Down Expand Up @@ -1370,14 +1370,14 @@ __metadata:
languageName: node
linkType: hard

"@types/react@npm:^18.2.30":
version: 18.2.30
resolution: "@types/react@npm:18.2.30"
"@types/react@npm:^18.2.31":
version: 18.2.31
resolution: "@types/react@npm:18.2.31"
dependencies:
"@types/prop-types": "npm:*"
"@types/scheduler": "npm:*"
csstype: "npm:^3.0.2"
checksum: dcad8aed0d0bf5731f4c6a7e8d28d8f571bd031c6c94edbcc1b7ab2c86e7cf61ae49d66c3229e1849fb4b82c5aa7be7c40e71ac5c2d7fef4eafb7a3b4abd25d6
checksum: ac9f42f1cd6ee34329ea7a81894877dc333a2dc86141545e23121b07dcd7cea902bedc6b645ce017c92610bd8cd2c6e25dbba581379889a705314f3c759371bf
languageName: node
linkType: hard

Expand Down Expand Up @@ -1535,6 +1535,13 @@ __metadata:
languageName: node
linkType: hard

"@ungap/structured-clone@npm:^1.2.0":
version: 1.2.0
resolution: "@ungap/structured-clone@npm:1.2.0"
checksum: c6fe89a505e513a7592e1438280db1c075764793a2397877ff1351721fe8792a966a5359769e30242b3cd023f2efb9e63ca2ca88019d73b564488cc20e3eab12
languageName: node
linkType: hard

"EMS-ESP@workspace:.":
version: 0.0.0-use.local
resolution: "EMS-ESP@workspace:."
Expand All @@ -1550,15 +1557,15 @@ __metadata:
"@table-library/react-table-library": "npm:4.1.7"
"@types/lodash-es": "npm:^4.17.10"
"@types/node": "npm:^20.8.7"
"@types/react": "npm:^18.2.30"
"@types/react": "npm:^18.2.31"
"@types/react-dom": "npm:^18.2.14"
"@types/react-router-dom": "npm:^5.3.3"
"@typescript-eslint/eslint-plugin": "npm:^6.8.0"
"@typescript-eslint/parser": "npm:^6.8.0"
alova: "npm:^2.13.1"
async-validator: "npm:^4.2.5"
concurrently: "npm:^8.2.2"
eslint: "npm:^8.51.0"
eslint: "npm:^8.52.0"
eslint-config-airbnb: "npm:^19.0.4"
eslint-config-airbnb-typescript: "npm:^17.1.0"
eslint-config-prettier: "npm:^9.0.0"
Expand Down Expand Up @@ -3645,17 +3652,18 @@ __metadata:
languageName: node
linkType: hard

"eslint@npm:^8.51.0":
version: 8.51.0
resolution: "eslint@npm:8.51.0"
"eslint@npm:^8.52.0":
version: 8.52.0
resolution: "eslint@npm:8.52.0"
dependencies:
"@eslint-community/eslint-utils": "npm:^4.2.0"
"@eslint-community/regexpp": "npm:^4.6.1"
"@eslint/eslintrc": "npm:^2.1.2"
"@eslint/js": "npm:8.51.0"
"@humanwhocodes/config-array": "npm:^0.11.11"
"@eslint/js": "npm:8.52.0"
"@humanwhocodes/config-array": "npm:^0.11.13"
"@humanwhocodes/module-importer": "npm:^1.0.1"
"@nodelib/fs.walk": "npm:^1.2.8"
"@ungap/structured-clone": "npm:^1.2.0"
ajv: "npm:^6.12.4"
chalk: "npm:^4.0.0"
cross-spawn: "npm:^7.0.2"
Expand Down Expand Up @@ -3688,7 +3696,7 @@ __metadata:
text-table: "npm:^0.2.0"
bin:
eslint: bin/eslint.js
checksum: 1f3720dd2a8e25198815c33720dd66ceee88d7527b3b6f2da57b57d0476440af29da2a1d9f28515660afb3345e4f84438562772d6b5fc19b6fab7c77c478ebca
checksum: 01784ab15351d749bc95446039ed7acd5124f7cc84acdbf98c7199272eae06212a8f3ea4a9b47e7cc54ab17ca094c3a664bbfc3002c7de27936220e278b5028a
languageName: node
linkType: hard

Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extra_scripts =
; use Tasmota's libary which removes some libs (like mbedtsl) and increases available heap
; based on Core 2.0.12/ESP-IDF v4.4.5 https://github.com/espressif/arduino-esp32/releases/tag/2.0.12 use https://github.com/tasmota/platform-espressif32/archive/refs/tags/2023.09.00.zip
; based on Core 2.0.13/ESP-IDF v4.4.5 https://github.com/espressif/arduino-esp32/releases/tag/2.0.13 use https://github.com/tasmota/platform-espressif32/releases/download/2023.09.01/platform-espressif32-2023.09.01.zip
platform = https://github.com/tasmota/platform-espressif32/archive/refs/tags/2023.09.00.zip
platform = https://github.com/tasmota/platform-espressif32/archive/refs/tags/2023.10.03.zip
framework = arduino
build_flags = ${common.build_flags}
build_unflags = ${common.unbuild_flags}
Expand Down
111 changes: 93 additions & 18 deletions src/devices/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,111 @@ REGISTER_FACTORY(Alert, EMSdevice::DeviceType::ALERT);

Alert::Alert(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) {
register_telegram_type(0x937, "EM100TempMessage", false, MAKE_PF_CB(process_EM100TempMessage));
register_telegram_type(0x93A, "EM100SetMessage", false, MAKE_PF_CB(process_EM100SetMessage));
register_telegram_type(0x936, "EM100MonitorMessage", false, MAKE_PF_CB(process_EM100MonitorMessage));
if (device_id == 0x15) { // EM100
register_telegram_type(0x935, "EM100SetMessage", true, MAKE_PF_CB(process_EM100SetMessage));
register_telegram_type(0x937, "EM100TempMessage", false, MAKE_PF_CB(process_EM100TempMessage));
register_telegram_type(0x938, "EM100InputMessage", false, MAKE_PF_CB(process_EM100InputMessage));
register_telegram_type(0x939, "EM100MonitorMessage", false, MAKE_PF_CB(process_EM100MonitorMessage));
register_telegram_type(0x93A, "EM100ConfigMessage", false, MAKE_PF_CB(process_EM100ConfigMessage));

register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&headerTemp_,
DeviceValueType::SHORT,
DeviceValueNumOp::DV_NUMOP_DIV10,
FL_(flowTempVf),
DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dip_, DeviceValueType::UINT, FL_(mode), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &outPower_, DeviceValueType::UINT, FL_(power), DeviceValueUOM::PERCENT);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &errorState_, DeviceValueType::BOOL, FL_(error), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&headerTemp_,
DeviceValueType::SHORT,
DeviceValueNumOp::DV_NUMOP_DIV10,
FL_(flowTempVf),
DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &input_, DeviceValueType::USHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(input), DeviceValueUOM::VOLTS);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &outPower_, DeviceValueType::BOOL, FL_(outPower), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &setPower_, DeviceValueType::UINT, FL_(setPower), DeviceValueUOM::PERCENT);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &setPoint_, DeviceValueType::UINT, FL_(setPoint), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&minV_,
DeviceValueType::UINT,
DeviceValueNumOp::DV_NUMOP_DIV10,
FL_(minV),
DeviceValueUOM::VOLTS,
MAKE_CF_CB(set_minV));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&maxV_,
DeviceValueType::UINT,
DeviceValueNumOp::DV_NUMOP_DIV10,
FL_(maxV),
DeviceValueUOM::VOLTS,
MAKE_CF_CB(set_maxV));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &minT_, DeviceValueType::UINT, FL_(minT), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_minT));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &maxT_, DeviceValueType::UINT, FL_(maxT), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_maxT));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dip_, DeviceValueType::UINT, FL_(mode), DeviceValueUOM::NONE);
// register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &errorState_, DeviceValueType::BOOL, FL_(error), DeviceValueUOM::NONE);
}
}


// alert(0x15) -B-> All(0x00), ?(0x093A), data: 00 00 00 00 00 00 00 00 00 03 01
// 0x935 needs fetch
void Alert::process_EM100SetMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, minV_, 1); // Input for off, is / 10
has_update(telegram, maxV_, 2); // Input for 100%, is / 10
has_update(telegram, minT_, 3); // min temp
has_update(telegram, maxT_, 4); // max temp
}

// alert(0x15) -B-> All(0x00), ?(0x093A), data: 00 00 00 00 00 00 00 00 00 03 01
void Alert::process_EM100ConfigMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, dip_, 9);
}
// one of 0x936, 0x937, 0x938, 0x939, 0x93A

// alert(0x15) -B-> All(0x00), ?(0x0938), data: 01 62
void Alert::process_EM100InputMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, outPower_, 0); // IO1
has_update(telegram, input_, 1);
}

// alert(0x15) -B-> All(0x00), ?(0x0939), data: 64 4E 00 00
void Alert::process_EM100MonitorMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, errorState_, 0); // OE1
has_update(telegram, errorPump_, 0); // IE0
has_update(telegram, outPower_, 0); // IO1 percent
has_update(telegram, input_, 0); //IO1
has_update(telegram, setPower_, 0); // percent
has_update(telegram, setPoint_, 1); // °C
// has_update(telegram, errorState_, 2); // OE1
// has_update(telegram, errorPump_, 3); // IE0
}

// alert(0x15) -B-> All(0x00), ?(0x0937), data: 80 00
void Alert::process_EM100TempMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, headerTemp_, 0);
}

bool Alert::set_minV(const char * value, const int8_t id) {
float v;
if (!Helpers::value2float(value, v)) {
return false;
}
write_command(0x935, 1, (uint8_t)(v * 10));
return true;
}

bool Alert::set_maxV(const char * value, const int8_t id) {
float v;
if (!Helpers::value2float(value, v)) {
return false;
}
write_command(0x935, 2, (uint8_t)(v * 10));
return true;
}

bool Alert::set_minT(const char * value, const int8_t id) {
int v;
if (!Helpers::value2temperature(value, v)) {
return false;
}
write_command(0x935, 3, v);
return true;
}

bool Alert::set_maxT(const char * value, const int8_t id) {
int v;
if (!Helpers::value2temperature(value, v)) {
return false;
}
write_command(0x935, 4, v);
return true;
}

} // namespace emsesp
16 changes: 15 additions & 1 deletion src/devices/alert.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,27 @@ class Alert : public EMSdevice {
void process_EM100SetMessage(std::shared_ptr<const Telegram> telegram);
void process_EM100MonitorMessage(std::shared_ptr<const Telegram> telegram);
void process_EM100TempMessage(std::shared_ptr<const Telegram> telegram);
void process_EM100InputMessage(std::shared_ptr<const Telegram> telegram);
void process_EM100ConfigMessage(std::shared_ptr<const Telegram> telegram);

bool set_minV(const char * value, const int8_t id);
bool set_maxV(const char * value, const int8_t id);
bool set_minT(const char * value, const int8_t id);
bool set_maxT(const char * value, const int8_t id);


int16_t headerTemp_; // T0
int16_t input_; // IO1
uint8_t errorState_; // OE1
uint8_t errorPump_; // IE0
uint8_t outPower_; // IO1
uint8_t dip_; // dip switch
uint8_t setPower_; // request
uint8_t setPoint_;
uint8_t dip_; // dip switch
uint8_t minV_;
uint8_t maxV_;
uint8_t minT_;
uint8_t maxT_;
};

} // namespace emsesp
Expand Down
8 changes: 6 additions & 2 deletions src/devices/boiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
FL_(setReturnTemp),
DeviceValueUOM::DEGREES,
MAKE_CF_CB(set_returnTemp));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cwFlowRate_, DeviceValueType::USHORT, FL_(cwFlowRate), DeviceValueUOM::LMIN);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &netFlowTemp_, DeviceValueType::USHORT, FL_(netFlowTemp), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cwFlowRate_, DeviceValueType::USHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(cwFlowRate), DeviceValueUOM::LMIN);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &netFlowTemp_, DeviceValueType::USHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(netFlowTemp), DeviceValueUOM::DEGREES);
}

/*
Expand Down Expand Up @@ -433,6 +433,8 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpTl2_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(hpTl2), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpPl1_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(hpPl1), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpPh1_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(hpPh1), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpTa4_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(hpTa4), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpTw1_, DeviceValueType::SHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(hpTw1), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&poolSetTemp_,
DeviceValueType::UINT,
Expand Down Expand Up @@ -1446,6 +1448,8 @@ void Boiler::process_HpTemperatures(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, hpTr6_, 0);
has_update(telegram, hpTr7_, 30);
has_update(telegram, hpTl2_, 12);
has_update(telegram, hpTa4_, 22);
has_update(telegram, hpTw1_, 24);
has_update(telegram, hpPl1_, 26);
has_update(telegram, hpPh1_, 28);
has_update(telegram, hpBrineIn_, 8);
Expand Down
2 changes: 2 additions & 0 deletions src/devices/boiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ class Boiler : public EMSdevice {
int16_t hpTl2_;
int16_t hpPl1_;
int16_t hpPh1_;
int16_t hpTa4_;
int16_t hpTw1_;

// Pool unit
int8_t poolSetTemp_;
Expand Down
6 changes: 3 additions & 3 deletions src/emsdevicevalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ DeviceValue::DeviceValue(uint8_t device_type,
const char * DeviceValue::DeviceValueUOM_s[] = {

F_(uom_blank), // 0
F_(uom_degrees), F_(uom_degrees), F_(uom_percent), F_(uom_lmin), F_(uom_kwh), F_(uom_wh), FL_(hours)[0], FL_(minutes)[0],
F_(uom_ua), F_(uom_bar), F_(uom_kw), F_(uom_w), F_(uom_kb), FL_(seconds)[0], F_(uom_dbm), F_(uom_fahrenheit),
F_(uom_mv), F_(uom_sqm), F_(uom_m3), F_(uom_l), F_(uom_kmin), F_(uom_k), F_(uom_blank)
F_(uom_degrees), F_(uom_degrees), F_(uom_percent), F_(uom_lmin), F_(uom_kwh), F_(uom_wh), FL_(hours)[0], FL_(minutes)[0], F_(uom_ua),
F_(uom_bar), F_(uom_kw), F_(uom_w), F_(uom_kb), FL_(seconds)[0], F_(uom_dbm), F_(uom_fahrenheit), F_(uom_mv), F_(uom_sqm),
F_(uom_m3), F_(uom_l), F_(uom_kmin), F_(uom_k), F_(uom_volts), F_(uom_blank)

};

Expand Down
Loading

0 comments on commit 509d213

Please sign in to comment.