Browse Source

Using correct units for Apparent Power and Reactive Power

Change resolution of current to 1ma (3 decimal places)
fastled
Lauris 7 years ago
parent
commit
39c09a3615
5 changed files with 67 additions and 67 deletions
  1. BIN
      code/espurna/data/index.html.gz
  2. +3
    -3
      code/espurna/pow.ino
  3. +61
    -61
      code/espurna/static/index.html.gz.h
  4. +1
    -1
      code/espurna/web.ino
  5. +2
    -2
      code/html/index.html

BIN
code/espurna/data/index.html.gz View File


+ 3
- 3
code/espurna/pow.ino View File

@ -157,7 +157,7 @@ void powSetup() {
snprintf(buffer, len, "%d", getActivePower());
});
apiRegister(POW_CURRENT_TOPIC, POW_CURRENT_TOPIC, [](char * buffer, size_t len) {
dtostrf(getCurrent(), len-1, 2, buffer);
dtostrf(getCurrent(), len-1, 3, buffer);
});
apiRegister(POW_VOLTAGE_TOPIC, POW_VOLTAGE_TOPIC, [](char * buffer, size_t len) {
snprintf(buffer, len, "%d", getVoltage());
@ -235,7 +235,7 @@ void powLoop() {
root["powVisible"] = 1;
root["powActivePower"] = power;
root["powCurrent"] = current;
root["powCurrent"] = String(current, 3);
root["powVoltage"] = voltage;
root["powApparentPower"] = apparent;
root["powReactivePower"] = reactive;
@ -265,7 +265,7 @@ void powLoop() {
// Report values to MQTT broker
mqttSend(getSetting("powPowerTopic", POW_POWER_TOPIC).c_str(), String(power).c_str());
mqttSend(getSetting("powEnergyTopic", POW_ENERGY_TOPIC).c_str(), e);
mqttSend(getSetting("powCurrentTopic", POW_CURRENT_TOPIC).c_str(), String(current).c_str());
mqttSend(getSetting("powCurrentTopic", POW_CURRENT_TOPIC).c_str(), String(current, 3).c_str());
mqttSend(getSetting("powVoltageTopic", POW_VOLTAGE_TOPIC).c_str(), String(voltage).c_str());
mqttSend(getSetting("powAPowerTopic", POW_APOWER_TOPIC).c_str(), String(apparent).c_str());
mqttSend(getSetting("powRPowerTopic", POW_RPOWER_TOPIC).c_str(), String(reactive).c_str());


+ 61
- 61
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 1
- 1
code/espurna/web.ino View File

@ -533,7 +533,7 @@ void _wsStart(uint32_t client_id) {
root["powApparentPower"] = getApparentPower();
root["powReactivePower"] = getReactivePower();
root["powVoltage"] = getVoltage();
root["powCurrent"] = getCurrent();
root["powCurrent"] = String(getCurrent(), 3);
root["powPowerFactor"] = getPowerFactor();
#endif


+ 2
- 2
code/html/index.html View File

@ -181,12 +181,12 @@
</div>
<div class="pure-g module module-pow module-emon">
<label class="pure-u-1 pure-u-sm-1-4" for="powApparentPower">Apparent Power (W)</label>
<label class="pure-u-1 pure-u-sm-1-4" for="powApparentPower">Apparent Power (VA)</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="powApparentPower" readonly />
</div>
<div class="pure-g module module-pow">
<label class="pure-u-1 pure-u-sm-1-4" for="powReactivePower">Reactive Power (W)</label>
<label class="pure-u-1 pure-u-sm-1-4" for="powReactivePower">Reactive Power (VAR)</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="powReactivePower" readonly />
</div>


Loading…
Cancel
Save