mirror of https://github.com/arendst/Tasmota.git
Merge pull request #17160 from hallard/teleinfo_histo
Teleinfo new TEMPO (BBR) contract
This commit is contained in:
commit
215a6ce027
|
@ -106,14 +106,16 @@ const char kTarifName[] PROGMEM =
|
|||
"|Pleines Bleu|Pleines Blanc|Pleines Rouges"
|
||||
;
|
||||
|
||||
// contract name for standard mode
|
||||
// contract name for standard mode LGTF
|
||||
#define TELEINFO_STD_CONTRACT_BASE PSTR("BASE")
|
||||
#define TELEINFO_STD_CONTRACT_HCHP PSTR("H CREUSE/PLEINE")
|
||||
#define TELEINFO_STD_CONTRACT_HCHP PSTR("HC")
|
||||
#define TELEINFO_STD_CONTRACT_BBR PSTR("BBR")
|
||||
#define TELEINFO_STD_CONTRACT_EJP PSTR("EJP")
|
||||
|
||||
// tariff values for standard mode
|
||||
#define TELEINFO_STD_TARIFF_BASE PSTR("BASE")
|
||||
#define TELEINFO_STD_TARIFF_HC PSTR("HEURE CREUSE")
|
||||
#define TELEINFO_STD_TARIFF_HP PSTR("HEURE PLEINE")
|
||||
// current tariff values for standard mode (Tarif en cours)
|
||||
//#define TELEINFO_STD_TARIFF_BASE PSTR("BASE")
|
||||
//#define TELEINFO_STD_TARIFF_HC PSTR("CREUSE")
|
||||
//#define TELEINFO_STD_TARIFF_HP PSTR("PLEINE")
|
||||
|
||||
|
||||
// Label used to do some post processing and/or calculation
|
||||
|
@ -121,22 +123,26 @@ enum TInfoLabel{
|
|||
LABEL_BASE = 1,
|
||||
LABEL_ADCO, LABEL_ADSC,
|
||||
LABEL_HCHC, LABEL_HCHP, LABEL_EAST, LABEL_EASF01, LABEL_EASF02,
|
||||
LABEL_HCJB,LABEL_HPJB,LABEL_HCJW,LABEL_HPJW,LABEL_HCJR,LABEL_HPJR,
|
||||
LABEL_EASF03, LABEL_EASF04, LABEL_EASF05, LABEL_EASF06,
|
||||
LABEL_OPTARIF, LABEL_NGTF, LABEL_ISOUSC, LABEL_PREF, LABEL_PTEC, LABEL_LTARF, LABEL_NTARF,
|
||||
LABEL_PAPP, LABEL_SINSTS, LABEL_IINST, LABEL_IINST1, LABEL_IINST2, LABEL_IINST3, LABEL_IRMS1, LABEL_IRMS2, LABEL_IRMS3,
|
||||
LABEL_TENSION, LABEL_URMS1, LABEL_URMS2, LABEL_URMS3,
|
||||
LABEL_IMAX, LABEL_IMAX1, LABEL_IMAX2, LABEL_IMAX3, LABEL_PMAX, LABEL_SMAXSN,
|
||||
LABEL_DEMAIN,
|
||||
LABEL_DEMAIN,LABEL_MSG1,LABEL_MSG2,LABEL_STGE,
|
||||
LABEL_END
|
||||
};
|
||||
|
||||
const char kLabel[] PROGMEM =
|
||||
"|BASE|ADCO|ADSC"
|
||||
"|HCHC|HCHP|EAST|EASF01|EASF02"
|
||||
"|BBRHCJB|BBRHPJB|BBRHCJW|BBRHPJW|BBRHCJR|BBRHPJR"
|
||||
"|EASF03|EASF04|EASF05|EASF06"
|
||||
"|OPTARIF|NGTF|ISOUSC|PREF|PTEC|LTARF|NTARF"
|
||||
"|PAPP|SINSTS|IINST|IINST1|IINST2|IINST3|IRMS1|IRMS2|IRMS3"
|
||||
"|TENSION|URMS1|URMS2|URMS3"
|
||||
"|IMAX|IMAX1|IMAX2|IMAX3|PMAX|SMAXSN"
|
||||
"|DEMAIN"
|
||||
"|DEMAIN|MSG1|MSG2|STGE"
|
||||
;
|
||||
|
||||
// Blacklisted label from telemetry
|
||||
|
@ -164,12 +170,36 @@ char serialNumber[13] = ""; // Serial number is 12 char long
|
|||
bool tinfo_found = false;
|
||||
int serial_buffer_size;
|
||||
uint32_t total_wh;
|
||||
uint32_t status_register;
|
||||
int contrat;
|
||||
int tarif;
|
||||
int isousc;
|
||||
int raw_skip;
|
||||
|
||||
/*********************************************************************************************/
|
||||
#ifdef USE_WEBSERVER
|
||||
const char HTTP_ENERGY_ID_TELEINFO[] PROGMEM = "{s}ID{m}%s{e}" ;
|
||||
const char HTTP_ENERGY_INDEX_TELEINFO[] PROGMEM = "{s}%s{m}%s " D_UNIT_WATTHOUR "{e}" ;
|
||||
const char HTTP_ENERGY_INDEX_TELEINFO_SELECT[] PROGMEM = "{s}%s{m}%s " D_UNIT_WATTHOUR "%c{e}" ;
|
||||
const char HTTP_ENERGY_PAPP_TELEINFO[] PROGMEM = "{s}" D_POWERUSAGE "{m}%d " D_UNIT_WATT "{e}" ;
|
||||
//const char HTTP_ENERGY_IINST_TELEINFO[] PROGMEM = "{s}" D_CURRENT "%s{m}%d " D_UNIT_AMPERE "{e}" ;
|
||||
const char HTTP_ENERGY_TARIF_TELEINFO_STD[] PROGMEM = "{s}" D_CURRENT_TARIFF "{m}%s{e}" ;
|
||||
const char HTTP_ENERGY_TARIF_TELEINFO_HISTO[] PROGMEM = "{s}" D_CURRENT_TARIFF "{m}Heures %s{e}" ;
|
||||
const char HTTP_ENERGY_MSG_TELEINFO_STD[] PROGMEM = "{s}Message %d{m}%s{e}" ;
|
||||
const char HTTP_ENERGY_CONTRAT_TELEINFO[] PROGMEM = "{s}" D_CONTRACT "{m}%s %d" D_UNIT_AMPERE "{e}" ;
|
||||
const char HTTP_ENERGY_LOAD_TELEINFO[] PROGMEM = "{s}" D_POWER_LOAD "{m}%d" D_UNIT_PERCENT "{e}" ;
|
||||
const char HTTP_ENERGY_IMAX_TELEINFO[] PROGMEM = "{s}" D_MAX_CURRENT "{m}%d" D_UNIT_AMPERE "{e}" ;
|
||||
const char HTTP_ENERGY_IMAX3_TELEINFO[] PROGMEM = "{s}" D_MAX_CURRENT "{m}%d / %d / %d " D_UNIT_AMPERE "{e}" ;
|
||||
const char HTTP_ENERGY_PMAX_TELEINFO[] PROGMEM = "{s}" D_MAX_POWER "{m}%d" D_UNIT_WATT "{e}" ;
|
||||
const char HTTP_ENERGY_PMAX3_TELEINFO[] PROGMEM = "{s}" D_MAX_POWER "{m}%d / %d / %d " D_UNIT_WATT "{e}" ;
|
||||
const char HTTP_ENERGY_LABEL_VALUE[] PROGMEM = "{s}%s{m}%s{e}" ;
|
||||
const char HTTP_ENERGY_LOAD_BAR[] PROGMEM = "<tr><div style='margin:4px;padding:0px;background-color:#ddd;border-radius:4px;'>"
|
||||
"<div style='font-size:0.75rem;font-weight:bold;padding:0px;text-align:center;border:1px solid #bbb;border-radius:4px;color:#444;background-color:%s;width:%d%%;'>"
|
||||
"%d%%</div>"
|
||||
"</div></tr>";
|
||||
#endif // USE_WEBSERVER
|
||||
|
||||
|
||||
|
||||
/* ======================================================================
|
||||
Function: getValueFromLabelIndex
|
||||
|
@ -180,16 +210,23 @@ Comments: -
|
|||
====================================================================== */
|
||||
char * getValueFromLabelIndex(int labelIndex, char * value)
|
||||
{
|
||||
char labelName[16];
|
||||
if (!value) {
|
||||
return nullptr;
|
||||
}
|
||||
char labelName[17];
|
||||
*value = '\0';
|
||||
|
||||
// Get the label name
|
||||
GetTextIndexed(labelName, sizeof(labelName), labelIndex, kLabel);
|
||||
// Get value of label name
|
||||
tinfo.valueGet(labelName, value) ;
|
||||
|
||||
// Standard mode has values with space before/after
|
||||
if (tinfo_mode==TINFO_MODE_STANDARD) {
|
||||
Trim(value);
|
||||
}
|
||||
return value;
|
||||
|
||||
return *value ? value : nullptr;
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
|
@ -312,13 +349,6 @@ void DataCallback(struct _ValueList * me, uint8_t flags)
|
|||
// Current tariff (standard)
|
||||
else if (ilabel == LABEL_LTARF)
|
||||
{
|
||||
if (!strcmp_P(me->value, TELEINFO_STD_TARIFF_BASE)) {
|
||||
tarif = TARIF_TH;
|
||||
} else if (!strcmp_P(me->value, TELEINFO_STD_TARIFF_HC)) {
|
||||
tarif = TARIF_HC;
|
||||
} else if (!strcmp_P(me->value, TELEINFO_STD_TARIFF_HP)) {
|
||||
tarif = TARIF_HP;
|
||||
}
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("TIC: Tariff name changed, now '%s'"), me->value);
|
||||
}
|
||||
// Current tariff index (standard)
|
||||
|
@ -407,10 +437,14 @@ void DataCallback(struct _ValueList * me, uint8_t flags)
|
|||
// Contract subscribed (standard is in clear text in value)
|
||||
else if (ilabel == LABEL_NGTF)
|
||||
{
|
||||
if (!strcmp_P(me->value, TELEINFO_STD_CONTRACT_BASE)) {
|
||||
if (strstr(me->value, TELEINFO_STD_CONTRACT_BASE)) {
|
||||
contrat = CONTRAT_BAS;
|
||||
} else if (!strcmp_P(me->value, TELEINFO_STD_CONTRACT_HCHP)) {
|
||||
} else if (strstr(me->value, TELEINFO_STD_CONTRACT_HCHP)) {
|
||||
contrat = CONTRAT_HC;
|
||||
} else if (strstr(me->value, TELEINFO_STD_CONTRACT_BBR)) {
|
||||
contrat = CONTRAT_BBR;
|
||||
} else if (strstr(me->value, TELEINFO_STD_CONTRACT_EJP)) {
|
||||
contrat = CONTRAT_EJP;
|
||||
}
|
||||
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("TIC: Contract changed, now '%s'"), me->value);
|
||||
|
@ -438,6 +472,13 @@ void DataCallback(struct _ValueList * me, uint8_t flags)
|
|||
strcpy(serialNumber, me->value);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("TIC: %s set to %s"), me->name, serialNumber);
|
||||
}
|
||||
// Status
|
||||
else if (ilabel == LABEL_STGE)
|
||||
{
|
||||
status_register = strtol(me->value, nullptr, 16);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("Status Resister : %s set to %08X"), me->name, status_register);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +504,7 @@ bool isBlacklistedLabel(char * name)
|
|||
}
|
||||
|
||||
/* ======================================================================
|
||||
Function: responseDumpTInfo
|
||||
Function: ResponseAppendTInfo
|
||||
Purpose : add teleinfo values into JSON response
|
||||
Input : 1st separator space if begining of JSON, else comma
|
||||
: select if append all data or just changed one
|
||||
|
@ -517,7 +558,15 @@ bool ResponseAppendTInfo(char sep, bool all)
|
|||
}
|
||||
|
||||
if (!isNumber) {
|
||||
ResponseAppend_P( PSTR("\"%s\""), me->value );
|
||||
// Some values contains space
|
||||
if (strcmp(me->name, "NGTF")==0 || strcmp(me->name, "LTARF")==0 || strcmp(me->name, "MSG1")==0) {
|
||||
char trimmed_value[strlen(me->value)+1];
|
||||
strcpy(trimmed_value, me->value);
|
||||
ResponseAppend_P( PSTR("\"%s\""), Trim(trimmed_value) );
|
||||
} else {
|
||||
ResponseAppend_P( PSTR("\"%s\""), me->value );
|
||||
}
|
||||
|
||||
} else {
|
||||
ResponseAppend_P( PSTR("%ld"), atol(me->value));
|
||||
}
|
||||
|
@ -910,6 +959,137 @@ void TInfoProcess(void)
|
|||
|
||||
}
|
||||
|
||||
#ifdef USE_WEBSERVER
|
||||
/* ======================================================================
|
||||
Function: TInfoShowBASE
|
||||
Purpose : Display Base contract on WEB Interface
|
||||
====================================================================== */
|
||||
void TInfoShowBASE(void)
|
||||
{
|
||||
char name[17];
|
||||
char value[17];
|
||||
if ( tinfo_mode==TINFO_MODE_HISTORIQUE ) {
|
||||
if (getValueFromLabelIndex(LABEL_BASE, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_BASE, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
} else {
|
||||
if (getValueFromLabelIndex(LABEL_EAST, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EAST, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ======================================================================
|
||||
Function: TInfoShowHC
|
||||
Purpose : Display HC/HP contract on WEB Interface
|
||||
====================================================================== */
|
||||
void TInfoShowHC(void)
|
||||
{
|
||||
char name[17];
|
||||
char value[17];
|
||||
if ( tinfo_mode==TINFO_MODE_HISTORIQUE ) {
|
||||
if (getValueFromLabelIndex(LABEL_HCHC, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_HCHC, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_HCHP, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_HCHP, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
} else {
|
||||
int index = 0;
|
||||
if (getValueFromLabelIndex(LABEL_NTARF, value) ) {
|
||||
index = atoi(value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EAST, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EAST, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EASF01, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EASF01, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO_SELECT, name, value, index==1?'*':' ');
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EASF02, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EASF02, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO_SELECT, name, value, index==2?'*':' ');
|
||||
//WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* ======================================================================
|
||||
Function: TInfoShowBBR
|
||||
Purpose : Display Bleu Blanc Rouge contract on WEB Interface
|
||||
====================================================================== */
|
||||
void TInfoShowBBR(void)
|
||||
{
|
||||
char name[17];
|
||||
char value[17];
|
||||
if ( tinfo_mode==TINFO_MODE_HISTORIQUE ) {
|
||||
// Contrat Tempo BBR
|
||||
if (getValueFromLabelIndex(LABEL_HCJB, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_HCJB, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_HPJB, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_HPJB, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_HCJW, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_HCJW, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_HPJW, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_HPJW, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_HCJR, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_HCJR, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_HPJR, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_HPJR, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_DEMAIN, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_DEMAIN, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_LABEL_VALUE, name, value);
|
||||
}
|
||||
} else {
|
||||
int index = 0;
|
||||
if (getValueFromLabelIndex(LABEL_NTARF, value) ) {
|
||||
index = atoi(value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EASF01, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EASF01, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO_SELECT, name, value, index==1?'*':' ');
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EASF02, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EASF02, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO_SELECT, name, value, index==2?'*':' ');
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EASF03, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EASF03, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO_SELECT, name, value, index==3?'*':' ');
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EASF04, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EASF04, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO_SELECT, name, value, index==4?'*':' ');
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EASF05, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EASF05, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO_SELECT, name, value, index==5?'*':' ');
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EASF06, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EASF06, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO_SELECT, name, value, index==6?'*':' ');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ======================================================================
|
||||
Function: TInfoShow
|
||||
Purpose : Tasmota callback executed to send telemetry or WEB display
|
||||
|
@ -917,25 +1097,6 @@ Input : -
|
|||
Output : -
|
||||
Comments: -
|
||||
====================================================================== */
|
||||
#ifdef USE_WEBSERVER
|
||||
const char HTTP_ENERGY_ID_TELEINFO[] PROGMEM = "{s}ID{m}%s{e}" ;
|
||||
const char HTTP_ENERGY_INDEX_TELEINFO[] PROGMEM = "{s}%s{m}%s " D_UNIT_WATTHOUR "{e}" ;
|
||||
const char HTTP_ENERGY_PAPP_TELEINFO[] PROGMEM = "{s}" D_POWERUSAGE "{m}%d " D_UNIT_WATT "{e}" ;
|
||||
//const char HTTP_ENERGY_IINST_TELEINFO[] PROGMEM = "{s}" D_CURRENT "%s{m}%d " D_UNIT_AMPERE "{e}" ;
|
||||
const char HTTP_ENERGY_TARIF_TELEINFO_STD[] PROGMEM = "{s}" D_CURRENT_TARIFF "{m}%s{e}" ;
|
||||
const char HTTP_ENERGY_TARIF_TELEINFO_HISTO[] PROGMEM = "{s}" D_CURRENT_TARIFF "{m}Heures %s{e}" ;
|
||||
const char HTTP_ENERGY_CONTRAT_TELEINFO[] PROGMEM = "{s}" D_CONTRACT "{m}%s %d" D_UNIT_AMPERE "{e}" ;
|
||||
const char HTTP_ENERGY_LOAD_TELEINFO[] PROGMEM = "{s}" D_POWER_LOAD "{m}%d" D_UNIT_PERCENT "{e}" ;
|
||||
const char HTTP_ENERGY_IMAX_TELEINFO[] PROGMEM = "{s}" D_MAX_CURRENT "{m}%d" D_UNIT_AMPERE "{e}" ;
|
||||
const char HTTP_ENERGY_IMAX3_TELEINFO[] PROGMEM = "{s}" D_MAX_CURRENT "{m}%d / %d / %d " D_UNIT_AMPERE "{e}" ;
|
||||
const char HTTP_ENERGY_PMAX_TELEINFO[] PROGMEM = "{s}" D_MAX_POWER "{m}%d" D_UNIT_WATT "{e}" ;
|
||||
const char HTTP_ENERGY_PMAX3_TELEINFO[] PROGMEM = "{s}" D_MAX_POWER "{m}%d / %d / %d " D_UNIT_WATT "{e}" ;
|
||||
const char HTTP_ENERGY_LOAD_BAR[] PROGMEM = "<tr><div style='margin:4px;padding:0px;background-color:#ddd;border-radius:4px;'>"
|
||||
"<div style='font-size:0.75rem;font-weight:bold;padding:0px;text-align:center;border:1px solid #bbb;border-radius:4px;color:#444;background-color:%s;width:%d%%;'>"
|
||||
"%d%%</div>"
|
||||
"</div></tr>";
|
||||
#endif // USE_WEBSERVER
|
||||
|
||||
void TInfoShow(bool json)
|
||||
{
|
||||
// Since it's an Energy device , current, voltage and power are
|
||||
|
@ -979,19 +1140,16 @@ void TInfoShow(bool json)
|
|||
}
|
||||
}
|
||||
|
||||
// Show indexes depending on contract
|
||||
if ( contrat == CONTRAT_BAS ) {
|
||||
TInfoShowBASE();
|
||||
} else if ( contrat == CONTRAT_HC ) {
|
||||
TInfoShowHC();
|
||||
} else if ( contrat == CONTRAT_BBR || contrat == CONTRAT_EJP ) {
|
||||
TInfoShowBBR();
|
||||
}
|
||||
|
||||
if (tinfo_mode==TINFO_MODE_HISTORIQUE ) {
|
||||
if (getValueFromLabelIndex(LABEL_BASE, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_BASE, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_HCHC, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_HCHC, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_HCHP, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_HCHP, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (Energy.phase_count==3) {
|
||||
int imax[3];
|
||||
for (int i=LABEL_IMAX1; i<=LABEL_IMAX3; i++) {
|
||||
|
@ -1006,7 +1164,6 @@ void TInfoShow(bool json)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (getValueFromLabelIndex(LABEL_PMAX, value) ) {
|
||||
WSContentSend_P(HTTP_ENERGY_PMAX_TELEINFO, atoi(value));
|
||||
}
|
||||
|
@ -1027,27 +1184,47 @@ void TInfoShow(bool json)
|
|||
}
|
||||
|
||||
} else if (tinfo_mode==TINFO_MODE_STANDARD ) {
|
||||
if (getValueFromLabelIndex(LABEL_EAST, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EAST, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EASF01, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EASF01, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_EASF02, value) ) {
|
||||
GetTextIndexed(name, sizeof(name), LABEL_EASF02, kLabel);
|
||||
WSContentSend_P(HTTP_ENERGY_INDEX_TELEINFO, name, value);
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_SMAXSN, value) ) {
|
||||
WSContentSend_P(HTTP_ENERGY_PMAX_TELEINFO, atoi(value));
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_LTARF, value) ) {
|
||||
WSContentSend_P(HTTP_ENERGY_TARIF_TELEINFO_STD, value);
|
||||
WSContentSend_P(HTTP_ENERGY_TARIF_TELEINFO_STD, Trim(value));
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_NGTF, value) ) {
|
||||
if (isousc) {
|
||||
WSContentSend_P(HTTP_ENERGY_CONTRAT_TELEINFO, value, isousc);
|
||||
WSContentSend_P(HTTP_ENERGY_CONTRAT_TELEINFO, Trim(value), isousc);
|
||||
}
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_MSG1, value) ) {
|
||||
WSContentSend_P(HTTP_ENERGY_LABEL_VALUE, PSTR("Message 1"), Trim(value));
|
||||
}
|
||||
if (getValueFromLabelIndex(LABEL_MSG2, value) ) {
|
||||
WSContentSend_P(HTTP_ENERGY_LABEL_VALUE, PSTR("Message 2"), Trim(value));
|
||||
}
|
||||
WSContentSend_P(HTTP_ENERGY_LABEL_VALUE, PSTR("Contact Sec"), status_register & 0x01 ? "Ouvert":"Fermé");
|
||||
if (status_register & 0x08) {
|
||||
WSContentSend_P(HTTP_ENERGY_LABEL_VALUE, PSTR("ADPS"), "En cours");
|
||||
}
|
||||
if (status_register >> 24) {
|
||||
char txt[32];
|
||||
uint8_t sr = status_register >> 24;
|
||||
uint8_t val = sr & 0x03;
|
||||
if (val) {
|
||||
WSContentSend_P(HTTP_ENERGY_LABEL_VALUE, PSTR("Jour"), val==1?"Bleu":val==2?"Blanc":"Rouge");
|
||||
}
|
||||
val = (sr >> 2) & 0x03;
|
||||
if (val) {
|
||||
WSContentSend_P(HTTP_ENERGY_LABEL_VALUE, PSTR("Demain"), val==1?"Bleu":val==2?"Blanc":"Rouge");
|
||||
}
|
||||
val = (sr >> 4) & 0x03;
|
||||
if (val) {
|
||||
sprintf_P(txt, PSTR("Pointe mobile %d"), val);
|
||||
WSContentSend_P(HTTP_ENERGY_LABEL_VALUE, PSTR("Préavis"), txt);
|
||||
}
|
||||
val = (sr >> 6) & 0x03;
|
||||
if (val) {
|
||||
sprintf_P(txt, PSTR("En cours %d"), val);
|
||||
WSContentSend_P(HTTP_ENERGY_LABEL_VALUE, PSTR("Pointe mobile"), txt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue