Browse Source

fixup rfbridge ws-data

sensors
Max Prokhorov 5 years ago
parent
commit
17e5156ebf
2 changed files with 6 additions and 5 deletions
  1. +4
    -3
      code/espurna/rfbridge.ino
  2. +2
    -2
      code/html/custom.js

+ 4
- 3
code/espurna/rfbridge.ino View File

@ -92,10 +92,11 @@ void _rfbWebSocketSendCodes() {
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["size"] = relayCount();
JsonObject& rfb = root.createObject("rfb");
rfb["size"] = relayCount();
JsonArray& on = root.createNestedArray("on");
JsonArray& off = root.createNestedArray("off");
JsonArray& on = rfb.createNestedArray("on");
JsonArray& off = rfb.createNestedArray("off");
for (byte id=0; id<relayCount(); id++) {
on.add(rfbRetrieve(id, true));


+ 2
- 2
code/html/custom.js View File

@ -1218,8 +1218,8 @@ function processData(data) {
var rfb = data.rfb;
var size = data.size;
var on = rfb[0];
var off = rfb[1];
var on = rfb["on"];
var off = rfb["off"];
for (var i=0; i<size; ++i) {
$("input[name='rfbcode'][data-id='" + i + "'][data-status='1']").val(on[i]);


Loading…
Cancel
Save