diff --git a/code/html/index.html b/code/html/index.html
index f2a3a68c..08d50a11 100644
--- a/code/html/index.html
+++ b/code/html/index.html
@@ -113,18 +113,18 @@
@@ -287,9 +287,9 @@
-
AC RMS Voltage
+
AC RMS Voltage
This is your house nominal voltage, you probably know this or you wont be playing with this device...
-
+
125
220
230
@@ -298,9 +298,9 @@
-
Current Ratio
+
Current Ratio
This is the value in amps for a 1V output for your sensor. Some current sensors like the YHDC SCT-013-030 have it written in the enclosure: 30A 1V. If you are using a current sensor that outputs a current (no built in burden resistor) it will depend on the turns ratio between the primary and secondary coils in the sensor and the burden resistor you use. Check about this constant in the
post about calibration in the Open Energy Monitor site.
-
+
diff --git a/code/src/dht.ino b/code/src/dht.ino
index 1b8eb9d1..732012d2 100644
--- a/code/src/dht.ino
+++ b/code/src/dht.ino
@@ -59,12 +59,12 @@ void dhtLoop() {
DEBUG_MSG("[DHT] Humidity: %s\n", humidity);
// Send MQTT messages
- mqttSend((char *) getSetting("dhtTemperatureTopic", DHT_TEMPERATURE_TOPIC).c_str(), temperature);
- mqttSend((char *) getSetting("dhtHumidityTopic", DHT_HUMIDITY_TOPIC).c_str(), humidity);
+ mqttSend((char *) getSetting("dhtTmpTopic", DHT_TEMPERATURE_TOPIC).c_str(), temperature);
+ mqttSend((char *) getSetting("dhtHumTopic", DHT_HUMIDITY_TOPIC).c_str(), humidity);
// Update websocket clients
char buffer[20];
- sprintf_P(buffer, PSTR("{\"temperature\": %s, \"humidity\": %s}"), temperature, humidity);
+ sprintf_P(buffer, PSTR("{\"dhtTmp\": %s, \"dhtHum\": %s}"), temperature, humidity);
webSocketSend(buffer);
}
diff --git a/code/src/emon.ino b/code/src/emon.ino
index f5ab31ac..914851b7 100644
--- a/code/src/emon.ino
+++ b/code/src/emon.ino
@@ -36,11 +36,20 @@ unsigned int currentCallback() {
}
void powerMonitorSetup() {
+
+ // backwards compatibility
+ setSetting("emonMains", getSetting("pwMainsVoltage", EMON_MAINS_VOLTAGE));
+ setSetting("emonRatio", getSetting("pwCurrentRatio", EMON_CURRENT_RATIO));
+ setSetting("emonPowerTopic", getSetting("emonPowerTopic", EMON_POWER_TOPIC));
+ delSetting("pwMainsVoltage");
+ delSetting("pwCurrentRatio");
+ delSetting("emonPowerTopic");
+
emon.initCurrent(
currentCallback,
EMON_ADC_BITS,
EMON_REFERENCE_VOLTAGE,
- getSetting("pwCurrentRatio", String(EMON_CURRENT_RATIO)).toFloat()
+ getSetting("emonRatio", String(EMON_CURRENT_RATIO)).toFloat()
);
emon.setPrecision(EMON_CURRENT_PRECISION);
}
@@ -81,13 +90,13 @@ void powerMonitorLoop() {
sum += current;
++measurements;
- float mainsVoltage = getSetting("pwMainsVoltage", String(EMON_MAINS_VOLTAGE)).toFloat();
+ float mainsVoltage = getSetting("emonMains", String(EMON_MAINS_VOLTAGE)).toFloat();
//DEBUG_MSG("[ENERGY] Power now: %dW\n", int(current * mainsVoltage));
// Update websocket clients
char text[20];
- sprintf_P(text, PSTR("{\"power\": %d}"), int(current * mainsVoltage));
+ sprintf_P(text, PSTR("{\"emonPower\": %d}"), int(current * mainsVoltage));
webSocketSend(text);
// Send MQTT messages averaged every EMON_MEASUREMENTS
diff --git a/code/src/webserver.ino b/code/src/webserver.ino
index b1e49b60..7b5b93c3 100644
--- a/code/src/webserver.ino
+++ b/code/src/webserver.ino
@@ -117,7 +117,7 @@ void handleSave() {
#endif
#if ENABLE_EMON
- setCurrentRatio(getSetting("pwCurrentRatio").toFloat());
+ setCurrentRatio(getSetting("emonRatio").toFloat());
#endif
// Reconfigure networks
diff --git a/code/src/websockets.ino b/code/src/websockets.ino
index 0654bd49..7a120f8d 100644
--- a/code/src/websockets.ino
+++ b/code/src/websockets.ino
@@ -56,8 +56,8 @@ void webSocketStart(uint8_t num) {
root["relayMode"] = getSetting("relayMode", String(RELAY_MODE));
#if ENABLE_DHT
- root["temperature"] = getTemperature();
- root["humidity"] = getHumidity();
+ root["dhtTmp"] = getTemperature();
+ root["dhtHum"] = getHumidity();
#endif
#if ENABLE_RF
@@ -66,9 +66,9 @@ void webSocketStart(uint8_t num) {
#endif
#if ENABLE_EMON
- root["power"] = getPower();
- root["pwMainsVoltage"] = getSetting("pwMainsVoltage", String(EMON_MAINS_VOLTAGE));
- root["pwCurrentRatio"] = getSetting("pwCurrentRatio", String(EMON_CURRENT_RATIO));
+ root["emonPower"] = getPower();
+ root["emonMains"] = getSetting("emonMains", String(EMON_MAINS_VOLTAGE));
+ root["emonRatio"] = getSetting("emonRatio", String(EMON_CURRENT_RATIO));
#endif
JsonArray& wifi = root.createNestedArray("wifi");