Browse Source

Merged in ToniAr/espurna/sonoff_pow_domoticz_current (pull request #9)

Add Domoticz 'current' sensor capability to Sonoff POW
fastled
Xose Pérez 7 years ago
parent
commit
b3ebc249ab
4 changed files with 16 additions and 1 deletions
  1. +4
    -0
      code/espurna/emon.ino
  2. +2
    -0
      code/espurna/pow.ino
  3. +3
    -0
      code/espurna/web.ino
  4. +7
    -1
      code/html/index.html

+ 4
- 0
code/espurna/emon.ino View File

@ -171,6 +171,10 @@ void powerMonitorLoop() {
char buffer[20]; char buffer[20];
snprintf(buffer, 20, "%s;%s", power, e); snprintf(buffer, 20, "%s;%s", power, e);
domoticzSend("dczPowIdx", 0, buffer); domoticzSend("dczPowIdx", 0, buffer);
snprintf(buffer, 20, "%d", voltage);
domoticzSend("dczVoltIdx", 0, buffer);
snprintf(buffer, 20, "%s", String(current).c_str());
domoticzSend("dczCurrentIdx", 0, buffer);
} }
#endif #endif


+ 2
- 0
code/espurna/pow.ino View File

@ -239,6 +239,8 @@ void powLoop() {
domoticzSend("dczPowIdx", 0, buffer); domoticzSend("dczPowIdx", 0, buffer);
snprintf(buffer, 20, "%d", voltage); snprintf(buffer, 20, "%d", voltage);
domoticzSend("dczVoltIdx", 0, buffer); domoticzSend("dczVoltIdx", 0, buffer);
snprintf(buffer, 20, "%s", String(current).c_str());
domoticzSend("dczCurrentIdx", 0, buffer);
} }
#endif #endif


+ 3
- 0
code/espurna/web.ino View File

@ -350,11 +350,14 @@ void _wsStart(uint32_t client_id) {
#if ENABLE_EMON #if ENABLE_EMON
root["dczPowIdx"] = getSetting("dczPowIdx").toInt(); root["dczPowIdx"] = getSetting("dczPowIdx").toInt();
root["dczVoltIdx"] = getSetting("dczVoltIdx").toInt();
root["dczCurrentIdx"] = getSetting("dczCurrentIdx").toInt();
#endif #endif
#if ENABLE_POW #if ENABLE_POW
root["dczPowIdx"] = getSetting("dczPowIdx").toInt(); root["dczPowIdx"] = getSetting("dczPowIdx").toInt();
root["dczVoltIdx"] = getSetting("dczVoltIdx").toInt(); root["dczVoltIdx"] = getSetting("dczVoltIdx").toInt();
root["dczCurrentIdx"] = getSetting("dczCurrentIdx").toInt();
#endif #endif
#endif #endif


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

@ -409,12 +409,18 @@
<div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div> <div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div>
</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="dczVoltIdx">Voltage IDX</label> <label class="pure-u-1 pure-u-sm-1-4" for="dczVoltIdx">Voltage IDX</label>
<div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczVoltIdx" type="number" min="0" tabindex="36" data="0" /></div> <div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczVoltIdx" type="number" min="0" tabindex="36" data="0" /></div>
<div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div> <div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div>
</div> </div>
<div class="pure-g module module-pow module-emon">
<label class="pure-u-1 pure-u-sm-1-4" for="dczCurrentIdx">Current IDX</label>
<div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24" name="dczCurrentIdx" type="number" min="0" tabindex="36" data="0" /></div>
<div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div>
</div>
<div id="idxs"> <div id="idxs">
</div> </div>


Loading…
Cancel
Save