add ventilation bypass

This commit is contained in:
MichaelDvP
2023-06-04 15:32:43 +02:00
parent cbc9607b26
commit 181b672c1a
6 changed files with 76 additions and 55 deletions

View File

@@ -47,7 +47,7 @@
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.59.8", "@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8", "@typescript-eslint/parser": "^5.59.8",
"@vitejs/plugin-react-swc": "^3.3.1", "@vitejs/plugin-react-swc": "^3.3.2",
"eslint": "^8.42.0", "eslint": "^8.42.0",
"eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0", "eslint-config-airbnb-typescript": "^17.0.0",

View File

@@ -1101,90 +1101,90 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-darwin-arm64@npm:1.3.56": "@swc/core-darwin-arm64@npm:1.3.62":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core-darwin-arm64@npm:1.3.56" resolution: "@swc/core-darwin-arm64@npm:1.3.62"
conditions: os=darwin & cpu=arm64 conditions: os=darwin & cpu=arm64
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-darwin-x64@npm:1.3.56": "@swc/core-darwin-x64@npm:1.3.62":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core-darwin-x64@npm:1.3.56" resolution: "@swc/core-darwin-x64@npm:1.3.62"
conditions: os=darwin & cpu=x64 conditions: os=darwin & cpu=x64
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-linux-arm-gnueabihf@npm:1.3.56": "@swc/core-linux-arm-gnueabihf@npm:1.3.62":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.3.56" resolution: "@swc/core-linux-arm-gnueabihf@npm:1.3.62"
conditions: os=linux & cpu=arm conditions: os=linux & cpu=arm
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-linux-arm64-gnu@npm:1.3.56": "@swc/core-linux-arm64-gnu@npm:1.3.62":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core-linux-arm64-gnu@npm:1.3.56" resolution: "@swc/core-linux-arm64-gnu@npm:1.3.62"
conditions: os=linux & cpu=arm64 & libc=glibc conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-linux-arm64-musl@npm:1.3.56": "@swc/core-linux-arm64-musl@npm:1.3.62":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core-linux-arm64-musl@npm:1.3.56" resolution: "@swc/core-linux-arm64-musl@npm:1.3.62"
conditions: os=linux & cpu=arm64 & libc=musl conditions: os=linux & cpu=arm64 & libc=musl
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-linux-x64-gnu@npm:1.3.56": "@swc/core-linux-x64-gnu@npm:1.3.62":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core-linux-x64-gnu@npm:1.3.56" resolution: "@swc/core-linux-x64-gnu@npm:1.3.62"
conditions: os=linux & cpu=x64 & libc=glibc conditions: os=linux & cpu=x64 & libc=glibc
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-linux-x64-musl@npm:1.3.56": "@swc/core-linux-x64-musl@npm:1.3.62":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core-linux-x64-musl@npm:1.3.56" resolution: "@swc/core-linux-x64-musl@npm:1.3.62"
conditions: os=linux & cpu=x64 & libc=musl conditions: os=linux & cpu=x64 & libc=musl
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-win32-arm64-msvc@npm:1.3.56": "@swc/core-win32-arm64-msvc@npm:1.3.62":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core-win32-arm64-msvc@npm:1.3.56" resolution: "@swc/core-win32-arm64-msvc@npm:1.3.62"
conditions: os=win32 & cpu=arm64 conditions: os=win32 & cpu=arm64
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-win32-ia32-msvc@npm:1.3.56": "@swc/core-win32-ia32-msvc@npm:1.3.62":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core-win32-ia32-msvc@npm:1.3.56" resolution: "@swc/core-win32-ia32-msvc@npm:1.3.62"
conditions: os=win32 & cpu=ia32 conditions: os=win32 & cpu=ia32
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core-win32-x64-msvc@npm:1.3.56": "@swc/core-win32-x64-msvc@npm:1.3.62":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core-win32-x64-msvc@npm:1.3.56" resolution: "@swc/core-win32-x64-msvc@npm:1.3.62"
conditions: os=win32 & cpu=x64 conditions: os=win32 & cpu=x64
languageName: node languageName: node
linkType: hard linkType: hard
"@swc/core@npm:^1.3.56": "@swc/core@npm:^1.3.61":
version: 1.3.56 version: 1.3.62
resolution: "@swc/core@npm:1.3.56" resolution: "@swc/core@npm:1.3.62"
dependencies: dependencies:
"@swc/core-darwin-arm64": 1.3.56 "@swc/core-darwin-arm64": 1.3.62
"@swc/core-darwin-x64": 1.3.56 "@swc/core-darwin-x64": 1.3.62
"@swc/core-linux-arm-gnueabihf": 1.3.56 "@swc/core-linux-arm-gnueabihf": 1.3.62
"@swc/core-linux-arm64-gnu": 1.3.56 "@swc/core-linux-arm64-gnu": 1.3.62
"@swc/core-linux-arm64-musl": 1.3.56 "@swc/core-linux-arm64-musl": 1.3.62
"@swc/core-linux-x64-gnu": 1.3.56 "@swc/core-linux-x64-gnu": 1.3.62
"@swc/core-linux-x64-musl": 1.3.56 "@swc/core-linux-x64-musl": 1.3.62
"@swc/core-win32-arm64-msvc": 1.3.56 "@swc/core-win32-arm64-msvc": 1.3.62
"@swc/core-win32-ia32-msvc": 1.3.56 "@swc/core-win32-ia32-msvc": 1.3.62
"@swc/core-win32-x64-msvc": 1.3.56 "@swc/core-win32-x64-msvc": 1.3.62
peerDependencies: peerDependencies:
"@swc/helpers": ^0.5.0 "@swc/helpers": ^0.5.0
dependenciesMeta: dependenciesMeta:
@@ -1211,7 +1211,7 @@ __metadata:
peerDependenciesMeta: peerDependenciesMeta:
"@swc/helpers": "@swc/helpers":
optional: true optional: true
checksum: c468e281f0249742bc0ba4b7cd4076cdbf87bfc82b8bd5ad1ca8940d36372ca22754df80ab54b22613121680718eab26b92c48c8c9f5f3abb24434f05e5e1ea0 checksum: aaa0827960f656c762733836938d31b2d596495b8430eb6feb0d1f6b1416b3444e7b59c326ae37ee410d8d3d25fff20ac8ff0f66ebe8a87e7fae1ca651aff915
languageName: node languageName: node
linkType: hard linkType: hard
@@ -1507,14 +1507,14 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@vitejs/plugin-react-swc@npm:^3.3.1": "@vitejs/plugin-react-swc@npm:^3.3.2":
version: 3.3.1 version: 3.3.2
resolution: "@vitejs/plugin-react-swc@npm:3.3.1" resolution: "@vitejs/plugin-react-swc@npm:3.3.2"
dependencies: dependencies:
"@swc/core": ^1.3.56 "@swc/core": ^1.3.61
peerDependencies: peerDependencies:
vite: ^4 vite: ^4
checksum: 72ab0a72d41c949009a2f71836894fb0003939329a2d1bb59b1181b03d21fda5002ccd20b40b48ddc8f12511cc8717122141f49ac51e97263df3c3f3142ae937 checksum: 8544023de3dc605d00f66db10de085b2a90887111657db87dd192e02ffc1e4a191b09d58180b4ba498858f01e8861d15e216d744e0f6dfad2550065999890fb2
languageName: node languageName: node
linkType: hard linkType: hard
@@ -1534,7 +1534,7 @@ __metadata:
"@types/react-router-dom": ^5.3.3 "@types/react-router-dom": ^5.3.3
"@typescript-eslint/eslint-plugin": ^5.59.8 "@typescript-eslint/eslint-plugin": ^5.59.8
"@typescript-eslint/parser": ^5.59.8 "@typescript-eslint/parser": ^5.59.8
"@vitejs/plugin-react-swc": ^3.3.1 "@vitejs/plugin-react-swc": ^3.3.2
async-validator: ^4.2.5 async-validator: ^4.2.5
axios: ^1.4.0 axios: ^1.4.0
eslint: ^8.42.0 eslint: ^8.42.0

