This commit is contained in:
Dmitry Borisenko
2022-09-27 00:57:28 +02:00
parent e688c95c59
commit d426746733
2 changed files with 8 additions and 4 deletions

View File

@@ -14,12 +14,16 @@ class Pzem004v : public IoTItem {
public:
Pzem004v(String parameters) : IoTItem(parameters) {
addr = jsonReadStr(parameters, "addr");
pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
if (myUART) {
pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
}
}
void doByInterval() {
value.valD = pzem->values()->voltage;
regEvent(value.valD, "Pzem Voltage");
if (pzem) {
value.valD = pzem->values()->voltage;
regEvent(value.valD, "Pzem Voltage");
}
}
~Pzem004v(){};

View File

@@ -27,7 +27,7 @@
"name": "PZEM 004t Мощность",
"type": "Reading",
"subtype": "Pzem004w",
"id": "A",
"id": "W",
"widget": "anydataWt",
"page": "Сенсоры",
"descr": "Мощность",