mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
extension module instead of pumpp module
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { AiOutlineControl, AiOutlineGateway, AiOutlineAlert, AiOutlineChrome } from 'react-icons/ai';
|
||||
import { AiOutlineControl, AiOutlineGateway, AiOutlineAlert } from 'react-icons/ai';
|
||||
import { CgSmartHomeBoiler } from 'react-icons/cg';
|
||||
|
||||
import { FaSolarPanel } from 'react-icons/fa';
|
||||
import { GiHeatHaze } from 'react-icons/gi';
|
||||
import { MdThermostatAuto, MdOutlineSensors, MdOutlineExtension } from 'react-icons/md';
|
||||
import { MdThermostatAuto, MdOutlineSensors, MdOutlineExtension, MdOutlineDevices } from 'react-icons/md';
|
||||
import { TiFlowSwitch } from 'react-icons/ti';
|
||||
import { VscVmConnect } from 'react-icons/vsc';
|
||||
import { DeviceType } from './types';
|
||||
@@ -38,8 +38,8 @@ const DeviceIcon: FC<DeviceIconProps> = ({ type_id }) => {
|
||||
return <VscVmConnect />;
|
||||
case DeviceType.ALERT:
|
||||
return <AiOutlineAlert />;
|
||||
case DeviceType.PUMP:
|
||||
return <AiOutlineChrome />;
|
||||
case DeviceType.EXTENSION:
|
||||
return <MdOutlineDevices />;
|
||||
case DeviceType.CUSTOM:
|
||||
return <MdOutlineExtension />;
|
||||
default:
|
||||
|
||||
@@ -364,7 +364,7 @@ export const enum DeviceType {
|
||||
CONTROLLER,
|
||||
CONNECT,
|
||||
ALERT,
|
||||
PUMP,
|
||||
EXTENSION,
|
||||
GENERIC,
|
||||
HEATSOURCE,
|
||||
CUSTOM,
|
||||
|
||||
@@ -169,8 +169,8 @@
|
||||
// Switches - 0x11
|
||||
{ 71, DeviceType::SWITCH, "WM10", DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||
|
||||
// EM10/EM100 module - 0x15
|
||||
{ 243, DeviceType::ALERT, "EM10/EM100", DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||
// EM10/100 extension module, pump module - 0x15
|
||||
{ 243, DeviceType::EXTENSION, "EM10/EM100", DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||
|
||||
// EM10 error contact and analog flowtemp control- 0x12
|
||||
{ 74, DeviceType::ALERT, "EM10", DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||
|
||||
132
src/devices/extension.cpp
Normal file
132
src/devices/extension.cpp
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* 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 "extension.h"
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
REGISTER_FACTORY(Extension, EMSdevice::DeviceType::EXTENSION);
|
||||
|
||||
Extension::Extension(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(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, &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);
|
||||
}
|
||||
|
||||
|
||||
// 0x935 needs fetch
|
||||
void Extension::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 Extension::process_EM100ConfigMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, dip_, 9);
|
||||
}
|
||||
|
||||
// alert(0x15) -B-> All(0x00), ?(0x0938), data: 01 62
|
||||
void Extension::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 Extension::process_EM100MonitorMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
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 Extension::process_EM100TempMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
has_update(telegram, headerTemp_, 0);
|
||||
}
|
||||
|
||||
bool Extension::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 Extension::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 Extension::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 Extension::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
|
||||
59
src/devices/extension.h
Normal file
59
src/devices/extension.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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_EXTENSION_H
|
||||
#define EMSESP_EXTENSION_H
|
||||
|
||||
#include "emsesp.h"
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
class Extension : public EMSdevice {
|
||||
public:
|
||||
Extension(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:
|
||||
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 setPower_; // request
|
||||
uint8_t setPoint_;
|
||||
uint8_t dip_; // dip switch
|
||||
uint8_t minV_;
|
||||
uint8_t maxV_;
|
||||
uint8_t minT_;
|
||||
uint8_t maxT_;
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
#endif
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* 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 "pump.h"
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
REGISTER_FACTORY(Pump, EMSdevice::DeviceType::PUMP);
|
||||
|
||||
Pump::Pump(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) {
|
||||
}
|
||||
|
||||
} // namespace emsesp
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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_PUMP_H
|
||||
#define EMSESP_PUMP_H
|
||||
|
||||
#include "emsesp.h"
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
class Pump : public EMSdevice {
|
||||
public:
|
||||
Pump(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand);
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
#endif
|
||||
@@ -131,8 +131,8 @@ const char * EMSdevice::device_type_2_device_name(const uint8_t device_type) {
|
||||
return F_(gateway);
|
||||
case DeviceType::ALERT:
|
||||
return F_(alert);
|
||||
case DeviceType::PUMP:
|
||||
return F_(pump);
|
||||
case DeviceType::EXTENSION:
|
||||
return F_(extension);
|
||||
case DeviceType::HEATSOURCE:
|
||||
return F_(heatsource);
|
||||
case DeviceType::CUSTOM:
|
||||
@@ -168,8 +168,8 @@ const char * EMSdevice::device_type_2_device_name_translated() {
|
||||
return Helpers::translated_word(FL_(gateway_device));
|
||||
case DeviceType::ALERT:
|
||||
return Helpers::translated_word(FL_(alert_device));
|
||||
case DeviceType::PUMP:
|
||||
return Helpers::translated_word(FL_(pump_device));
|
||||
case DeviceType::EXTENSION:
|
||||
return Helpers::translated_word(FL_(extension_device));
|
||||
case DeviceType::HEATSOURCE:
|
||||
return Helpers::translated_word(FL_(heatsource_device));
|
||||
case DeviceType::VENTILATION:
|
||||
@@ -229,8 +229,8 @@ uint8_t EMSdevice::device_name_2_device_type(const char * topic) {
|
||||
if (!strcmp(lowtopic, F_(alert))) {
|
||||
return DeviceType::ALERT;
|
||||
}
|
||||
if (!strcmp(lowtopic, F_(pump))) {
|
||||
return DeviceType::PUMP;
|
||||
if (!strcmp(lowtopic, F_(extension))) {
|
||||
return DeviceType::EXTENSION;
|
||||
}
|
||||
if (!strcmp(lowtopic, F_(heatsource))) {
|
||||
return DeviceType::HEATSOURCE;
|
||||
|
||||
@@ -350,7 +350,7 @@ class EMSdevice {
|
||||
CONTROLLER,
|
||||
CONNECT,
|
||||
ALERT,
|
||||
PUMP,
|
||||
EXTENSION,
|
||||
GENERIC,
|
||||
HEATSOURCE,
|
||||
CUSTOM,
|
||||
@@ -375,7 +375,7 @@ class EMSdevice {
|
||||
static constexpr uint8_t EMS_DEVICE_ID_CLOCK = 0x0F;
|
||||
static constexpr uint8_t EMS_DEVICE_ID_SWITCH = 0x11; // Switch WM10
|
||||
static constexpr uint8_t EMS_DEVICE_ID_ALERT = 0x12; // Error module EM10
|
||||
static constexpr uint8_t EMS_DEVICE_ID_PUMP = 0x15; // Pump module PM10
|
||||
static constexpr uint8_t EMS_DEVICE_ID_EXTENSION = 0x15; // Extension module EM1000, Pump module PM10
|
||||
static constexpr uint8_t EMS_DEVICE_ID_MODEM = 0x48;
|
||||
static constexpr uint8_t EMS_DEVICE_ID_RFSENSOR = 0x40; // RF sensor only sending, no reply
|
||||
static constexpr uint8_t EMS_DEVICE_ID_RFBASE = 0x50;
|
||||
|
||||
@@ -97,6 +97,7 @@ MAKE_WORD(analogsensor)
|
||||
MAKE_WORD(temperaturesensor)
|
||||
MAKE_WORD(alert)
|
||||
MAKE_WORD(pump)
|
||||
MAKE_WORD(extension)
|
||||
MAKE_WORD(heatsource)
|
||||
MAKE_WORD(scheduler)
|
||||
MAKE_WORD(custom)
|
||||
|
||||
@@ -46,7 +46,8 @@ MAKE_WORD_TRANSLATION(controller_device, "Controller Module", "Kontrollmodul", "
|
||||
MAKE_WORD_TRANSLATION(switch_device, "Switch Module", "Schaltmodul", "Switch Module", "Relämodul", "Moduł przełączający", "Switch modul", "", "Anahtar", "Modulo Switch") // TODO translate
|
||||
MAKE_WORD_TRANSLATION(gateway_device, "Gateway Module", "Gateway Modul", "Gateway Module", "Gateway", "Moduł IP", "Gateway", "", "Ağ Geçidi", "Modulo Gateway") // TODO translate
|
||||
MAKE_WORD_TRANSLATION(alert_device, "Alert Module", "Alarmmodul", "Alert Module", "Larmmodul", "Moduł alarmowy", "Alarmmodul", "", "Alarm Cihazı", "Module Avviso") // TODO translate
|
||||
MAKE_WORD_TRANSLATION(pump_device, "Pump Module", "Pumpenmodul", "Pump Module", "Pumpmodul", "Moduł pompy", "Pumpemodul", "", "Pompa", "Module Pompa") // TODO translate
|
||||
//MAKE_WORD_TRANSLATION(pump_device, "Pump Module", "Pumpenmodul", "Pump Module", "Pumpmodul", "Moduł pompy", "Pumpemodul", "", "Pompa", "Module Pompa") // TODO translate
|
||||
MAKE_WORD_TRANSLATION(extension_device, "Extension Module", "Erweiterungsnmodul", "Module", "Modul", "Moduł", "Modul", "", "", "Module") // TODO translate
|
||||
MAKE_WORD_TRANSLATION(heatsource_device, "Heatsource", "Heizquelle", "Heatsource", "Värmekälla", "Źródło ciepła", "Varmekilde", "", "Isı Kaynağı", "Fonte di calore") // TODO translate
|
||||
MAKE_WORD_TRANSLATION(sensors_device, "Sensors", "Sensoren", "Sensoren", "Sensorer", "Czujniki", "Sensorer", "Capteurs", "Sensör Cihazı", "Sensori")
|
||||
MAKE_WORD_TRANSLATION(unknown_device, "Unknown", "Unbekannt", "Onbekend", "Okänt", "Nieznane urządzenie", "Ukjent", "Inconnu", "Bilinmeyen", "Sconosciuto")
|
||||
|
||||
Reference in New Issue
Block a user