View File

@@ -577,7 +577,7 @@ void MqttClient::_onPubrec() {
while (it) { while (it) {
// PUBRECs come in the order PUBs are sent. So we only check the first PUB packet in outbox // PUBRECs come in the order PUBs are sent. So we only check the first PUB packet in outbox
// if it doesn't match the ID, return // if it doesn't match the ID, return
if ((it.get()->packet.packetType()) == PacketType.PUBLISH) { if ((it.get()->packet.packetType()) == PacketType.PUBLISH || (it.get()->packet.packetType()) == PacketType.PUBREL) {
if (it.get()->packet.packetId() == idToMatch) { if (it.get()->packet.packetId() == idToMatch) {
if (!_addPacket(PacketType.PUBREL, idToMatch)) { if (!_addPacket(PacketType.PUBREL, idToMatch)) {
emc_log_e("Could not create PUBREL packet"); emc_log_e("Could not create PUBREL packet");
@@ -707,7 +707,9 @@ uint16_t MqttClient::getQueue() const {
espMqttClientInternals::Outbox<OutgoingPacket>::Iterator it = _outbox.front(); espMqttClientInternals::Outbox<OutgoingPacket>::Iterator it = _outbox.front();
uint16_t count = 0; uint16_t count = 0;
while (it) { while (it) {
++count; if (it.get()->packet.packetType() == PacketType.PUBLISH) {
++count;
}
++it; ++it;
} }
EMC_SEMAPHORE_GIVE(); EMC_SEMAPHORE_GIVE();

View File

@@ -29,6 +29,7 @@ Ventilation::Ventilation(uint8_t device_type, uint8_t device_id, uint8_t product
register_telegram_type(0x585, "Blowerspeed", false, MAKE_PF_CB(process_BlowerMessage)); register_telegram_type(0x585, "Blowerspeed", false, MAKE_PF_CB(process_BlowerMessage));
register_telegram_type(0x583, "VentilationMonitor", false, MAKE_PF_CB(process_MonitorMessage)); register_telegram_type(0x583, "VentilationMonitor", false, MAKE_PF_CB(process_MonitorMessage));
register_telegram_type(0x5D9, "Airquality", false, MAKE_PF_CB(process_VOCMessage)); register_telegram_type(0x5D9, "Airquality", false, MAKE_PF_CB(process_VOCMessage));
register_telegram_type(0x587, "Bypass", false, MAKE_PF_CB(process_BypassMessage));
// register_telegram_type(0x5, "VentilationSet", true, MAKE_PF_CB(process_SetMessage)); // register_telegram_type(0x5, "VentilationSet", true, MAKE_PF_CB(process_SetMessage));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
@@ -44,7 +45,8 @@ Ventilation::Ventilation(uint8_t device_type, uint8_t device_id, uint8_t product
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ventOutSpeed_, DeviceValueType::UINT, FL_(ventOutSpeed), DeviceValueUOM::PERCENT); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ventOutSpeed_, DeviceValueType::UINT, FL_(ventOutSpeed), DeviceValueUOM::PERCENT);
register_device_value( register_device_value(
DeviceValueTAG::TAG_DEVICE_DATA, &mode_, DeviceValueType::ENUM, FL_(enum_ventMode), FL_(ventInSpeed), DeviceValueUOM::NONE, MAKE_CF_CB(set_ventMode)); DeviceValueTAG::TAG_DEVICE_DATA, &mode_, DeviceValueType::ENUM, FL_(enum_ventMode), FL_(ventInSpeed), DeviceValueUOM::NONE, MAKE_CF_CB(set_ventMode));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &voc_, DeviceValueType::USHORT, DeviceValueNumOp::DV_NUMOP_DIV10, FL_(airquality), DeviceValueUOM::NONE); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &voc_, DeviceValueType::USHORT, FL_(airquality), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &bypass_, DeviceValueType::BOOL, FL_(bypass), DeviceValueUOM::NONE, MAKE_CF_CB(set_bypass));
} }
// message // message
@@ -81,6 +83,11 @@ void Ventilation::process_ModeMessage(std::shared_ptr<const Telegram> telegram)
has_enumupdate(telegram, mode_, 0, -1); has_enumupdate(telegram, mode_, 0, -1);
} }
// message 0x0587, data: 01 00
void Ventilation::process_BypassMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, bypass_, 1);
}
bool Ventilation::set_ventMode(const char * value, const int8_t id) { bool Ventilation::set_ventMode(const char * value, const int8_t id) {
uint8_t v; uint8_t v;
if (!Helpers::value2enum(value, v, FL_(enum_ventMode))) { if (!Helpers::value2enum(value, v, FL_(enum_ventMode))) {
@@ -99,4 +106,13 @@ bool Ventilation::set_filter(const char * value, const int8_t id) {
return true; return true;
} }
bool Ventilation::set_bypass(const char * value, const int8_t id) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x55C, 1, b ? 1 : 0, 0x587);
return true;
}
} // namespace emsesp } // namespace emsesp

View File

@@ -34,7 +34,7 @@ class Ventilation : public EMSdevice {
int16_t inEx_; int16_t inEx_;
int16_t outEx_; int16_t outEx_;
uint16_t voc_; uint16_t voc_;
// uint8_t bypass_; uint8_t bypass_;
// uint16_t filterRemain_; // uint16_t filterRemain_;
uint8_t ventInSpeed_; uint8_t ventInSpeed_;
uint8_t ventOutSpeed_; uint8_t ventOutSpeed_;
@@ -45,8 +45,10 @@ class Ventilation : public EMSdevice {
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_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
void process_BypassMessage(std::shared_ptr<const Telegram> telegram); // 0x56B
bool set_ventMode(const char * value, const int8_t id); bool set_ventMode(const char * value, const int8_t id);
bool set_bypass(const char * value, const int8_t id);
bool set_filter(const char * value, const int8_t id); bool set_filter(const char * value, const int8_t id);

View File

@@ -597,6 +597,7 @@ void EMSESP::publish_other_values() {
publish_device_values(EMSdevice::DeviceType::SWITCH); publish_device_values(EMSdevice::DeviceType::SWITCH);
publish_device_values(EMSdevice::DeviceType::HEATPUMP); publish_device_values(EMSdevice::DeviceType::HEATPUMP);
publish_device_values(EMSdevice::DeviceType::HEATSOURCE); publish_device_values(EMSdevice::DeviceType::HEATSOURCE);
publish_device_values(EMSdevice::DeviceType::VENTILATION);
// other devices without values yet // other devices without values yet
// publish_device_values(EMSdevice::DeviceType::GATEWAY); // publish_device_values(EMSdevice::DeviceType::GATEWAY);
// publish_device_values(EMSdevice::DeviceType::CONNECT); // publish_device_values(EMSdevice::DeviceType::CONNECT);