in the config/.storage there is a file called energy.
EDIT AT YOUR OWN RISK!
Below is my file:
{
"version": 1,
"minor_version": 1,
"key": "energy",
"data": {
"energy_sources": [
{
"type": "grid",
"flow_from": [
{
"stat_energy_from": "sensor.yearly_kwh_from_grid",
"stat_cost": null,
"entity_energy_from": "sensor.yearly_kwh_from_grid",
"entity_energy_price": null,
"number_energy_price": 0.13057
}
],
"flow_to": [
{
"stat_energy_to": "sensor.yearly_kwh_to_grid",
"stat_compensation": null,
"entity_energy_to": "sensor.yearly_kwh_to_grid",
"entity_energy_price": null,
"number_energy_price": 0.04829
}
],
"cost_adjustment_day": 0.667
},
{
"type": "solar",
"stat_energy_from": "sensor.solar_energy_produced",
"config_entry_solar_forecast": null
},
{
"type": "battery",
"stat_energy_from": "sensor.yearly_kwh_from_battery",
"stat_energy_to": "sensor.yearly_kwh_to_battery"
}
],
"device_consumption": [
{
"stat_consumption": "sensor.phase_1_a_c_down_energy"
},
{
"stat_consumption": "sensor.phase_1_a_c_upstairs_energy"
},
{
"stat_consumption": "sensor.coffee_bar_energy" <--- A sonoff S31 plug
},
{
"stat_consumption": "sensor.bar_fridge_energy"
},
{
"stat_consumption": "sensor.washing_machine_energy"
},
{
"stat_consumption": "sensor.study_monitor_energy"
},
{
"stat_consumption": "sensor.shelly_em_a_c_down_stairs_channel_2_energy"
},
{
"stat_consumption": "sensor.shelly_em_a_c_upstairs_channel_2_energy"
},
{
"stat_consumption": "sensor.storage_frige_energy"
}
]
}
}