RMshebei Tuya Smart WiFi Breaker 4P100A Integration with Home Assistant + Solar Calculation + Complete Dashboard

:tv: Video explaining the entire system:


:sunny: 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.

:gear: Equipment Used

RMshebei Tuya Smart WiFi 4P100A Circuit Breaker

Sonoff POWR2

:electric_plug: Integrations Used

:small_blue_diamond: Home Assistant

:small_blue_diamond: Browser Mod

:small_blue_diamond: Mushroom Cards

:small_blue_diamond: Card Mod

:bar_chart: What the project automatically calculates

:heavy_check_mark: Daily solar production
:heavy_check_mark: Monthly solar production
:heavy_check_mark: Annual solar production
:heavy_check_mark: Energy injected into the grid
:heavy_check_mark: Total household consumption
:heavy_check_mark: Automatic calculation of the bill amount (based on the configured kWh value)
:heavy_check_mark: Monthly balance in kWh
:heavy_check_mark: Accumulated energy balance
:heavy_check_mark: Monthly energy credit or debit

:arrows_counterclockwise: Cycle Closing (IMPORTANT)

This project does not use offset in the Utility Meter.

Invoice closing is performed through:

:heavy_check_mark: Customized automation
:heavy_check_mark: Controlled manual reset
:heavy_check_mark: 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

:dart: Project Differentiators

:heavy_check_mark: Fully modular system
:heavy_check_mark: Does not interfere with other cards using the same sensors
:heavy_check_mark: Centralized and organized reset
:heavy_check_mark: Easy adaptation to any kWh value
:heavy_check_mark: Structure ready for publication on GitHub

:file_folder: :one: sensors.yaml

:file_folder: 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