2
2
// #######################################################################################################
3
3
// #################################### Plugin 127: Teleinfo #############################################
4
4
// #######################################################################################################
5
+ // 11/2023 : update code for working with last ESPeasy releases
5
6
// march 2020 : gmella rewrite macgyver67
6
7
// - replace its own teleinfo code using LibTeleinfo
7
8
// - enable use of any controllers instead of hardcoded jeedom using two values
29
30
#define PLUGIN_VALUENAME2_HISTO_127 " BASE"
30
31
31
32
#include < SoftwareSerial.h>
33
+ #include < ESPeasySerial.h>
34
+ #include < ESPEasySerialPort.h>
32
35
#include < LibTeleinfo.h> // find modified copy info in P127_LibTeleinfo_Library/Readme.md
33
36
34
37
TInfo tinfo; // Teleinfo object
@@ -46,7 +49,7 @@ boolean Plugin_127(byte function, struct EventStruct *event, String& string)
46
49
{
47
50
Device[++deviceCount].Number = PLUGIN_ID_127;
48
51
Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
49
- Device[deviceCount].VType = SENSOR_TYPE_SINGLE;
52
+ Device[deviceCount].VType = Sensor_VType:: SENSOR_TYPE_SINGLE;
50
53
Device[deviceCount].Ports = 0 ;
51
54
Device[deviceCount].PullUpOption = false ;
52
55
Device[deviceCount].InverseLogicOption = false ;
@@ -55,6 +58,7 @@ boolean Plugin_127(byte function, struct EventStruct *event, String& string)
55
58
Device[deviceCount].SendDataOption = true ;
56
59
Device[deviceCount].TimerOption = true ;
57
60
Device[deviceCount].GlobalSyncOption = true ;
61
+ Device[deviceCount].PluginStats = true ;
58
62
break ;
59
63
}
60
64
@@ -82,7 +86,7 @@ boolean Plugin_127(byte function, struct EventStruct *event, String& string)
82
86
// Init Serial
83
87
const int16_t serial_rx = CONFIG_PIN1;
84
88
const int16_t serial_tx = CONFIG_PIN2;
85
- P127_easySerial = new ESPeasySerial (serial_rx, serial_tx);
89
+ P127_easySerial = new ESPeasySerial (ESPEasySerialPort::not_set, serial_rx, serial_tx);
86
90
87
91
String log = F (" P127 : Init " );
88
92
if (PCONFIG (0 )){
@@ -113,7 +117,7 @@ boolean Plugin_127(byte function, struct EventStruct *event, String& string)
113
117
{
114
118
if ( ! Plugin_127_init ) break ;
115
119
116
- event->sensorType = SENSOR_TYPE_DUAL;
120
+ event->sensorType = Sensor_VType:: SENSOR_TYPE_DUAL;
117
121
success = true ;
118
122
int value;
119
123
char cvalue[TAILLE_MAX_VALUE];
0 commit comments