Skip to content

Commit

Permalink
Support for RFXMeter counter
Browse files Browse the repository at this point in the history
  • Loading branch information
empierre committed Nov 4, 2016
1 parent 03127cd commit 6f4a159
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ RUN curl -sL https://deb.nodesource.com/setup_4.x | bash -
RUN apt-get install -y nodejs
#RUN apt-get install npm
RUN npm install -g npm@2.x
RUN wget http://www.e-nef.com/domoticz/mdah/node-mydomoathome-0.1.57.deb
RUN dpkg -i node-mydomoathome-0.1.57.deb
RUN wget http://www.e-nef.com/domoticz/mdah/node-mydomoathome-0.1.58.deb
RUN dpkg -i node-mydomoathome-0.1.58.deb
RUN mv /etc/mydomoathome/config.json /etc/mydomoathome/config.json.old
VOLUME /etc/mydomoathome/

Expand Down
22 changes: 22 additions & 0 deletions mdah.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,25 @@ function DevElectricity(data) {
}
params.push({"key": "ConsoTotal", "value": total.toString(), "unit": "kWh", "graphable": "true"});
}
} else if (data.CounterToday) {
var res = ptrn4.exec(data.CounterToday);
var usage = 0;
if (res != null) {
usage = res[1]
}

if (!usage) {
usage = 0;
}
params.push({"key": "Watts", "value": usage, "unit": "kWh"});
if (data.Counter) {
var res = ptrn4.exec(data.Counter);
var total = 0;
if (res != null) {
total = Math.ceil(Number(res[1]));
}
params.push({"key": "ConsoTotal", "value": total.toString(), "unit": "kWh", "graphable": "true"});
}
} else {
var res = ptrn2.exec(data.Data);
var total = 0;
Expand Down Expand Up @@ -2445,6 +2464,9 @@ app.get("/devices", auth, function (req, res) {
break;
case 'RFXMeter':
switch (data.result[i].SwitchTypeVal) {
case 0:
result.push(DevGas(data.result[i]));
break;
case 1:
result.push(DevGas(data.result[i]));
break;
Expand Down

0 comments on commit 6f4a159

Please sign in to comment.