diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 1119dc9f..984254bd 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -105,7 +105,7 @@ #define NTP_UPDATE_INTERVAL 1800 // ----------------------------------------------------------------------------- -// FAUXO +// FAUXMO // ----------------------------------------------------------------------------- // This setting defines whether Alexa support should be built into the firmware diff --git a/code/espurna/espurna.ino b/code/espurna/espurna.ino index bca34abf..3fca7dd0 100644 --- a/code/espurna/espurna.ino +++ b/code/espurna/espurna.ino @@ -1,6 +1,7 @@ /* ESPurna + Copyright (C) 2016-2017 by Xose Pérez This program is free software: you can redistribute it and/or modify diff --git a/code/espurna/mqtt.ino b/code/espurna/mqtt.ino index 138b2a7f..b0302d55 100644 --- a/code/espurna/mqtt.ino +++ b/code/espurna/mqtt.ino @@ -42,7 +42,7 @@ unsigned int mqttTopicRootLength() { void mqttSendRaw(const char * topic, const char * message) { if (mqtt.connected()) { - DEBUG_MSG("[MQTT] Sending %s %s\n", topic, message); + DEBUG_MSG("[MQTT] Sending %s => %s\n", topic, message); mqtt.publish(topic, MQTT_QOS, MQTT_RETAIN, message); } } @@ -141,6 +141,7 @@ void mqttConnect() { DEBUG_MSG("[MQTT] Connecting to broker at %s", host); mqtt.setServer(host, port); mqtt.setKeepAlive(MQTT_KEEPALIVE).setCleanSession(false); + mqtt.setWill(MQTT_HEARTBEAT_TOPIC, MQTT_QOS, MQTT_RETAIN, "0"); if ((strlen(user) > 0) && (strlen(pass) > 0)) { DEBUG_MSG(" as user '%s'.", user); mqtt.setCredentials(user, pass); diff --git a/code/espurna/pow.ino b/code/espurna/pow.ino index c71c282c..327ad08f 100644 --- a/code/espurna/pow.ino +++ b/code/espurna/pow.ino @@ -191,6 +191,7 @@ void powLoop() { apparent = current * voltage; reactive = (apparent > power) ? sqrt(apparent * apparent - power * power) : 0; factor = (apparent > 0) ? 100 * power / apparent : 100; + if (factor > 100) factor = 100; mqttSend(getSetting("powPowerTopic", POW_POWER_TOPIC).c_str(), String(power).c_str()); mqttSend(getSetting("powCurrentTopic", POW_CURRENT_TOPIC).c_str(), String(current).c_str()); diff --git a/code/gulpfile.js b/code/gulpfile.js index 1bf02633..35279c9f 100644 --- a/code/gulpfile.js +++ b/code/gulpfile.js @@ -2,7 +2,7 @@ ESP8266 file system builder -Copyright (C) 2016 by Xose PĆ©rez +Copyright (C) 2016 by Xose Pérez This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/code/html/index.html b/code/html/index.html index e7a7a5bc..7c0736d4 100644 --- a/code/html/index.html +++ b/code/html/index.html @@ -222,7 +222,7 @@
-
+