[DISC] Ram usage and flash size optimization (#2223)

Fix duplicate W and keep units and classes in flash
Use macro for discovery classes and units
[BREAKING] change gateway sensor unique id
module - parameter
Standardize the use of createDiscoveryFromList

Co-authored-by: Florian <1technophile@users.noreply.github.com>
This commit is contained in:
FlorianandFlorian authored and GitHub committed 2025-08-17 06:27:42 -05:00
1 parent 51bdc2d080
commit 6e6b54b05e
6 files changed
+588 -909

No files matched your search

+6 -5
View File
@@ -114,6 +114,7 @@ struct LORAConfig_s {
};
#ifdef ZmqttDiscovery
# include "config_mqttDiscovery.h"
extern void launchLORADiscovery(bool overrideDiscovery);
// This structure stores the entities of the devices and is they have been discovered or not
// The uniqueId is composed of the device id + the key
@@ -129,11 +130,11 @@ struct LORAdevice {
const char LORAparameters[5][4][12] = {
// LORA key, name, unit, device_class
{"tempc", "temperature", "°C", "temperature"},
{"hum", "humidity", "%", "humidity"},
{"moi", "moisture", "%", "humidity"},
{"batt", "battery", "%", "battery"},
{"count", "counter", "L", "water"}};
{"tempc", HASS_CLASS_TEMPERATURE, HASS_UNIT_CELSIUS, HASS_CLASS_TEMPERATURE},
{"hum", HASS_CLASS_HUMIDITY, HASS_UNIT_PERCENT, HASS_CLASS_HUMIDITY},
{"moi", "moisture", HASS_UNIT_PERCENT, HASS_CLASS_HUMIDITY},
{"batt", HASS_CLASS_BATTERY, HASS_UNIT_PERCENT, HASS_CLASS_BATTERY},
{"count", HASS_CLASS_WATER, HASS_UNIT_LITER, HASS_CLASS_WATER}};
#endif