mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
add min/max to values, boiler flags, ww-prefix, ha-prefix to mqtt
This commit is contained in:
@@ -55,61 +55,16 @@ enum DeviceValueType : uint8_t {
|
||||
};
|
||||
|
||||
// Unit Of Measurement mapping - maps to DeviceValueUOM_s in emsdevice.cpp
|
||||
// sequence is important!
|
||||
// uom - also used with HA
|
||||
MAKE_PSTR(percent, "%")
|
||||
MAKE_PSTR(degrees, "°C")
|
||||
MAKE_PSTR(kwh, "kWh")
|
||||
MAKE_PSTR(wh, "Wh")
|
||||
MAKE_PSTR(bar, "bar")
|
||||
MAKE_PSTR(minutes, "minutes")
|
||||
MAKE_PSTR(hours, "hours")
|
||||
MAKE_PSTR(ua, "uA")
|
||||
MAKE_PSTR(lmin, "l/min")
|
||||
// sequence is important!
|
||||
enum DeviceValueUOM : uint8_t { NONE = 0, DEGREES, PERCENT, LMIN, KWH, WH, HOURS, MINUTES, UA, BAR, PUMP };
|
||||
|
||||
// TAG mapping - maps to DeviceValueTAG_s in emsdevice.cpp
|
||||
// use empty string if want to suppress showing tags
|
||||
MAKE_PSTR(tag_none, "")
|
||||
MAKE_PSTR(tag_heartbeat, "")
|
||||
MAKE_PSTR(tag_boiler_data, "")
|
||||
MAKE_PSTR(tag_boiler_data_ww, "warm water")
|
||||
MAKE_PSTR(tag_thermostat_data, "")
|
||||
MAKE_PSTR(tag_hc1, "hc1")
|
||||
MAKE_PSTR(tag_hc2, "hc2")
|
||||
MAKE_PSTR(tag_hc3, "hc3")
|
||||
MAKE_PSTR(tag_hc4, "hc4")
|
||||
MAKE_PSTR(tag_wwc1, "wwc1")
|
||||
MAKE_PSTR(tag_wwc2, "wwc2")
|
||||
MAKE_PSTR(tag_wwc3, "wwc3")
|
||||
MAKE_PSTR(tag_wwc4, "wwc4")
|
||||
MAKE_PSTR(tag_hs1, "hs1")
|
||||
MAKE_PSTR(tag_hs2, "hs2")
|
||||
MAKE_PSTR(tag_hs3, "hs3")
|
||||
MAKE_PSTR(tag_hs4, "hs4")
|
||||
MAKE_PSTR(tag_hs5, "hs5")
|
||||
MAKE_PSTR(tag_hs6, "hs6")
|
||||
MAKE_PSTR(tag_hs7, "hs7")
|
||||
MAKE_PSTR(tag_hs8, "hs8")
|
||||
MAKE_PSTR(tag_hs9, "hs9")
|
||||
MAKE_PSTR(tag_hs10, "hs10")
|
||||
MAKE_PSTR(tag_hs11, "hs11")
|
||||
MAKE_PSTR(tag_hs12, "hs12")
|
||||
MAKE_PSTR(tag_hs13, "hs13")
|
||||
MAKE_PSTR(tag_hs14, "hs14")
|
||||
MAKE_PSTR(tag_hs15, "hs15")
|
||||
MAKE_PSTR(tag_hs16, "hs16")
|
||||
|
||||
// MQTT topic names
|
||||
MAKE_PSTR(tag_heartbeat_mqtt, "heartbeat")
|
||||
MAKE_PSTR(tag_boiler_data_mqtt, "")
|
||||
MAKE_PSTR(tag_boiler_data_ww_mqtt, "ww")
|
||||
|
||||
enum DeviceValueTAG : uint8_t {
|
||||
TAG_NONE = 0, // wild card
|
||||
TAG_HEARTBEAT,
|
||||
TAG_BOILER_DATA,
|
||||
TAG_BOILER_DATA_WW,
|
||||
TAG_DEVICE_DATA_WW,
|
||||
TAG_THERMOSTAT_DATA,
|
||||
TAG_HC1,
|
||||
TAG_HC2,
|
||||
@@ -274,8 +229,13 @@ class EMSdevice {
|
||||
const __FlashStringHelper * short_name,
|
||||
const __FlashStringHelper * full_name,
|
||||
uint8_t uom,
|
||||
bool has_cmd = false);
|
||||
void register_device_value(uint8_t tag, void * value_p, uint8_t type, const __FlashStringHelper * const * options, const __FlashStringHelper * const * name, uint8_t uom, cmdfunction_p f = nullptr);
|
||||
bool has_cmd,
|
||||
int32_t min,
|
||||
uint32_t max);
|
||||
void register_device_value(uint8_t tag, void * value_p, uint8_t type, const __FlashStringHelper * const * options, const __FlashStringHelper * const * name, uint8_t uom, cmdfunction_p f, int32_t min, uint32_t max);
|
||||
void register_device_value(uint8_t tag, void * value_p, uint8_t type, const __FlashStringHelper * const * options, const __FlashStringHelper * const * name, uint8_t uom, cmdfunction_p f);
|
||||
void register_device_value(uint8_t tag, void * value_p, uint8_t type, const __FlashStringHelper * const * options, const __FlashStringHelper * const * name, uint8_t uom);
|
||||
// void register_device_value(uint8_t tag, void * value_p, uint8_t type, const __FlashStringHelper * const * options, const __FlashStringHelper * const * name, uint8_t uom, int32_t min, uint32_t max);
|
||||
|
||||
void write_command(const uint16_t type_id, const uint8_t offset, uint8_t * message_data, const uint8_t message_length, const uint16_t validate_typeid);
|
||||
void write_command(const uint16_t type_id, const uint8_t offset, const uint8_t value, const uint16_t validate_typeid);
|
||||
@@ -283,7 +243,7 @@ class EMSdevice {
|
||||
void read_command(const uint16_t type_id, uint8_t offset = 0, uint8_t length = 0);
|
||||
|
||||
void register_mqtt_topic(const std::string & topic, mqtt_subfunction_p f);
|
||||
void register_cmd(const __FlashStringHelper * cmd, cmdfunction_p f, uint8_t flag = 0);
|
||||
// void register_cmd(const __FlashStringHelper * cmd, cmdfunction_p f, uint8_t flag = 0);
|
||||
|
||||
void publish_mqtt_ha_sensor();
|
||||
|
||||
@@ -342,7 +302,10 @@ class EMSdevice {
|
||||
static constexpr uint8_t EMS_DEVICE_FLAG_NONE = 0;
|
||||
|
||||
// Boiler
|
||||
static constexpr uint8_t EMS_DEVICE_FLAG_EMS = 1;
|
||||
static constexpr uint8_t EMS_DEVICE_FLAG_EMS = 1;
|
||||
static constexpr uint8_t EMS_DEVICE_FLAG_EMSPLUS = 2;
|
||||
static constexpr uint8_t EMS_DEVICE_FLAG_HT3 = 3;
|
||||
static constexpr uint8_t EMS_DEVICE_FLAG_HEATPUMP = 4;
|
||||
|
||||
// Solar Module
|
||||
static constexpr uint8_t EMS_DEVICE_FLAG_SM10 = 1;
|
||||
@@ -415,6 +378,8 @@ class EMSdevice {
|
||||
uint8_t uom; // DeviceValueUOM::*
|
||||
uint8_t ha; // DevcieValueHA::
|
||||
bool has_cmd; // true if there is a Console/MQTT command which matches the short_name
|
||||
int32_t min;
|
||||
uint32_t max;
|
||||
|
||||
DeviceValue(uint8_t device_type,
|
||||
uint8_t tag,
|
||||
@@ -426,7 +391,9 @@ class EMSdevice {
|
||||
const __FlashStringHelper * full_name,
|
||||
uint8_t uom,
|
||||
uint8_t ha,
|
||||
bool has_cmd)
|
||||
bool has_cmd,
|
||||
int32_t min,
|
||||
uint32_t max)
|
||||
: device_type(device_type)
|
||||
, tag(tag)
|
||||
, value_p(value_p)
|
||||
@@ -437,7 +404,9 @@ class EMSdevice {
|
||||
, full_name(full_name)
|
||||
, uom(uom)
|
||||
, ha(ha)
|
||||
, has_cmd(has_cmd) {
|
||||
, has_cmd(has_cmd)
|
||||
, min(min)
|
||||
, max(max) {
|
||||
}
|
||||
};
|
||||
const std::vector<DeviceValue> devicevalues() const;
|
||||
|
||||
Reference in New Issue
Block a user