mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Merge pull request #1303 from proddy/dev
disabled entity values shown in white text in web
This commit is contained in:
@@ -26,6 +26,9 @@ const theme = responsiveFontSizes(
|
|||||||
},
|
},
|
||||||
info: {
|
info: {
|
||||||
main: '#607d8b' // blueGrey[500]
|
main: '#607d8b' // blueGrey[500]
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
disabled: '#eee' // white
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -30,16 +30,6 @@ import { updateValue } from 'utils';
|
|||||||
|
|
||||||
import { validate } from 'validators';
|
import { validate } from 'validators';
|
||||||
|
|
||||||
// const dialogStyle = {
|
|
||||||
// '& .MuiDialog-paper': {
|
|
||||||
// borderRadius: '8px',
|
|
||||||
// borderColor: '#565656',
|
|
||||||
// borderStyle: 'solid',
|
|
||||||
// borderWidth: '1px'
|
|
||||||
// },
|
|
||||||
// backdropFilter: 'blur(1px)'
|
|
||||||
// };
|
|
||||||
|
|
||||||
type DashboardDevicesDialogProps = {
|
type DashboardDevicesDialogProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
@@ -124,7 +114,7 @@ const DashboardDevicesDialog = ({
|
|||||||
return (
|
return (
|
||||||
<Dialog sx={dialogStyle} open={open} onClose={close}>
|
<Dialog sx={dialogStyle} open={open} onClose={close}>
|
||||||
<DialogTitle>
|
<DialogTitle>
|
||||||
{selectedItem.v === '' && selectedItem.c ? LL.RUN_COMMAND() : writeable ? LL.CHANGE_VALUE() : LL.VALUE(0)}
|
{selectedItem.v === '' && selectedItem.c ? LL.RUN_COMMAND() : writeable ? LL.CHANGE_VALUE() : LL.VALUE(1)}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Box color="warning.main" p={0} pl={0} pr={0} mt={0} mb={2}>
|
<Box color="warning.main" p={0} pl={0} pr={0} mt={0} mb={2}>
|
||||||
|
|||||||
82
lib_standalone/Preferences.h
Normal file
82
lib_standalone/Preferences.h
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
#ifndef _PREFERENCES_H_
|
||||||
|
#define _PREFERENCES_H_
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
|
||||||
|
typedef enum { PT_I8, PT_U8, PT_I16, PT_U16, PT_I32, PT_U32, PT_I64, PT_U64, PT_STR, PT_BLOB, PT_INVALID } PreferenceType;
|
||||||
|
|
||||||
|
class Preferences {
|
||||||
|
protected:
|
||||||
|
uint32_t _handle;
|
||||||
|
bool _started;
|
||||||
|
bool _readOnly;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Preferences(){};
|
||||||
|
~Preferences(){};
|
||||||
|
|
||||||
|
bool begin(const char * name, bool readOnly = false, const char * partition_label = NULL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool remove(const char * key) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t putChar(const char * key, int8_t value) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
size_t putUChar(const char * key, uint8_t value) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t putDouble(const char * key, double_t value) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t getUChar(const char * key, uint8_t defaultValue = 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double_t getDouble(const char * key, double_t defaultValue = NAN) {
|
||||||
|
return NAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// unused
|
||||||
|
|
||||||
|
void end();
|
||||||
|
bool clear();
|
||||||
|
size_t putShort(const char * key, int16_t value);
|
||||||
|
size_t putUShort(const char * key, uint16_t value);
|
||||||
|
size_t putInt(const char * key, int32_t value);
|
||||||
|
size_t putUInt(const char * key, uint32_t value);
|
||||||
|
size_t putLong(const char * key, int32_t value);
|
||||||
|
size_t putULong(const char * key, uint32_t value);
|
||||||
|
size_t putLong64(const char * key, int64_t value);
|
||||||
|
size_t putULong64(const char * key, uint64_t value);
|
||||||
|
size_t putFloat(const char * key, float_t value);
|
||||||
|
size_t putBool(const char * key, bool value);
|
||||||
|
size_t putString(const char * key, const char * value);
|
||||||
|
size_t putString(const char * key, String value);
|
||||||
|
size_t putBytes(const char * key, const void * value, size_t len);
|
||||||
|
bool isKey(const char * key);
|
||||||
|
PreferenceType getType(const char * key);
|
||||||
|
int8_t getChar(const char * key, int8_t defaultValue = 0);
|
||||||
|
int16_t getShort(const char * key, int16_t defaultValue = 0);
|
||||||
|
uint16_t getUShort(const char * key, uint16_t defaultValue = 0);
|
||||||
|
int32_t getInt(const char * key, int32_t defaultValue = 0);
|
||||||
|
uint32_t getUInt(const char * key, uint32_t defaultValue = 0);
|
||||||
|
int32_t getLong(const char * key, int32_t defaultValue = 0);
|
||||||
|
uint32_t getULong(const char * key, uint32_t defaultValue = 0);
|
||||||
|
int64_t getLong64(const char * key, int64_t defaultValue = 0);
|
||||||
|
uint64_t getULong64(const char * key, uint64_t defaultValue = 0);
|
||||||
|
float_t getFloat(const char * key, float_t defaultValue = NAN);
|
||||||
|
bool getBool(const char * key, bool defaultValue = false);
|
||||||
|
size_t getString(const char * key, char * value, size_t maxLen);
|
||||||
|
String getString(const char * key, String defaultValue = String());
|
||||||
|
size_t getBytesLength(const char * key);
|
||||||
|
size_t getBytes(const char * key, void * buf, size_t maxLen);
|
||||||
|
size_t freeEntries();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -854,8 +854,24 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
if (model() != EMS_DEVICE_FLAG_HEATPUMP) {
|
if (model() != EMS_DEVICE_FLAG_HEATPUMP) {
|
||||||
register_telegram_type(0x04, "UBAFactory", true, MAKE_PF_CB(process_UBAFactory));
|
register_telegram_type(0x04, "UBAFactory", true, MAKE_PF_CB(process_UBAFactory));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &nomPower_, DeviceValueType::UINT, FL_(nomPower), DeviceValueUOM::KW, MAKE_CF_CB(set_nomPower));
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &nomPower_, DeviceValueType::UINT, FL_(nomPower), DeviceValueUOM::KW, MAKE_CF_CB(set_nomPower));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &nrgHeat_, DeviceValueType::ULONG, DeviceValueNumOp::DV_NUMOP_DIV100, FL_(nrgHeat), DeviceValueUOM::KWH, MAKE_CF_CB(set_nrgHeat), 0, 10000000UL);
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||||
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW, &nrgWw_, DeviceValueType::ULONG, DeviceValueNumOp::DV_NUMOP_DIV100, FL_(nrgWw), DeviceValueUOM::KWH, MAKE_CF_CB(set_nrgWw), 0, 10000000UL);
|
&nrgHeat_,
|
||||||
|
DeviceValueType::ULONG,
|
||||||
|
DeviceValueNumOp::DV_NUMOP_DIV100,
|
||||||
|
FL_(nrgHeat),
|
||||||
|
DeviceValueUOM::KWH,
|
||||||
|
MAKE_CF_CB(set_nrgHeat),
|
||||||
|
0,
|
||||||
|
10000000UL);
|
||||||
|
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||||
|
&nrgWw_,
|
||||||
|
DeviceValueType::ULONG,
|
||||||
|
DeviceValueNumOp::DV_NUMOP_DIV100,
|
||||||
|
FL_(nrgWw),
|
||||||
|
DeviceValueUOM::KWH,
|
||||||
|
MAKE_CF_CB(set_nrgWw),
|
||||||
|
0,
|
||||||
|
10000000UL);
|
||||||
|
|
||||||
nrgHeatF_ = EMSESP::nvs_.getDouble(FL_(nrgHeat)[0], 0);
|
nrgHeatF_ = EMSESP::nvs_.getDouble(FL_(nrgHeat)[0], 0);
|
||||||
nrgWwF_ = EMSESP::nvs_.getDouble(FL_(nrgWw)[0], 0);
|
nrgWwF_ = EMSESP::nvs_.getDouble(FL_(nrgWw)[0], 0);
|
||||||
|
|||||||
@@ -481,7 +481,6 @@ class Boiler : public EMSdevice {
|
|||||||
bool set_nrgHeat(const char * value, const int8_t id);
|
bool set_nrgHeat(const char * value, const int8_t id);
|
||||||
bool set_nrgWw(const char * value, const int8_t id);
|
bool set_nrgWw(const char * value, const int8_t id);
|
||||||
bool set_nomPower(const char * value, const int8_t id);
|
bool set_nomPower(const char * value, const int8_t id);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -1671,7 +1671,7 @@ bool EMSdevice::generate_values(JsonObject & output, const uint8_t tag_filter, c
|
|||||||
if (v < dv.min) {
|
if (v < dv.min) {
|
||||||
dv.min = v;
|
dv.min = v;
|
||||||
dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED);
|
dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED);
|
||||||
} else if (v > dv.max) {
|
} else if ((uint32_t)v > dv.max) {
|
||||||
dv.max = v;
|
dv.max = v;
|
||||||
dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED);
|
dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ bool DeviceValue::get_custom_min(int16_t & val) {
|
|||||||
bool has_min = (min_pos != std::string::npos);
|
bool has_min = (min_pos != std::string::npos);
|
||||||
uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (uom == DeviceValueUOM::DEGREES) ? 2 : (uom == DeviceValueUOM::DEGREES_R) ? 1 : 0;
|
uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (uom == DeviceValueUOM::DEGREES) ? 2 : (uom == DeviceValueUOM::DEGREES_R) ? 1 : 0;
|
||||||
if (has_min) {
|
if (has_min) {
|
||||||
int v = Helpers::atoint(custom_fullname.substr(min_pos + 1).c_str());
|
uint32_t v = Helpers::atoint(custom_fullname.substr(min_pos + 1).c_str());
|
||||||
if (fahrenheit) {
|
if (fahrenheit) {
|
||||||
v = (v - (32 * (fahrenheit - 1))) / 1.8; // reset to °C
|
v = (v - (32 * (fahrenheit - 1))) / 1.8; // reset to °C
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -855,7 +855,7 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
|
|||||||
case DeviceValueType::UINT:
|
case DeviceValueType::UINT:
|
||||||
case DeviceValueType::SHORT:
|
case DeviceValueType::SHORT:
|
||||||
case DeviceValueType::USHORT:
|
case DeviceValueType::USHORT:
|
||||||
// case DeviceValueType::ULONG:
|
// case DeviceValueType::ULONG:
|
||||||
if (discovery_type() == discoveryType::HOMEASSISTANT) {
|
if (discovery_type() == discoveryType::HOMEASSISTANT) {
|
||||||
// Home Assistant
|
// Home Assistant
|
||||||
// number - https://www.home-assistant.io/integrations/number.mqtt
|
// number - https://www.home-assistant.io/integrations/number.mqtt
|
||||||
|
|||||||
Reference in New Issue
Block a user