Browse code

v1.2.0: Am adaugat fix-ul pentru sonoff v5.12.0

Liviu Pislaru authored on 09/03/2018 23:21:38
Showing 2 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 #!/usr/bin/perl
2 2
 # parser pentru mesajele MQTT
3
-# Version: 1.1.1
3
+# Version: 1.2.0
4 4
 
5 5
 use strict;
6 6
 use warnings;
... ...
@@ -96,6 +96,15 @@ while (my $mqttMessage = <$SUB> ) {
96 96
           addDB ($topic, "Today", $decoded->{'Today'});
97 97
         }
98 98
       }
99
+      if ($queue eq "SENSOR"){ # topic nou sonoff v5.12.0
100
+        my $decoded = decode_json($json);
101
+        if (exists $decoded->{'ENERGY'}{'Yesterday'}){
102
+          addDB ($topic, "Yesterday", $decoded->{'ENERGY'}{'Yesterday'});
103
+        }
104
+        if (exists $decoded->{'ENERGY'}{'Today'}){
105
+          addDB ($topic, "Today", $decoded->{'ENERGY'}{'Today'});
106
+        }
107
+      }      
99 108
       if ($queue eq "ESP"){
100 109
         my $decoded = decode_json($json);
101 110
         if (exists $decoded->{'Temp'}){     
... ...
@@ -15,7 +15,14 @@ stat/qbzesh-1250/ESP {<strong>"LoopInterval":"15 minute"</strong>}<br>
15 15
 stat/qbzesh-1250/ALARM {<strong>"PIR":1</strong>}<br>
16 16
 tele/64x35up-2452/INFO1 {<strong>"Module":"Sonoff Pow"</strong>,<strong>"Version":"5.10.0"</strong>,"FallbackTopic":"DVES_3B4994","GroupTopic":"sonoffs"}<br>
17 17
 tele/64x35up-2452/INFO2 {"WebServerMode":"Admin","Hostname":"64x35up-2452-2452",<strong>"IPAddress":"192.168.23.146"</strong>}<br>
18
-tele/64x35up-2452/INFO3 {<strong>"RestartReason":"Power on"</strong>}<br>
18
+tele/64x35up-2452/INFO3 {<strong>"RestartReason":"Power on"</strong>}<br><br>
19
+
20
+sonoff v5.10.0<br>
19 21
 tele/mng9184-1657/ENERGY {"Time":"2018-03-04T21:53:50","Total":1387.609,<strong>"Yesterday":23.704</strong>,<strong>"Today":27.064</strong>,"Period":103,"Power":1254,"Factor":1.00,"Voltage":236,"Current":5.262}<br>
20
-tele/1mining-7408/STATE {"Time":"2018-03-08T20:44:13",<strong>"Uptime":28</strong>,"Vcc":3.147,"POWER":"ON","Wifi":{"AP":1,"SSId":"ICS","RSSI":100,"APMac":"70:4F:57:8C:41:EC"}}<br>
22
+tele/1mining-7408/STATE
23
+{"Time":"2018-03-08T20:44:13",<strong>"Uptime":28</strong>,"Vcc":3.147,"POWER":"ON","Wifi":{"AP":1,"SSId":"ICS","RSSI":100,"APMac":"70:4F:57:8C:41:EC"}}<br><br>
24
+
25
+sonoff v5.12.0<br>
26
+tele/rqx958t-1413/STATE {"Time":"2018-03-09T22:01:59","Uptime":"0T00:25:17","Vcc":3.239,"POWER":"ON","Wifi":{"AP":1,"SSId":"duia","RSSI":56,"APMac":"80:8C:97:73:F4:11"}}<br>
27
+tele/rqx958t-1413/SENSOR {"Time":"2018-03-09T22:01:59","ENERGY":{"Total":77.496,"Yesterday":0.902,"Today":0.822,"Period":3,"Power":36,"Factor":0.79,"Voltage":243,"Current":0.189}}<br>
21 28
 </p>