mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
Merge branch 'dev' into dev
This commit is contained in:
@@ -86,8 +86,10 @@ const SystemStatusForm: FC = () => {
|
||||
const restart = async () => {
|
||||
setProcessing(true);
|
||||
try {
|
||||
await SystemApi.restart();
|
||||
setRestarting(true);
|
||||
const response = await SystemApi.restart();
|
||||
if (response.status === 200) {
|
||||
setRestarting(true);
|
||||
}
|
||||
} catch (error) {
|
||||
enqueueSnackbar(extractErrorMessage(error, LL.PROBLEM_LOADING()), { variant: 'error' });
|
||||
} finally {
|
||||
@@ -208,7 +210,7 @@ const SystemStatusForm: FC = () => {
|
||||
setProcessing(true);
|
||||
try {
|
||||
await SystemApi.factoryReset();
|
||||
enqueueSnackbar(LL.SYSTEM_FACTORY_TEXT(), { variant: 'info' });
|
||||
setRestarting(true);
|
||||
} catch (error) {
|
||||
enqueueSnackbar(extractErrorMessage(error, LL.PROBLEM_UPDATING()), { variant: 'error' });
|
||||
} finally {
|
||||
|
||||
@@ -9,6 +9,8 @@ import { GiHeatHaze } from 'react-icons/gi';
|
||||
import { TiFlowSwitch } from 'react-icons/ti';
|
||||
import { VscVmConnect } from 'react-icons/vsc';
|
||||
import { AiOutlineGateway } from 'react-icons/ai';
|
||||
import { AiOutlineAlert } from 'react-icons/ai';
|
||||
import { AiOutlineChrome } from 'react-icons/ai';
|
||||
|
||||
interface DeviceIconProps {
|
||||
type: string;
|
||||
@@ -34,6 +36,10 @@ const DeviceIcon: FC<DeviceIconProps> = ({ type }) => {
|
||||
return <VscVmConnect />;
|
||||
case 'Gateway':
|
||||
return <AiOutlineGateway />;
|
||||
case 'Alert':
|
||||
return <AiOutlineAlert />;
|
||||
case 'Pump':
|
||||
return <AiOutlineChrome />;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ export const DeviceValueUOM_s = [
|
||||
'Wh',
|
||||
'hours',
|
||||
'minutes',
|
||||
'uA',
|
||||
'µA',
|
||||
'bar',
|
||||
'kW',
|
||||
'W',
|
||||
@@ -201,8 +201,8 @@ export const DeviceValueUOM_s = [
|
||||
'dBm',
|
||||
'°F',
|
||||
'mV',
|
||||
'sqm',
|
||||
'm3',
|
||||
'm²',
|
||||
'm³',
|
||||
'l'
|
||||
];
|
||||
|
||||
|
||||
@@ -153,8 +153,11 @@
|
||||
// Switches - 0x11
|
||||
{ 71, DeviceType::SWITCH, "WM10", DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||
|
||||
// PM10 Pump module - 0x15
|
||||
{ 243, DeviceType::PUMP, "PM10", DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||
|
||||
// EM10 error contact and analog flowtemp control- 0x12
|
||||
{ 74, DeviceType::GATEWAY, "Error Module EM10", DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||
{ 74, DeviceType::ALERT, "EM10", DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||
|
||||
// Gateways - 0x48
|
||||
{189, DeviceType::GATEWAY, "KM200/MB LAN 2", DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||
|
||||
29
src/devices/alert.cpp
Normal file
29
src/devices/alert.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020 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 "alert.h"
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
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) {
|
||||
}
|
||||
|
||||
} // namespace emsesp
|
||||
33
src/devices/alert.h
Normal file
33
src/devices/alert.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020 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_ALERT_H
|
||||
#define EMSESP_ALERT_H
|
||||
|
||||
#include "emsesp.h"
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
class Alert : public EMSdevice {
|
||||
public:
|
||||
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);
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
#endif
|
||||
@@ -321,10 +321,10 @@ class Boiler : public EMSdevice {
|
||||
bool set_max_pump(const char * value, const int8_t id);
|
||||
bool set_hyst_on(const char * value, const int8_t id);
|
||||
bool set_hyst_off(const char * value, const int8_t id);
|
||||
bool set_hyst2_on(const char * value, const int8_t id) {
|
||||
inline bool set_hyst2_on(const char * value, const int8_t id) {
|
||||
return set_hyst_on(value, 2);
|
||||
}
|
||||
bool set_hyst2_off(const char * value, const int8_t id) {
|
||||
inline bool set_hyst2_off(const char * value, const int8_t id) {
|
||||
return set_hyst_off(value, 2);
|
||||
}
|
||||
bool set_burn_period(const char * value, const int8_t id);
|
||||
@@ -356,26 +356,26 @@ class Boiler : public EMSdevice {
|
||||
bool set_blockHyst(const char * value, const int8_t id); // pos 14?: Hyst. for bolier block (K)
|
||||
bool set_releaseWait(const char * value, const int8_t id); // pos 15: Boiler release wait time (min)
|
||||
bool set_HpInLogic(const char * value, const int8_t id);
|
||||
bool set_HpIn1Logic(const char * value, const int8_t id) {
|
||||
inline bool set_HpIn1Logic(const char * value, const int8_t id) {
|
||||
return set_HpInLogic(value, 1);
|
||||
}
|
||||
bool set_HpIn2Logic(const char * value, const int8_t id) {
|
||||
inline bool set_HpIn2Logic(const char * value, const int8_t id) {
|
||||
return set_HpInLogic(value, 2);
|
||||
}
|
||||
bool set_HpIn3Logic(const char * value, const int8_t id) {
|
||||
inline bool set_HpIn3Logic(const char * value, const int8_t id) {
|
||||
return set_HpInLogic(value, 3);
|
||||
}
|
||||
bool set_HpIn4Logic(const char * value, const int8_t id) {
|
||||
inline bool set_HpIn4Logic(const char * value, const int8_t id) {
|
||||
return set_HpInLogic(value, 4);
|
||||
}
|
||||
bool set_maxHeat(const char * value, const int8_t id);
|
||||
bool set_maxHeatComp(const char * value, const int8_t id) {
|
||||
inline bool set_maxHeatComp(const char * value, const int8_t id) {
|
||||
return set_maxHeat(value, 2);
|
||||
}
|
||||
bool set_maxHeatHeat(const char * value, const int8_t id) {
|
||||
inline bool set_maxHeatHeat(const char * value, const int8_t id) {
|
||||
return set_maxHeat(value, 3);
|
||||
}
|
||||
bool set_maxHeatDhw(const char * value, const int8_t id) {
|
||||
inline bool set_maxHeatDhw(const char * value, const int8_t id) {
|
||||
return set_maxHeat(value, 4);
|
||||
}
|
||||
|
||||
|
||||
29
src/devices/pump.cpp
Normal file
29
src/devices/pump.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020 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
|
||||
33
src/devices/pump.h
Normal file
33
src/devices/pump.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020 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
|
||||
@@ -396,7 +396,7 @@ class Thermostat : public EMSdevice {
|
||||
bool set_mode(const char * value, const int8_t id);
|
||||
bool set_control(const char * value, const int8_t id);
|
||||
bool set_holiday(const char * value, const int8_t id, const bool vacation = false);
|
||||
bool set_vacation(const char * value, const int8_t id) {
|
||||
inline bool set_vacation(const char * value, const int8_t id) {
|
||||
return set_holiday(value, id, true);
|
||||
}
|
||||
bool set_pause(const char * value, const int8_t id);
|
||||
@@ -458,10 +458,10 @@ class Thermostat : public EMSdevice {
|
||||
bool set_wwDailyHeating(const char * value, const int8_t id);
|
||||
bool set_wwDailyHeatTime(const char * value, const int8_t id);
|
||||
bool set_wwwhenmodeoff(const char * value, const int8_t id);
|
||||
bool set_wwVacation(const char * value, const int8_t id) {
|
||||
inline bool set_wwVacation(const char * value, const int8_t id) {
|
||||
return set_holiday(value, DeviceValueTAG::TAG_WWC1, true);
|
||||
}
|
||||
bool set_wwHoliday(const char * value, const int8_t id) {
|
||||
inline bool set_wwHoliday(const char * value, const int8_t id) {
|
||||
return set_holiday(value, DeviceValueTAG::TAG_WWC1);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,12 +51,21 @@ std::string EMSdevice::tag_to_mqtt(uint8_t tag) {
|
||||
return (DeviceValue::DeviceValueTAG_mqtt[tag]);
|
||||
}
|
||||
|
||||
// convert UOM to a string - these don't need translating
|
||||
// convert UOM to a string - translating only for hours/minutes/seconds
|
||||
std::string EMSdevice::uom_to_string(uint8_t uom) {
|
||||
if (EMSESP::system_.fahrenheit() && (uom == DeviceValueUOM::DEGREES || uom == DeviceValueUOM::DEGREES_R)) {
|
||||
return (DeviceValue::DeviceValueUOM_s[DeviceValueUOM::FAHRENHEIT]);
|
||||
switch (uom) {
|
||||
case DeviceValueUOM::DEGREES:
|
||||
case DeviceValueUOM::DEGREES_R:
|
||||
return EMSESP::system_.fahrenheit() ? DeviceValue::DeviceValueUOM_s[DeviceValueUOM::FAHRENHEIT] : DeviceValue::DeviceValueUOM_s[uom];
|
||||
case DeviceValueUOM::HOURS:
|
||||
return Helpers::translated_word(FL_(hours));
|
||||
case DeviceValueUOM::MINUTES:
|
||||
return Helpers::translated_word(FL_(minutes));
|
||||
case DeviceValueUOM::SECONDS:
|
||||
return Helpers::translated_word(FL_(seconds));
|
||||
default:
|
||||
return DeviceValue::DeviceValueUOM_s[uom];
|
||||
}
|
||||
return (DeviceValue::DeviceValueUOM_s[uom]);
|
||||
}
|
||||
|
||||
std::string EMSdevice::brand_to_string() const {
|
||||
@@ -107,6 +116,10 @@ const char * EMSdevice::device_type_2_device_name(const uint8_t device_type) {
|
||||
return F_(switch);
|
||||
case DeviceType::GATEWAY:
|
||||
return F_(gateway);
|
||||
case DeviceType::ALERT:
|
||||
return F_(alert);
|
||||
case DeviceType::PUMP:
|
||||
return F_(pump);
|
||||
default:
|
||||
return Helpers::translated_word(FL_(unknown));
|
||||
}
|
||||
@@ -128,42 +141,39 @@ uint8_t EMSdevice::device_name_2_device_type(const char * topic) {
|
||||
if (!strcmp(lowtopic, F_(boiler))) {
|
||||
return DeviceType::BOILER;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, F_(thermostat))) {
|
||||
return DeviceType::THERMOSTAT;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, F_(system))) {
|
||||
return DeviceType::SYSTEM;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, F_(heatpump))) {
|
||||
return DeviceType::HEATPUMP;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, F_(solar))) {
|
||||
return DeviceType::SOLAR;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, F_(mixer))) {
|
||||
return DeviceType::MIXER;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, F_(dallassensor))) {
|
||||
return DeviceType::DALLASSENSOR;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, F_(analogsensor))) {
|
||||
return DeviceType::ANALOGSENSOR;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, F_(switch))) {
|
||||
return DeviceType::SWITCH;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, F_(gateway))) {
|
||||
return DeviceType::GATEWAY;
|
||||
}
|
||||
if (!strcmp(lowtopic, F_(alert))) {
|
||||
return DeviceType::ALERT;
|
||||
}
|
||||
if (!strcmp(lowtopic, F_(pump))) {
|
||||
return DeviceType::PUMP;
|
||||
}
|
||||
|
||||
return DeviceType::UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -338,6 +338,8 @@ class EMSdevice {
|
||||
SWITCH,
|
||||
CONTROLLER,
|
||||
CONNECT,
|
||||
ALERT,
|
||||
PUMP,
|
||||
GENERIC,
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
@@ -124,6 +124,8 @@ const char * DeviceValue::DeviceValueUOM_s[] = {
|
||||
F_(uom_fahrenheit), //
|
||||
F_(uom_mv), //
|
||||
F_(uom_sqm), //
|
||||
F_(uom_m3),
|
||||
F_(uom_l),
|
||||
F_(uom_blank) // connectivity
|
||||
|
||||
};
|
||||
|
||||
@@ -416,7 +416,7 @@ void EMSESP::publish_all(bool force) {
|
||||
publish_device_values(EMSdevice::DeviceType::THERMOSTAT);
|
||||
publish_device_values(EMSdevice::DeviceType::SOLAR);
|
||||
publish_device_values(EMSdevice::DeviceType::MIXER);
|
||||
publish_other_values(); // switch and heat pump
|
||||
publish_other_values(); // switch and heat pump, ...
|
||||
publish_sensor_values(true); // includes dallas and analog sensors
|
||||
system_.send_heartbeat();
|
||||
}
|
||||
@@ -546,6 +546,12 @@ void EMSESP::publish_device_values(uint8_t device_type) {
|
||||
void EMSESP::publish_other_values() {
|
||||
publish_device_values(EMSdevice::DeviceType::SWITCH);
|
||||
publish_device_values(EMSdevice::DeviceType::HEATPUMP);
|
||||
// other devices without values yet
|
||||
// publish_device_values(EMSdevice::DeviceType::GATEWAY);
|
||||
// publish_device_values(EMSdevice::DeviceType::CONNECT);
|
||||
// publish_device_values(EMSdevice::DeviceType::ALERT);
|
||||
// publish_device_values(EMSdevice::DeviceType::PUMP);
|
||||
// publish_device_values(EMSdevice::DeviceType::GENERIC);
|
||||
}
|
||||
|
||||
// publish both the dallas and analog sensor values
|
||||
|
||||
@@ -102,6 +102,8 @@ MAKE_PSTR_WORD(heatpump)
|
||||
MAKE_PSTR_WORD(generic)
|
||||
MAKE_PSTR_WORD(analogsensor)
|
||||
MAKE_PSTR_WORD(dallassensor)
|
||||
MAKE_PSTR_WORD(alert)
|
||||
MAKE_PSTR_WORD(pump)
|
||||
|
||||
MAKE_PSTR(number, "number")
|
||||
MAKE_PSTR(enum, "enum")
|
||||
@@ -195,17 +197,14 @@ MAKE_PSTR_LIST(tpl_input, "Format: <inv>[<evu1><evu2><evu3><comp><aux><cool><hea
|
||||
MAKE_PSTR_LIST(tpl_input4, "Format: <inv>[<comp><aux><cool><heat><dhw><pv>]")
|
||||
|
||||
// Unit Of Measurement mapping - maps to DeviceValueUOM_s in emsdevice.cpp
|
||||
// These don't need translating, it will mess up HA and the API
|
||||
// Translating hours/minute/seconds in emsdevice.cpp
|
||||
MAKE_PSTR(uom_blank, " ")
|
||||
MAKE_PSTR(uom_percent, "%")
|
||||
MAKE_PSTR(uom_degrees, "°C")
|
||||
MAKE_PSTR(uom_hours, "hours")
|
||||
MAKE_PSTR(uom_minutes, "minutes")
|
||||
MAKE_PSTR(uom_seconds, "seconds")
|
||||
MAKE_PSTR(uom_kwh, "kWh")
|
||||
MAKE_PSTR(uom_wh, "Wh")
|
||||
MAKE_PSTR(uom_bar, "bar")
|
||||
MAKE_PSTR(uom_ua, "uA")
|
||||
MAKE_PSTR(uom_ua, "µA")
|
||||
MAKE_PSTR(uom_lmin, "l/min")
|
||||
MAKE_PSTR(uom_kw, "kW")
|
||||
MAKE_PSTR(uom_w, "W")
|
||||
@@ -213,8 +212,8 @@ MAKE_PSTR(uom_kb, "KB")
|
||||
MAKE_PSTR(uom_dbm, "dBm")
|
||||
MAKE_PSTR(uom_fahrenheit, "°F")
|
||||
MAKE_PSTR(uom_mv, "mV")
|
||||
MAKE_PSTR(uom_sqm, "sqm")
|
||||
MAKE_PSTR(uom_m3, "m3")
|
||||
MAKE_PSTR(uom_sqm, "m²")
|
||||
MAKE_PSTR(uom_m3, "m³")
|
||||
MAKE_PSTR(uom_l, "l")
|
||||
|
||||
// MQTT topics and prefixes
|
||||
|
||||
Reference in New Issue
Block a user