Video explaining the entire system:
Solar Energy Monitoring Project
Complete solar energy monitoring system using:
4P100A WiFi circuit breaker with bidirectional measurement
Dedicated smart meter for solar production
Home Assistant Utility Meter
Customized cards (Mushroom + Card Mod + Browser Mod)
Own automation for resetting the cycle Billing
The project automatically calculates:
Consumption
Production
Energy injected
Energy balance
Estimated bill amount
Without relying on automatic offset from the Utility Meter.
Equipment Used
RMshebei Tuya Smart WiFi 4P100A Circuit Breaker
Sonoff POWR2
Integrations Used
Home Assistant
Browser Mod
Mushroom Cards
Card Mod
What the project automatically calculates
Daily solar production
Monthly solar production
Annual solar production
Energy injected into the grid
Total household consumption
Automatic calculation of the bill amount (based on the configured kWh value)
Monthly balance in kWh
Accumulated energy balance
Monthly energy credit or debit
Cycle Closing (IMPORTANT)
This project does not use offset in the Utility Meter.
Invoice closing is performed through:
Customized automation
Controlled manual reset
Automatic execution on the defined day (e.g., the 25th at 11:59 PM)
This allows for:
Greater control over the billing period
Independence from the Utility Meter’s fixed cycle
Easy adjustment if the utility company changes the reading date
Project Differentiators
Fully modular system
Does not interfere with other cards using the same sensors
Centralized and organized reset
Easy adaptation to any kWh value
Structure ready for publication on GitHub
sensors.yaml
Value of Production
#################################################
# SENSORS (PLATFORM TEMPLATE)
##################################################
- platform: template
sensor:
- platform: template
sensors:
#################################################
# SOLAR PRODUCTION (BASE)
################################################
weekly_solar_production:
friendly_name: "Weekly Solar Production"
unit_of_measurement: "kWh"
value_template: >
{{ states('sensor.sonoff_1000916c58_energy') | float(0) }}
##################################################
# CURRENT CONSUMPTION TWO PHASES
#################################################
current_network_consumption_kW:
friendly_name: "Current Network Consumption (kW)"
unit_of_measurement: "kW"
value_template: >
{{
states('sensor.breaker_power_of_phase_a_2') | float(0)
+
states('sensor.breaker_power_of_phase_b_2') | float(0)
}}
current_network_consumption_w:
friendly_name: "Current Network Consumption (W)"
unit_of_measurement: "W"
value_template: >
{{
(
states('sensor.breaker_power_of_phase_a_2') | float(0)
+
states('sensor.breaker_power_of_phase_b_2') | float(0)
) * 1000
}}
##################################################
# COSTS (fixed base 1.11)
##################################################
kWh_value:
friendly_name: "kWh Value"
unit_of_measurement: "R$/kWh"
value_template: "1.11"
monthly_consumption_cost:
friendly_name: "Monthly Consumption Cost"
unit_of_measurement: "R$"
value_template: >
{{ states('sensor.monthly_energy_consumption') | float(0) * 1.11 }}
monthly_production_cost:
friendly_name: "Monthly Production Cost"
unit_of_measurement: "R$"
value_template: >
{{ states('sensor.monthly_solar_production') | float(0) * 1.11 }}
monthly_injected_cost:
friendly_name: "Monthly Injected Cost"
unit_of_measurement: "R$"
value_template: >
{{ states('sensor.monthly_energy_injection') | float(0) * 1.11 }}
##################################################
BALANCES
##################################################
accumulated_energy_balance:
friendly_name: "Accumulated Energy Balance"
unit_of_measurement: "kWh"
value_template: >
{{
states('sensor.breaker_total_energy_2') | float(0)
-
states('sensor.breaker_total_production_2') | float(0)
}}
account_balance_kwh:
friendly_name: "Account Balance (kWh)"
unit_of_measurement: "kWh"
value_template: >
{{
sta