Skip to content

Commit e0ed15e

Browse files
authored
Merge pull request letscontrolit#184 from scayac/patch-1
Update _P127_Teleinfo.ino
2 parents baf77ac + 9b86e5c commit e0ed15e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

_P127_Teleinfo.ino

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//#######################################################################################################
33
//#################################### Plugin 127: Teleinfo #############################################
44
//#######################################################################################################
5+
// 11/2023 : update code for working with last ESPeasy releases
56
// march 2020 : gmella rewrite macgyver67
67
// - replace its own teleinfo code using LibTeleinfo
78
// - enable use of any controllers instead of hardcoded jeedom using two values
@@ -29,6 +30,8 @@
2930
#define PLUGIN_VALUENAME2_HISTO_127 "BASE"
3031

3132
#include <SoftwareSerial.h>
33+
#include <ESPeasySerial.h>
34+
#include <ESPEasySerialPort.h>
3235
#include <LibTeleinfo.h> // find modified copy info in P127_LibTeleinfo_Library/Readme.md
3336

3437
TInfo tinfo; // Teleinfo object
@@ -46,7 +49,7 @@ boolean Plugin_127(byte function, struct EventStruct *event, String& string)
4649
{
4750
Device[++deviceCount].Number = PLUGIN_ID_127;
4851
Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
49-
Device[deviceCount].VType = SENSOR_TYPE_SINGLE;
52+
Device[deviceCount].VType = Sensor_VType::SENSOR_TYPE_SINGLE;
5053
Device[deviceCount].Ports = 0;
5154
Device[deviceCount].PullUpOption = false;
5255
Device[deviceCount].InverseLogicOption = false;
@@ -55,6 +58,7 @@ boolean Plugin_127(byte function, struct EventStruct *event, String& string)
5558
Device[deviceCount].SendDataOption = true;
5659
Device[deviceCount].TimerOption = true;
5760
Device[deviceCount].GlobalSyncOption = true;
61+
Device[deviceCount].PluginStats = true;
5862
break;
5963
}
6064

@@ -82,7 +86,7 @@ boolean Plugin_127(byte function, struct EventStruct *event, String& string)
8286
// Init Serial
8387
const int16_t serial_rx = CONFIG_PIN1;
8488
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);
8690

8791
String log = F("P127 : Init ");
8892
if (PCONFIG(0)){
@@ -113,7 +117,7 @@ boolean Plugin_127(byte function, struct EventStruct *event, String& string)
113117
{
114118
if ( ! Plugin_127_init ) break ;
115119

116-
event->sensorType = SENSOR_TYPE_DUAL;
120+
event->sensorType = Sensor_VType::SENSOR_TYPE_DUAL;
117121
success = true;
118122
int value;
119123
char cvalue[TAILLE_MAX_VALUE];

0 commit comments

Comments
 (0)