Browse Source

Update apparent power in web interface from emon module

fastled
Xose Pérez 7 years ago
parent
commit
1f7d367492
3 changed files with 4 additions and 4 deletions
  1. +1
    -1
      code/espurna/config/sensors.h
  2. +2
    -2
      code/espurna/emon.ino
  3. +1
    -1
      code/html/index.html

+ 1
- 1
code/espurna/config/sensors.h View File

@ -59,7 +59,7 @@
#define EMON_ADC_BITS 12 #define EMON_ADC_BITS 12
#define EMON_REFERENCE_VOLTAGE 3.3 #define EMON_REFERENCE_VOLTAGE 3.3
#define EMON_CURRENT_PRECISION 2 #define EMON_CURRENT_PRECISION 2
#define EMON_CURRENT_OFFSET 0
#define EMON_CURRENT_OFFSET 0.10
#endif #endif
#define EMON_CURRENT_RATIO 30 #define EMON_CURRENT_RATIO 30


+ 2
- 2
code/espurna/emon.ino View File

@ -170,8 +170,8 @@ void powerMonitorLoop() {
DEBUG_MSG("[ENERGY] Power: %dW\n", int(_current * mainsVoltage)); DEBUG_MSG("[ENERGY] Power: %dW\n", int(_current * mainsVoltage));
// Update websocket clients // Update websocket clients
char text[20];
sprintf_P(text, PSTR("{\"emonPower\": %d}"), int(_current * mainsVoltage));
char text[64];
sprintf_P(text, PSTR("{\"emonVisible\": 1, \"powApparentPower\": %d}"), int(_current * mainsVoltage));
wsSend(text); wsSend(text);
// Send MQTT messages averaged every EMON_MEASUREMENTS // Send MQTT messages averaged every EMON_MEASUREMENTS


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

@ -140,7 +140,7 @@
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="powActivePower" readonly /> <input class="pure-u-1 pure-u-sm-3-4" type="text" name="powActivePower" readonly />
</div> </div>
<div class="pure-g module module-pow">
<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 (W)</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="powApparentPower" readonly /> <input class="pure-u-1 pure-u-sm-3-4" type="text" name="powApparentPower" readonly />
</div> </div>


Loading…
Cancel
Save