example for valueGet
mutricyl opened this issue · comments
mutricyl commented
Hello is it possible to add an example of valueGet function usage ? I would like to make a graph of one specific value comming from teleinformation.
Thanks
Charles commented
You can check the Tasmota source code, an example here
By the way it's easy, you pass the Label you want to search the value for
You prepare buffer to receive value and it will be filled with value (if it exists) in str format
char value[17]="";
// Get value of label name
if ( tinfo.valueGet("PAPP", value) ) {
int puissance = atoi (value);
Serial.printf_P(PSTR("Puissance:%dW str:%s\r\n"), puissance, value);
}
// You can use PSTR format also
if ( tinfo.valueGet_P(PSTR("IINST"), value) ) {
Serial.printf_P(PSTR("Intensité nombre:%d str:%s\r\n"), atoi(value), value);
}