mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-11 02:09:57 +03:00
add ventilation device class
This commit is contained in:
96
src/devices/ventilation.cpp
Normal file
96
src/devices/ventilation.cpp
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020-2023 Paul Derbyshire
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ventilation.h"
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
REGISTER_FACTORY(Ventilation, EMSdevice::DeviceType::VENTILATION);
|
||||
|
||||
Ventilation::Ventilation(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) {
|
||||
// HRV176 module, device_id 0x51
|
||||
register_telegram_type(0x56B, "VentilationMode", true, MAKE_PF_CB(process_ModeMessage));
|
||||
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(0x5D9, "Airquality", false, MAKE_PF_CB(process_VOCMessage));
|
||||
// register_telegram_type(0x5, "VentilationSet", true, MAKE_PF_CB(process_SetMessage));
|
||||
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &outFresh_, DeviceValueType::SHORT, FL_(outFresh), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &inFresh_, DeviceValueType::SHORT, FL_(inFresh), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &outEx_, DeviceValueType::SHORT, FL_(outEx), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &inEx_, DeviceValueType::SHORT, FL_(inEx), DeviceValueUOM::DEGREES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ventInSpeed_, DeviceValueType::UINT, FL_(ventInSpeed), DeviceValueUOM::PERCENT);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ventOutSpeed_, DeviceValueType::UINT, FL_(ventOutSpeed), DeviceValueUOM::PERCENT);
|
||||
register_device_value(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, FL_(airquality), DeviceValueUOM::NONE);
|
||||
}
|
||||
|
||||
// message
|
||||
void Ventilation::process_SetMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
}
|
||||
|
||||
// message 583
|
||||
void Ventilation::process_MonitorMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
// has_update(telegram, outFresh_, ?);
|
||||
// has_update(telegram, inFresh_, ?);
|
||||
// has_update(telegram, outEx_, ?);
|
||||
// has_update(telegram, inEx_, ?);
|
||||
}
|
||||
|
||||
// message 575 10 bytes
|
||||
// data: 02 02 46 46 00 00 FF 80 00 01
|
||||
// 0-level out, 1-level in, 2-mod out, 3-mod in, 9-mode:1-manual/2-auto/3-prog
|
||||
|
||||
// message 585 26 bytes long
|
||||
// Data: 46 46 00 00 00 77 00 03 F4 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
void Ventilation::process_BlowerMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, ventOutSpeed_, 0);
|
||||
has_update(telegram, ventInSpeed_, 1);
|
||||
}
|
||||
|
||||
// message 0x05D9, data: 03 9C FF
|
||||
void Ventilation::process_VOCMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, voc_, 0);
|
||||
}
|
||||
|
||||
// message 0x56B
|
||||
// level 0=0, 1=1, 2=2, 3=3, 4= 4, Auto 0xFF, demand 5, sleep 6, intense 7, bypass-8, party 9, fireplace 0A
|
||||
void Ventilation::process_ModeMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_enumupdate(telegram, mode_, 0, -1);
|
||||
}
|
||||
|
||||
bool Ventilation::set_ventMode(const char * value, const int8_t id) {
|
||||
uint8_t v;
|
||||
if (!Helpers::value2enum(value, v, FL_(enum_ventMode))) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x56B, 0, v - 1, 0x56B);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Ventilation::set_filter(const char * value, const int8_t id) {
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
// write_command(0x5xx, 0, v, 0x5xx);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace emsesp
|
||||
117
src/devices/ventilation.h
Normal file
117
src/devices/ventilation.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020-2023 Paul Derbyshire
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef EMSESP_VENTILATION_H
|
||||
#define EMSESP_VENTILATION_H
|
||||
|
||||
#include "emsesp.h"
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
class Ventilation : public EMSdevice {
|
||||
public:
|
||||
Ventilation(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand);
|
||||
|
||||
private:
|
||||
uint8_t mode_;
|
||||
int16_t outFresh_;
|
||||
int16_t inFresh_;
|
||||
int16_t inEx_;
|
||||
int16_t outEx_;
|
||||
uint16_t voc_;
|
||||
uint8_t bypass_;
|
||||
uint16_t filterRemain_;
|
||||
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_BlowerMessage(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);
|
||||
|
||||
|
||||
/* Sensors:
|
||||
outdoor air temp (außenluft)
|
||||
supply air temp (zuluft)
|
||||
extract air temp (abluft)
|
||||
away air temp (fortluft)
|
||||
supply blower (zuluftgebläse)
|
||||
supply blower mod (zuluftebläse drehzahl)
|
||||
away blower (abluftgebläse)
|
||||
away blower mod (abluftgebläse drehzahl)
|
||||
Anschlussvariante
|
||||
el. vorheizer
|
||||
ext. el. vorheizreg.
|
||||
nachheiz zulufttemp
|
||||
mischer öffnen
|
||||
mischer schließen
|
||||
mischerposition
|
||||
zuluft temp soll
|
||||
zuluft temp ist
|
||||
leistung nachheizreg.
|
||||
erdwärmetauscher klappe
|
||||
solekreispumpe
|
||||
abluftfeuchte
|
||||
abluftqualität
|
||||
raumluftfechte
|
||||
raumluftqualität
|
||||
luftfeuchte fernbed. 1..4
|
||||
*/
|
||||
/* Parameters:
|
||||
Gerätetyp,
|
||||
Nennvolumentstrom,
|
||||
Filterlaufzeit 1-6-12 m
|
||||
Filterwechsel confirm CMD
|
||||
Lüftungsfrostschutz: _el._preheat_, Disballance | Interval
|
||||
Ext. Frostschutz: on/_off_
|
||||
Bypass _on_, off
|
||||
min. outdoortemp 12 15 19 °C
|
||||
max. outdoortemp 21-24-30 C
|
||||
Enthalpie Wärmetauscher instaliert nein-ja
|
||||
Feuchteschutz AUs/ 1-24 h
|
||||
Lüfterstufe 1-4, Drehzahlanpassung
|
||||
ext. Luftfeuchtefühler inst.? _nein_, ja
|
||||
Abluftfeuchtefühler inst.? _nein_, ja
|
||||
Luftfeuchte Fernbed. _nein_, ja
|
||||
Luftfeuchte: trocken, _normal_, feucht
|
||||
Abluftqualitätsfühler inst. _ja_, nein
|
||||
ext. Luftqualfühl? _nein_, ja
|
||||
Lufqualität: ausreichend, _normal_, hoch
|
||||
el. Nachheizregister inst. _nein_, ja
|
||||
Nachheiz-Zuluft temp: 10-22-30 °C
|
||||
Erdwärmetauscher inst? _nein_, Luft, Sole
|
||||
Taster Funktion: nein, einschlafen, intensiv, bypass, party, kamin
|
||||
ext. Störung aktivieren: _nein_, ja, invertiert
|
||||
Dauer einschlafen: 15-60-120 min
|
||||
Dauer Intensiv: 5-15-60 min
|
||||
Dauer Bypass Abluft: 1-8-12 h
|
||||
Dauer Bypass: 1-8-12 h
|
||||
Dauer PArty 1-8-12 h
|
||||
Dauer Kamin: 5-10-15 min
|
||||
Volumenstromabgleich 90-100-110 %
|
||||
*/
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user