3-phase PV router
Loading...
Searching...
No Matches
Telemetry feature

Functions used for data logging and external system communication. More...

Classes

class  TeleInfo
 A class for managing and sending telemetry information in a structured frame format. More...
 

Functions

static constexpr size_t calcBufferSize ()
 Calculates the total buffer size required for the telemetry frame.
 
static constexpr size_t lineSize (size_t tagLen, size_t valueLen)
 Calculates the size of a single telemetry line in the frame.
 
void printForEmonCMS (const bool bOffPeak)
 Write telemetry data to Serial in EmonCMS format.
 
void printForSerialText ()
 Prints data logs to the Serial output in text format.
 

Detailed Description

Functions used for data logging and external system communication.

This group includes functions that manage telemetry data collection and transmission. It supports integration with external systems like HomeAssistant, providing real-time data on power, voltage, temperature, and system status. Telemetry also includes diagnostic information.

Note
The telemetry feature ensures that the system's performance and status can be monitored remotely.

Function Documentation

◆ calcBufferSize()

static constexpr size_t calcBufferSize ( )
inlinestaticconstexpr

Calculates the total buffer size required for the telemetry frame.

This function computes the size of the buffer needed to store the entire telemetry frame, including all tags, values, and formatting characters. The calculation takes into account the presence of optional features such as relay diversion and temperature sensing.

Returns
The total buffer size as a compile-time constant.

The buffer size is calculated as follows:

  • 1 byte for the start-of-text (STX) character.
  • 1 line for the "P" tag (signed 6 digits).
  • For multi-phase systems (NO_OF_PHASES > 1):
    • NO_OF_PHASES lines for the "R" tag (signed 6 digits each).
    • NO_OF_PHASES lines for the "V1" tag (unsigned 5 digits each).
  • For single-phase systems:
    • 1 line for the "D" tag (unsigned 4 digits).
    • 1 line for the "E" tag (unsigned 5 digits).
  • If relay diversion is enabled (RELAY_DIVERSION):
    • 1 line for the "R" tag (signed 6 digits).
  • If temperature sensors are present (TEMP_SENSOR_PRESENT):
    • temperatureSensing.get_size() lines for temperature tags ("T1" to "Tn", 4 digits each).
  • 1 line for the "N" tag (unsigned 5 digits).
  • 1 byte for the end-of-text (ETX) character.

Definition at line 81 of file teleinfo.h.

Here is the call graph for this function:

◆ lineSize()

static constexpr size_t lineSize ( size_t tagLen,
size_t valueLen )
inlinestaticconstexpr

Calculates the size of a single telemetry line in the frame.

This function computes the size of a single line in the telemetry frame, including the tag, value, and formatting characters. Each line consists of:

  • 1 byte for the Line Feed (LF) character.
  • tagLen bytes for the tag.
  • 1 byte for the Tab (TAB) character separating the tag and value.
  • valueLen bytes for the value.
  • 1 byte for the Tab (TAB) character separating the value and checksum.
  • 1 byte for the checksum.
  • 1 byte for the Carriage Return (CR) character.
Parameters
tagLenThe length of the tag in bytes.
valueLenThe length of the value in bytes.
Returns
The total size of the line in bytes.

Definition at line 49 of file teleinfo.h.

Here is the caller graph for this function:

◆ printForEmonCMS()

void printForEmonCMS ( const bool bOffPeak)
inline

Write telemetry data to Serial in EmonCMS format.

This function outputs telemetry data in a format compatible with EmonCMS, including power, voltage, load states, temperature, and tariff information.

Parameters
bOffPeakIndicates whether the system is in an off-peak tariff period.
  • Outputs total power and phase-specific power.
  • Includes load ON percentages for each load.
  • Outputs temperature data if temperature sensing is enabled.
  • Includes tariff information if dual tariff is enabled.

Definition at line 195 of file utils.h.

Here is the caller graph for this function:

◆ printForSerialText()

void printForSerialText ( )
inline

Prints data logs to the Serial output in text format.

This function outputs telemetry data in a human-readable text format to the Serial output. It includes information about power, voltage, temperature, and system performance metrics.

  • Prints total power, phase-specific power, and RMS voltage for each phase.
  • Includes temperature data if temperature sensing is enabled.
  • Outputs additional system metrics like the number of sample sets and absence of diverted energy count.

Definition at line 259 of file utils.h.

Here is the caller graph for this function: