mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
ignore n/a values iin mqtt too
This commit is contained in:
@@ -178,7 +178,7 @@ char * _bool_to_char(char * s, uint8_t value) {
|
|||||||
// negative values are assumed stored as 1-compliment (https://medium.com/@LeeJulija/how-integers-are-stored-in-memory-using-twos-complement-5ba04d61a56c)
|
// negative values are assumed stored as 1-compliment (https://medium.com/@LeeJulija/how-integers-are-stored-in-memory-using-twos-complement-5ba04d61a56c)
|
||||||
char * _short_to_char(char * s, int16_t value, uint8_t decimals = 1) {
|
char * _short_to_char(char * s, int16_t value, uint8_t decimals = 1) {
|
||||||
// remove errors or invalid values
|
// remove errors or invalid values
|
||||||
if ((value == EMS_VALUE_SHORT_NOTSET) || (value == 0x8000)) {
|
if (value == EMS_VALUE_SHORT_NOTSET) {
|
||||||
strlcpy(s, "?", 10);
|
strlcpy(s, "?", 10);
|
||||||
return (s);
|
return (s);
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ char * _short_to_char(char * s, int16_t value, uint8_t decimals = 1) {
|
|||||||
// decimals: 0 = no division, 1=divide value by 10, 2=divide by 2, 10=divide value by 100
|
// decimals: 0 = no division, 1=divide value by 10, 2=divide by 2, 10=divide value by 100
|
||||||
char * _ushort_to_char(char * s, uint16_t value, uint8_t decimals = 1) {
|
char * _ushort_to_char(char * s, uint16_t value, uint8_t decimals = 1) {
|
||||||
// remove errors or invalid values
|
// remove errors or invalid values
|
||||||
if ((value == EMS_VALUE_USHORT_NOTSET) || (value == 0x8000)) {
|
if (value == EMS_VALUE_USHORT_NOTSET) {
|
||||||
strlcpy(s, "?", 10);
|
strlcpy(s, "?", 10);
|
||||||
return (s);
|
return (s);
|
||||||
}
|
}
|
||||||
@@ -643,6 +643,8 @@ void publishSensorValues() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// send values via MQTT
|
// send values via MQTT
|
||||||
// a json object is created for the boiler and one for the thermostat
|
// a json object is created for the boiler and one for the thermostat
|
||||||
// CRC check is done to see if there are changes in the values since the last send to avoid too much wifi traffic
|
// CRC check is done to see if there are changes in the values since the last send to avoid too much wifi traffic
|
||||||
|
|||||||
@@ -33,12 +33,12 @@
|
|||||||
// max length of a telegram, including CRC, for Rx and Tx.
|
// max length of a telegram, including CRC, for Rx and Tx.
|
||||||
#define EMS_MAX_TELEGRAM_LENGTH 32
|
#define EMS_MAX_TELEGRAM_LENGTH 32
|
||||||
|
|
||||||
// default values
|
// default values for null values
|
||||||
#define EMS_VALUE_INT_ON 1 // boolean true
|
#define EMS_VALUE_INT_ON 1 // boolean true
|
||||||
#define EMS_VALUE_INT_OFF 0 // boolean false
|
#define EMS_VALUE_INT_OFF 0 // boolean false
|
||||||
#define EMS_VALUE_INT_NOTSET 0xFF // for 8-bit unsigned ints/bytes
|
#define EMS_VALUE_INT_NOTSET 0xFF // for 8-bit unsigned ints/bytes
|
||||||
#define EMS_VALUE_SHORT_NOTSET -32768 // for 2-byte signed shorts
|
#define EMS_VALUE_SHORT_NOTSET -32768 // for 2-byte signed shorts
|
||||||
#define EMS_VALUE_USHORT_NOTSET 0xFFFF // for 2-byte unsigned shorts
|
#define EMS_VALUE_USHORT_NOTSET 0x8000 // for 2-byte unsigned shorts
|
||||||
#define EMS_VALUE_LONG_NOTSET 0xFFFFFF // for 3-byte longs
|
#define EMS_VALUE_LONG_NOTSET 0xFFFFFF // for 3-byte longs
|
||||||
|
|
||||||
#define EMS_THERMOSTAT_WRITE_YES true
|
#define EMS_THERMOSTAT_WRITE_YES true
|
||||||
|
|||||||
Reference in New Issue
Block a user