The configuration defines several template sensors that calculate specific power measurements based on the Shelly 3EM's input and the photovoltaic system's output.
- power_import:
Measures the total power imported from the grid when the sum of power across all three phases (A, B, C) is greater than zero. If the total power is negative or zero, it reports 0 (no power imported). Uses an availability template to ensure the sensor only provides a value if all the phase sensors return numeric values.
- power_export:
Measures the total power exported to the grid when the sum of power across all three phases (A, B, C) is less than zero. If the total power is positive or zero, it reports 0 (no power exported). Also uses the same availability template as power_import.
- power_consumption:
Calculates the total power consumption. This value is derived based on whether power is being exported, generated by the solar panels (PV system), or imported from the grid. Logic: If power is being exported and the solar generation exceeds the exported power, the consumption is calculated as the difference between solar generation and export. Otherwise, it sums the imported power and solar power to determine consumption. Integration Sensors These sensors calculate the energy (in kilowatt-hours, kWh) from the instantaneous power values using the Riemann sum integration method. The sensors convert power (W) to energy (Wh -> kWh) over time.
- energy_import_sum:
Calculates the total energy imported from the grid using the sensor.power_import values. Results are stored in kWh, rounded to 2 decimal places. energy_export_sum:
Calculates the total energy exported to the grid using the sensor.power_export values. Results are stored in kWh, rounded to 2 decimal places. energy_consumption_sum:
Calculates the total energy consumed using the sensor.power_consumption values. Results are stored in kWh, rounded to 2 decimal places.
The utility_meter platform tracks energy usage over specified time periods. It creates counters for daily and monthly energy usage for each type of energy measurement.
energy_import_daily: Tracks daily energy imported from the grid. Source: sensor.energy_import_sum.
energy_import_monthly: Tracks monthly energy imported from the grid. Source: sensor.energy_import_sum. Energy Export Meters:
energy_export_daily: Tracks daily energy exported to the grid. Source: sensor.energy_export_sum.
energy_export_monthly: Tracks monthly energy exported to the grid. Source: sensor.energy_export_sum. Energy Consumption Meters:
energy_consumption_daily: Tracks daily energy consumed. Source: sensor.energy_consumption_sum.
energy_consumption_monthly: Tracks monthly energy consumed. Source: sensor.energy_consumption_sum.