mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-31 12:29:14 +03:00
pzem - чтение напряжения
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include "classes/IoTItem.h"
|
||||
|
||||
#include "PZEMSensor.h"
|
||||
//#include "SoftUART.h"
|
||||
#include "modules/sensors/SoftUart/SoftUart.h"
|
||||
|
||||
PZEMSensor* pzem;
|
||||
|
||||
@@ -14,11 +14,21 @@ class Pzem004v : public IoTItem {
|
||||
public:
|
||||
Pzem004v(String parameters) : IoTItem(parameters) {
|
||||
addr = jsonReadStr(parameters, "addr");
|
||||
// pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
pzem = new PZEMSensor(myUART, hexStringToUint8(addr));
|
||||
}
|
||||
|
||||
void doByInterval() {
|
||||
value.valD = pzem->values()->voltage;
|
||||
regEvent(value.valD, "Pzem Voltage");
|
||||
}
|
||||
|
||||
~Pzem004v(){};
|
||||
};
|
||||
|
||||
void* getAPI_Pzem004(String subtype, String param) {
|
||||
if (subtype == F("Pzem004v")) {
|
||||
return new Pzem004v(param);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user