HASS gateway Discovery improvements (#792)

* MQTT discovery improvements

-remove gatewayBT
-remove device class formaldehyde (not existing in HASS)
-add SYStoMQTT new parameters
-attach connectivity parameter to the device
-add BT gateway infos and switches
-refactor modules storage and publication
This commit is contained in:
Florian authored and GitHub committed 2020-11-04 11:53:55 -06:00
1 parent cabc8695eb
commit 9a66c9ef09
7 files changed
+136 -104

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

+7 -2
View File
@@ -1,10 +1,15 @@
# Integrate Home Assistant # Integrate Home Assistant
## Auto discovery ## Auto discovery
So as to enable HASS auto discovery with MQTT you have to uncomment [ZmqttDiscovery](https://github.com/1technophile/OpenMQTTGateway/blob/0180a0dbd55ed8e0799e30ee84f68070a6f478fa/User_config.h#L99) in User_config.h So as to enable HASS auto discovery with MQTT you have to uncomment [ZmqttDiscovery](https://github.com/1technophile/OpenMQTTGateway/blob/0180a0dbd55ed8e0799e30ee84f68070a6f478fa/User_config.h#L99) in User_config.h. Note that Home Assistant discovery is enabled by default on all binaries and platformio configurations except for UNO.
And enable discovery on your MQTT integration definition in HASS.
Once done, enable discovery on your MQTT integration definition in HASS.
OMG will use the auto discovery functionality of home assistant to create sensors and gateways into your HASS instance automaticaly. OMG will use the auto discovery functionality of home assistant to create sensors and gateways into your HASS instance automaticaly.
The gateway device will be available into Configuration->Devices section of Home Assistant.
![](../img/OpenMQTTGateway_Home_Assistant_MQTT_discovery.png)
## Manual integration examples ## Manual integration examples
From @123, @finity, @denniz03, @jrockstad From @123, @finity, @denniz03, @jrockstad
+8
View File
@@ -85,6 +85,10 @@ you can also force a scan to be done by the following command:
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"interval":0}'` `mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"interval":0}'`
::: tip
With Home Assistant, this command is directly avalaible through MQTT auto discovery as a switch into the HASS OpenMQTTGateway device entities list.
:::
Once the forced scan has completed, the previous scan interval value will be restored. Forcing a scan command trigger also a BLE connect process after the scan (see below). Once the forced scan has completed, the previous scan interval value will be restored. Forcing a scan command trigger also a BLE connect process after the scan (see below).
The default value `TimeBtwRead` is set into config_BT.h or into your .ini file for platformio users. The default value `TimeBtwRead` is set into config_BT.h or into your .ini file for platformio users.
@@ -107,6 +111,10 @@ If you want to change this characteristic:
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"onlysensors":true}'` `mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"onlysensors":true}'`
::: tip
With Home Assistant, this command is directly avalaible through MQTT auto discovery as a switch into the HASS OpenMQTTGateway device entities list.
:::
The gateway will publish only the detected sensors like Mi Flora, Mi jia, LYWSD03MMC... and not the other BLE devices. This is usefull if you don't use the gateway for presence detection but only to retrieve sensors data. The gateway will publish only the detected sensors like Mi Flora, Mi jia, LYWSD03MMC... and not the other BLE devices. This is usefull if you don't use the gateway for presence detection but only to retrieve sensors data.
## Setting the minimum RSSI accepted to publish device data ## Setting the minimum RSSI accepted to publish device data
+8 -1
View File
@@ -1,13 +1,20 @@
# System commands (ESP only) # System commands (ESP only)
## Restart the ESP ## Restart the ESP
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoSYS/config" -m '{"cmd":"restart"}'` `mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoSYS/config" -m '{"cmd":"restart"}'`
::: tip
With Home Assistant, this command is directly avalaible through MQTT auto discovery as a switch into the HASS OpenMQTTGateway device entities list.
:::
## Erase the ESP settings ## Erase the ESP settings
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoSYS/config" -m '{"cmd":"erase"}'` `mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoSYS/config" -m '{"cmd":"erase"}'`
::: tip
With Home Assistant, this command is directly avalaible through MQTT auto discovery as a switch into the HASS OpenMQTTGateway device entities list.
:::
# State LED usage # State LED usage
The gateway can support up to 3 LED to display its operating state: The gateway can support up to 3 LED to display its operating state:
+1 -1
View File
@@ -230,7 +230,7 @@ void FormalDiscovery(char* mac) {
{"sensor", "Formal-batt", mac, "battery", jsonBatt, "", "", "%"}, {"sensor", "Formal-batt", mac, "battery", jsonBatt, "", "", "%"},
{"sensor", "Formal-temp", mac, "temperature", jsonTempc, "", "", "°C"}, {"sensor", "Formal-temp", mac, "temperature", jsonTempc, "", "", "°C"},
{"sensor", "Formal-hum", mac, "humidity", jsonHum, "", "", "%"}, {"sensor", "Formal-hum", mac, "humidity", jsonHum, "", "", "%"},
{"sensor", "Formal-for", mac, "formaldehyde", jsonFor, "", "", "%"} {"sensor", "Formal-for", mac, "", jsonFor, "", "", "%"}
//component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement //component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement
}; };
+78 -16
View File
@@ -114,7 +114,11 @@ void createDiscovery(char* sensor_type,
if (child_device) { if (child_device) {
StaticJsonBuffer<JSON_MSG_BUFFER> jsonDeviceBuffer; StaticJsonBuffer<JSON_MSG_BUFFER> jsonDeviceBuffer;
JsonObject& device = jsonDeviceBuffer.createObject(); JsonObject& device = jsonDeviceBuffer.createObject();
char JSONmessageBuffer[JSON_MSG_BUFFER];
modules.printTo(JSONmessageBuffer, sizeof(JSONmessageBuffer));
Log.notice(F("Received json : %s" CR), JSONmessageBuffer);
device.set("name", gateway_name); device.set("name", gateway_name);
device.set("model", JSONmessageBuffer);
device.set("manufacturer", DEVICEMANUFACTURER); device.set("manufacturer", DEVICEMANUFACTURER);
device.set("sw_version", OMG_VERSION); device.set("sw_version", OMG_VERSION);
JsonArray& identifiers = device.createNestedArray("identifiers"); JsonArray& identifiers = device.createNestedArray("identifiers");
@@ -128,21 +132,63 @@ void createDiscovery(char* sensor_type,
void pubMqttDiscovery() { void pubMqttDiscovery() {
Log.trace(F("omgStatusDiscovery" CR)); Log.trace(F("omgStatusDiscovery" CR));
createDiscovery("binary_sensor", //set Type createDiscovery("binary_sensor", //set Type
will_Topic, Gateway_Name, (char*)getUniqueId("", "").c_str(), //set state_topic,name,uniqueId will_Topic, "SYS: Connectivity", (char*)getUniqueId("connectivity", "").c_str(), //set state_topic,name,uniqueId
will_Topic, "connectivity", "", //set availability_topic,device_class,value_template, will_Topic, "connectivity", "", //set availability_topic,device_class,value_template,
Gateway_AnnouncementMsg, will_Message, "", //set,payload_on,payload_off,unit_of_meas, Gateway_AnnouncementMsg, will_Message, "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay 0, //set off_delay
Gateway_AnnouncementMsg, will_Message, false, "" //set,payload_avalaible,payload_not avalaible ,is a child device, command topic Gateway_AnnouncementMsg, will_Message, true, "" //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
); );
createDiscovery("sensor", //set Type
subjectSYStoMQTT, "SYS: Uptime", (char*)getUniqueId("uptime", "").c_str(), //set state_topic,name,uniqueId
"", "", "{{ value_json.uptime }}", //set availability_topic,device_class,value_template,
"", "", "s", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
"", "", true, "" //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
);
# if defined(ESP8266) || defined(ESP32)
createDiscovery("sensor", //set Type
subjectSYStoMQTT, "SYS: Free memory", (char*)getUniqueId("freemem", "").c_str(), //set state_topic,name,uniqueId
"", "", "{{ value_json.freemem }}", //set availability_topic,device_class,value_template,
"", "", "B", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
"", "", true, "" //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
);
createDiscovery("sensor", //set Type
subjectSYStoMQTT, "SYS: IP", (char*)getUniqueId("ip", "").c_str(), //set state_topic,name,uniqueId
"", "", "{{ value_json.ip }}", //set availability_topic,device_class,value_template,
"", "", "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
"", "", true, "" //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
);
# ifndef ESP32_ETHERNET
createDiscovery("sensor", //set Type
subjectSYStoMQTT, "SYS: Rssi", (char*)getUniqueId("rssi", "").c_str(), //set state_topic,name,uniqueId
"", "", "{{ value_json.rssi }}", //set availability_topic,device_class,value_template,
"", "", "dB", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
"", "", true, "" //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
);
# endif
# endif
# ifdef ESP32
createDiscovery("sensor", //set Type
subjectSYStoMQTT, "SYS: Low Power Mode", (char*)getUniqueId("lowpowermode", "").c_str(), //set state_topic,name,uniqueId
"", "", "{{ value_json.lowpowermode }}", //set availability_topic,device_class,value_template,
"", "", "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
"", "", true, "" //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
);
# endif
createDiscovery("switch", //set Type createDiscovery("switch", //set Type
will_Topic, "restart OMG", (char*)getUniqueId("restart", "").c_str(), //set state_topic,name,uniqueId will_Topic, "SYS: Restart gateway", (char*)getUniqueId("restart", "").c_str(), //set state_topic,name,uniqueId
will_Topic, "", "", //set availability_topic,device_class,value_template, will_Topic, "", "", //set availability_topic,device_class,value_template,
"{\"cmd\":\"restart\"}", "", "", //set,payload_on,payload_off,unit_of_meas, "{\"cmd\":\"restart\"}", "", "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay 0, //set off_delay
Gateway_AnnouncementMsg, will_Message, true, subjectMQTTtoSYSset //set,payload_avalaible,payload_not avalaible ,is a child device, command topic Gateway_AnnouncementMsg, will_Message, true, subjectMQTTtoSYSset //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
); );
createDiscovery("switch", //set Type createDiscovery("switch", //set Type
will_Topic, "erase OMG", (char*)getUniqueId("erase", "").c_str(), //set state_topic,name,uniqueId will_Topic, "SYS: Erase credentials", (char*)getUniqueId("erase", "").c_str(), //set state_topic,name,uniqueId
will_Topic, "", "", //set availability_topic,device_class,value_template, will_Topic, "", "", //set availability_topic,device_class,value_template,
"{\"cmd\":\"erase\"}", "", "", //set,payload_on,payload_off,unit_of_meas, "{\"cmd\":\"erase\"}", "", "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay 0, //set off_delay
@@ -476,18 +522,34 @@ void pubMqttDiscovery() {
# endif # endif
# ifdef ZgatewayBT # ifdef ZgatewayBT
// Sensor to display BT received value createDiscovery("sensor", //set Type
Log.trace(F("gatewayBTDiscovery" CR)); subjectSYStoMQTT, "BT: Interval between scans", (char*)getUniqueId("interval", "").c_str(), //set state_topic,name,uniqueId
char* gatewayBT[8] = {"sensor", "gatewayBT", "", "", jsonId, "", "", ""}; "", "", "{{ value_json.interval }}", //set availability_topic,device_class,value_template,
//component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement "", "", "ms", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
Log.trace(F("CreateDiscoverySensor" CR)); "", "", true, "" //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
//trc(gatewayBT[1]); );
createDiscovery(gatewayBT[0], createDiscovery("sensor", //set Type
subjectBTtoMQTT, gatewayBT[1], (char*)getUniqueId(gatewayBT[1], gatewayBT[2]).c_str(), subjectSYStoMQTT, "BT: Connnect every X scan(s)", (char*)getUniqueId("scanbcnct", "").c_str(), //set state_topic,name,uniqueId
will_Topic, gatewayBT[3], gatewayBT[4], "", "", "{{ value_json.scanbcnct }}", //set availability_topic,device_class,value_template,
gatewayBT[5], gatewayBT[6], gatewayBT[7], "", "", "", //set,payload_on,payload_off,unit_of_meas,
0, "", "", true, ""); 0, //set off_delay
"", "", true, "" //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
);
createDiscovery("switch", //set Type
will_Topic, "BT: Force scan", (char*)getUniqueId("force_scan", "").c_str(), //set state_topic,name,uniqueId
will_Topic, "", "", //set availability_topic,device_class,value_template,
"{\"interval\":0}", "", "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
Gateway_AnnouncementMsg, will_Message, true, subjectMQTTtoBTset //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
);
createDiscovery("switch", //set Type
"", "BT: Publish only sensors", (char*)getUniqueId("only_sensors", "").c_str(), //set state_topic,name,uniqueId
"", "", "", //set availability_topic,device_class,value_template,
"{\"onlysensors\":true}", "{\"onlysensors\":false}", "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
Gateway_AnnouncementMsg, will_Message, true, subjectMQTTtoBTset //set,payload_avalaible,payload_not avalaible ,is a child device, command topic
);
# endif # endif
} }
+34 -84
View File
@@ -48,10 +48,14 @@ ReceivedSignal receivedSignal[struct_size] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
unsigned long timer_sys_measures = 0; unsigned long timer_sys_measures = 0;
# define ARDUINOJSON_USE_LONG_LONG 1 # define ARDUINOJSON_USE_LONG_LONG 1
#endif #endif
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <ArduinoLog.h> #include <ArduinoLog.h>
#include <PubSubClient.h> #include <PubSubClient.h>
StaticJsonBuffer<JSON_MSG_BUFFER> modulesBuffer;
JsonArray& modules = modulesBuffer.createArray();
// Modules config inclusion // Modules config inclusion
#if defined(ZgatewayRF) || defined(ZgatewayRF2) || defined(ZgatewayPilight) #if defined(ZgatewayRF) || defined(ZgatewayRF2) || defined(ZgatewayPilight)
# include "config_RF.h" # include "config_RF.h"
@@ -592,81 +596,110 @@ void setup() {
#ifdef ZsensorBME280 #ifdef ZsensorBME280
setupZsensorBME280(); setupZsensorBME280();
modules.add(ZsensorBME280);
#endif #endif
#ifdef ZsensorHTU21 #ifdef ZsensorHTU21
setupZsensorHTU21(); setupZsensorHTU21();
modules.add(ZsensorHTU21);
#endif #endif
#ifdef ZsensorAHTx0 #ifdef ZsensorAHTx0
setupZsensorAHTx0(); setupZsensorAHTx0();
modules.add(ZsensorAHTx0);
#endif #endif
#ifdef ZsensorBH1750 #ifdef ZsensorBH1750
setupZsensorBH1750(); setupZsensorBH1750();
modules.add(ZsensorBH1750);
#endif #endif
#ifdef ZsensorTSL2561 #ifdef ZsensorTSL2561
setupZsensorTSL2561(); setupZsensorTSL2561();
modules.add(ZsensorTSL2561);
#endif #endif
#ifdef Zgateway2G #ifdef Zgateway2G
setup2G(); setup2G();
modules.add(Zgateway2G);
#endif #endif
#ifdef ZgatewayIR #ifdef ZgatewayIR
setupIR(); setupIR();
modules.add(ZgatewayIR);
#endif #endif
#ifdef ZgatewayLORA #ifdef ZgatewayLORA
setupLORA(); setupLORA();
modules.add(ZgatewayLORA);
#endif #endif
#ifdef ZgatewayRF #ifdef ZgatewayRF
setupRF(); setupRF();
modules.add(ZgatewayRF);
#endif #endif
#ifdef ZgatewayRF2 #ifdef ZgatewayRF2
setupRF2(); setupRF2();
modules.add(ZgatewayRF2);
#endif #endif
#ifdef ZgatewayPilight #ifdef ZgatewayPilight
setupPilight(); setupPilight();
modules.add(ZgatewayPilight);
#endif #endif
#ifdef ZgatewayWeatherStation #ifdef ZgatewayWeatherStation
setupWeatherStation(); setupWeatherStation();
modules.add(ZgatewayWeatherStation);
#endif #endif
#ifdef ZgatewaySRFB #ifdef ZgatewaySRFB
setupSRFB(); setupSRFB();
modules.add(ZgatewaySRFB);
#endif #endif
#ifdef ZgatewayBT #ifdef ZgatewayBT
setupBT(); setupBT();
modules.add(ZgatewayBT);
#endif #endif
#ifdef ZgatewayRFM69 #ifdef ZgatewayRFM69
setupRFM69(); setupRFM69();
modules.add(ZgatewayRFM69);
#endif #endif
#ifdef ZsensorINA226 #ifdef ZsensorINA226
setupINA226(); setupINA226();
modules.add(ZsensorINA226);
#endif #endif
#ifdef ZsensorHCSR501 #ifdef ZsensorHCSR501
setupHCSR501(); setupHCSR501();
modules.add(ZsensorHCSR501);
#endif #endif
#ifdef ZsensorHCSR04 #ifdef ZsensorHCSR04
setupHCSR04(); setupHCSR04();
modules.add(ZsensorHCSR04);
#endif #endif
#ifdef ZsensorGPIOInput #ifdef ZsensorGPIOInput
setupGPIOInput(); setupGPIOInput();
modules.add(ZsensorGPIOInput);
#endif #endif
#ifdef ZsensorGPIOKeyCode #ifdef ZsensorGPIOKeyCode
setupGPIOKeyCode(); setupGPIOKeyCode();
modules.add(ZsensorGPIOKeyCode);
#endif #endif
#ifdef ZactuatorFASTLED #ifdef ZactuatorFASTLED
setupFASTLED(); setupFASTLED();
modules.add(ZactuatorFASTLED);
#endif #endif
#ifdef ZactuatorPWM #ifdef ZactuatorPWM
setupPWM(); setupPWM();
modules.add(ZactuatorPWM);
#endif #endif
#ifdef ZsensorDS1820 #ifdef ZsensorDS1820
setupZsensorDS1820(); setupZsensorDS1820();
modules.add(ZsensorDS1820);
#endif #endif
#ifdef ZsensorADC #ifdef ZsensorADC
setupADC(); setupADC();
modules.add(ZsensorADC);
#endif #endif
#ifdef ZsensorDHT #ifdef ZsensorDHT
setupDHT(); setupDHT();
modules.add(ZsensorDHT);
#endif #endif
#ifdef ZgatewayRS232 #ifdef ZgatewayRS232
setupRS232(); setupRS232();
modules.add(ZgatewayRS232);
#endif
#ifdef ZmqttDiscovery
modules.add(ZmqttDiscovery);
#endif #endif
Log.trace(F("mqtt_max_packet_size: %d" CR), mqtt_max_packet_size); Log.trace(F("mqtt_max_packet_size: %d" CR), mqtt_max_packet_size);
Log.notice(F("Setup OpenMQTTGateway end" CR)); Log.notice(F("Setup OpenMQTTGateway end" CR));
@@ -1337,94 +1370,14 @@ void stateMeasures() {
SYSdata["mac"] = (char*)mac.c_str(); SYSdata["mac"] = (char*)mac.c_str();
SYSdata["wifiprt"] = (int)wifiProtocol; SYSdata["wifiprt"] = (int)wifiProtocol;
# endif # endif
# endif
String modules = "";
# ifdef ZgatewayRF
modules = modules + ZgatewayRF;
# endif
# ifdef ZsensorBME280
modules = modules + ZsensorBME280;
# endif
# ifdef ZsensorHTU21
modules = modules + ZsensorHTU21;
# endif
# ifdef ZsensorAHTx0
modules = modules + ZsensorAHTx0;
# endif
# ifdef ZsensorHCSR04
modules = modules + ZsensorHCSR04;
# endif
# ifdef ZsensorBH1750
modules = modules + ZsensorBH1750;
# endif
# ifdef ZsensorTSL2561
modules = modules + ZsensorTSL2561;
# endif
# ifdef ZsensorDHT
modules = modules + ZsensorDHT;
# endif
# ifdef ZsensorDS1820
modules = modules + ZsensorDS1820;
# endif
# ifdef ZactuatorONOFF
modules = modules + ZactuatorONOFF;
# endif
# ifdef Zgateway2G
modules = modules + Zgateway2G;
# endif
# ifdef ZgatewayIR
modules = modules + ZgatewayIR;
# endif
# ifdef ZgatewayLORA
modules = modules + ZgatewayLORA;
# endif
# ifdef ZgatewayRF2
modules = modules + ZgatewayRF2;
# endif
# ifdef ZgatewayWeatherStation
modules = modules + ZgatewayWeatherStation;
# endif
# ifdef ZgatewayPilight
modules = modules + ZgatewayPilight;
# endif
# ifdef ZgatewaySRFB
modules = modules + ZgatewaySRFB;
# endif # endif
# ifdef ZgatewayBT # ifdef ZgatewayBT
modules = modules + ZgatewayBT;
# ifdef ESP32 # ifdef ESP32
SYSdata["lowpowermode"] = (int)low_power_mode; SYSdata["lowpowermode"] = (int)low_power_mode;
# endif # endif
SYSdata["interval"] = BLEinterval; SYSdata["interval"] = BLEinterval;
SYSdata["scanbcnct"] = BLEscanBeforeConnect; SYSdata["scanbcnct"] = BLEscanBeforeConnect;
# endif # endif
# ifdef ZgatewayRFM69
modules = modules + ZgatewayRFM69;
# endif
# ifdef ZsensorINA226
modules = modules + ZsensorINA226;
# endif
# ifdef ZsensorHCSR501
modules = modules + ZsensorHCSR501;
# endif
# ifdef ZsensorGPIOInput
modules = modules + ZsensorGPIOInput;
# endif
# ifdef ZsensorGPIOKeyCode
modules = modules + ZsensorGPIOKeyCode;
# endif
# ifdef ZsensorGPIOKeyCode
modules = modules + ZsensorGPIOKeyCode;
# endif
# ifdef ZmqttDiscovery
modules = modules + ZmqttDiscovery;
# endif
# ifdef ZactuatorFASTLED
modules = modules + ZactuatorFASTLED;
# endif
# ifdef ZactuatorPWM
modules = modules + ZactuatorPWM;
# endif
# ifdef ZboardM5STACK # ifdef ZboardM5STACK
M5.Power.begin(); M5.Power.begin();
SYSdata["m5-batt-level"] = (int8_t)M5.Power.getBatteryLevel(); SYSdata["m5-batt-level"] = (int8_t)M5.Power.getBatteryLevel();
@@ -1444,10 +1397,7 @@ void stateMeasures() {
SYSdata["m5-bat-chargecurrent"] = (float)M5.Axp.GetBatChargeCurrent(); SYSdata["m5-bat-chargecurrent"] = (float)M5.Axp.GetBatChargeCurrent();
SYSdata["m5-aps-voltage"] = (float)M5.Axp.GetAPSVoltage(); SYSdata["m5-aps-voltage"] = (float)M5.Axp.GetAPSVoltage();
# endif # endif
# ifdef ZGatewayRS232 SYSdata.set("modules", modules);
modules = modules + ZGatewayRS232;
# endif
SYSdata["modules"] = modules;
pub(subjectSYStoMQTT, SYSdata); pub(subjectSYStoMQTT, SYSdata);
} }
#endif #endif