-
Notifications
You must be signed in to change notification settings - Fork 3
/
EMT7110.h
40 lines (30 loc) · 866 Bytes
/
EMT7110.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef _EMT7110_h
#define _EMT7110_h
#include "Arduino.h"
#include "SensorBase.h"
class EMT7110 : public SensorBase {
public:
struct Frame {
byte Header1;
byte Header2;
word ID;
bool ConsumersConnected;
bool PairingFlag;
float Voltage;
float Current;
float Power;
float AccumulatedPower;
bool Byte9_6;
bool Byte9_7;
byte CRC;
bool IsValid;
};
static bool CrcIsValid(byte *data);
static const byte FRAME_LENGTH = 12;
static void DecodeFrame(byte *data, struct EMT7110::Frame *frame);
static void AnalyzeFrame(byte *data, bool fOnlyIfValid = false);
static bool DisplayFrame(byte *data, struct EMT7110::Frame &frame, bool fOnlyIfValid = true);
static bool TryHandleData(byte *data, bool fFhemDisplay = true);
static String GetFhemDataString(struct EMT7110::Frame *frame);
};
#endif