Browse Source

Report energy in kWh in the web interface and in Joule via MQTT.

Enable energy reporting for all supported chips in the web interface.
fastled
Hermann Kraus 7 years ago
parent
commit
ae17a82f6f
5 changed files with 2964 additions and 2962 deletions
  1. +3
    -1
      code/espurna/config/general.h
  2. BIN
      code/espurna/data/index.html.gz
  3. +1
    -1
      code/espurna/power.ino
  4. +2957
    -2957
      code/espurna/static/index.html.gz.h
  5. +3
    -3
      code/html/index.html

+ 3
- 1
code/espurna/config/general.h View File

@ -538,7 +538,9 @@ PROGMEM const char* const custom_reset_string[] = {
#define POWER_VOLTAGE_DECIMALS 0 // Decimals for voltage values #define POWER_VOLTAGE_DECIMALS 0 // Decimals for voltage values
#define POWER_POWER_DECIMALS 0 // Decimals for power values #define POWER_POWER_DECIMALS 0 // Decimals for power values
#define POWER_ENERGY_DECIMALS 3 // Decimals for energy values #define POWER_ENERGY_DECIMALS 3 // Decimals for energy values
#define POWER_ENERGY_FACTOR (1. / 3600.0) // Ws => Wh
#define POWER_ENERGY_DECIMALS_WEB 5 // Decimals for energy values
#define POWER_ENERGY_FACTOR 1 // Watt seconds / Joule
#define POWER_ENERGY_FACTOR_WEB (1. / 3600. / 1000.) // kWh
#if POWER_PROVIDER == POWER_PROVIDER_EMON_ANALOG #if POWER_PROVIDER == POWER_PROVIDER_EMON_ANALOG
#define EMON_CURRENT_RATIO 30 // Current ratio in the clamp (30V/1A) #define EMON_CURRENT_RATIO 30 // Current ratio in the clamp (30V/1A)


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


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

@ -140,7 +140,7 @@ void _powerRead() {
root["pwrCurrent"] = roundTo(current, POWER_CURRENT_DECIMALS); root["pwrCurrent"] = roundTo(current, POWER_CURRENT_DECIMALS);
root["pwrVoltage"] = roundTo(voltage, POWER_VOLTAGE_DECIMALS); root["pwrVoltage"] = roundTo(voltage, POWER_VOLTAGE_DECIMALS);
root["pwrApparent"] = roundTo(apparent, POWER_POWER_DECIMALS); root["pwrApparent"] = roundTo(apparent, POWER_POWER_DECIMALS);
root["pwrEnergy"] = roundTo(_power_energy * POWER_ENERGY_FACTOR, POWER_ENERGY_DECIMALS);
root["pwrEnergy"] = roundTo(_power_energy * POWER_ENERGY_FACTOR_WEB, POWER_ENERGY_DECIMALS_WEB);
#if POWER_HAS_ACTIVE #if POWER_HAS_ACTIVE
root["pwrActive"] = roundTo(active, POWER_POWER_DECIMALS); root["pwrActive"] = roundTo(active, POWER_POWER_DECIMALS);
root["pwrReactive"] = roundTo(reactive, POWER_POWER_DECIMALS); root["pwrReactive"] = roundTo(reactive, POWER_POWER_DECIMALS);


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


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

@ -220,9 +220,9 @@
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="pwrFactor" post="%" readonly /> <input class="pure-u-1 pure-u-sm-3-4" type="text" name="pwrFactor" post="%" readonly />
</div> </div>
<div class="pure-g module module-hlw">
<label class="pure-u-1 pure-u-sm-1-4" for="pwrFactor">Energy</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="pwrEnergy" post=" Wh" readonly />
<div class="pure-g module module-emon module-hlw module-v9261f module-ech1560">
<label class="pure-u-1 pure-u-sm-1-4" for="pwrEnergy">Energy</label>
<input class="pure-u-1 pure-u-sm-3-4" type="text" name="pwrEnergy" post=" kWh" readonly />
</div> </div>
<div class="pure-u-1 state"> <div class="pure-u-1 state">


Loading…
Cancel
Save