BL0937 - implemented energy counter. TODO: save to flash.

http server - buffer size change, added MQTT status information.
MQTT - connect event counter for debug purpose.
MQTT - debug outputs.
MQTT - ERR-ISCONN result bug fix.
MQTT - Wifi connection check added.
MQTT - connect/reconnect patch
Formatting changes. Reading code was sometimes hard.
bug fix new device.
bug fix http server
This commit is contained in:
root
2022-10-01 20:38:06 +02:00
committed by root
parent 3d13d6184f
commit fcffa95dca
10 changed files with 310 additions and 131 deletions

View File

@ -15,6 +15,7 @@
#include "../devicegroups/deviceGroups_public.h"
#include "../mqtt/new_mqtt.h"
#include "hass.h"
#include "../cJSON/cJSON.h"
#ifdef WINDOWS
// nothing
@ -526,6 +527,7 @@ int http_fn_index(http_request_t *request) {
hprintf128(request,"<h5>Ping watchdog - %i lost, %i ok!</h5>",
PingWatchDog_GetTotalLost(),PingWatchDog_GetTotalReceived());
hprintf128(request,"<h5>MQTT State: %s</h5>", (Main_HasMQTTConnected()==1)?"connected":"disconnected");
// for normal page loads, show the rest of the HTML
if(!http_getArg(request->url,"state",tmpA,sizeof(tmpA))) {
@ -1232,7 +1234,9 @@ int http_fn_ha_discovery(http_request_t *request) {
sprintf(topic, "homeassistant"); //default discovery topic is `homeassistant`
}
cJSON_Hooks hooks = {os_malloc, os_free};
struct cJSON_Hooks hooks;
hooks.malloc_fn = os_malloc;
hooks.free_fn = os_free;
cJSON_InitHooks(&hooks);
if(relayCount > 0) {