This is my configuration for setting up two Shelly EM’s. One is measuring utility in and out (+/-) and another is measuring solar production.
For the new energy management dashboard you would use the Grid Import/Export and Total Solar Energy
sensor.yaml (fyi i’m not using any of the energy measured by the shelly only the power)
- platform: mqtt
name: "Utility Power 1"
state_topic: "shellies/Utility/emeter/0/power"
qos: 1
unit_of_measurement: "W"
icon: mdi:gauge
- platform: mqtt
name: "Utility Power 2"
state_topic: "shellies/Utility/emeter/1/power"
qos: 1
unit_of_measurement: "W"
icon: mdi:gauge
- platform: mqtt
name: "Utility Voltage"
state_topic: "shellies/Utility/emeter/1/voltage"
qos: 1
unit_of_measurement: "V"
icon: mdi:gauge
- platform: mqtt
name: "Utility Energy 1"
state_topic: "shellies/Utility/emeter/0/energy"
qos: 1
unit_of_measurement: "Wm"
- platform: mqtt
name: "Utility Energy 2"
state_topic: "shellies/Utility/emeter/1/energy"
qos: 1
unit_of_measurement: "Wm"
- platform: mqtt
name: "Solar Power 1 Raw"
state_topic: "shellies/Solar/emeter/0/power"
qos: 1
unit_of_measurement: "W"
icon: mdi:gauge
- platform: mqtt
name: "Solar Power 2 Raw"
state_topic: "shellies/Solar/emeter/1/power"
qos: 1
unit_of_measurement: "W"
icon: mdi:gauge
- platform: mqtt
name: "Solar Voltage"
state_topic: "shellies/Solar/emeter/1/voltage"
qos: 1
unit_of_measurement: "V"
icon: mdi:gauge
- platform: mqtt
name: "Solar Energy 1"
state_topic: "shellies/Solar/emeter/0/energy"
qos: 1
unit_of_measurement: "Wm"
- platform: mqtt
name: "Solar Energy 2"
state_topic: "shellies/Solar/emeter/1/energy"
qos: 1
unit_of_measurement: "Wm"
- platform: template
sensors:
solar_power_1:
value_template: >
{{ (states('sensor.solar_power_1_raw')|float - 3) |round(2) }}
friendly_name: 'Solar Power 1'
unit_of_measurement: 'W'
solar_power_2:
value_template: >
{{ (states('sensor.solar_power_2_raw')|float - 3) |round(2) }}
friendly_name: 'Solar Power 2'
unit_of_measurement: 'W'
consumed_power_1:
value_template: >
{{ (states('sensor.solar_power_1')|float
+ states('sensor.utility_power_1')|float) |round(2) }}
friendly_name: 'Consumed Power 1'
unit_of_measurement: 'W'
consumed_power_2:
value_template: >
{{ (states('sensor.solar_power_2')|float
+ states('sensor.utility_power_2')|float) |round(2) }}
friendly_name: 'Consumed Power 2'
unit_of_measurement: 'W'
total_consumed_power:
value_template: >
{{ (states('sensor.consumed_power_1')|float
+ states('sensor.consumed_power_2')|float)| round(2) }}
friendly_name: 'Total Consumed Power'
unit_of_measurement: 'W'
total_solar_power:
value_template: >
{{ (states('sensor.solar_power_1')|float
+ states('sensor.solar_power_2')|float)| round(2) }}
friendly_name: 'Total Solar Power'
unit_of_measurement: 'W'
total_utility_power:
value_template: >
{{ (states('sensor.utility_power_1')|float
+ states('sensor.utility_power_2')|float)| round(2) }}
friendly_name: 'Total Utility Power'
unit_of_measurement: 'W'
total_returned_power:
value_template: >
{{ (states('sensor.total_utility_power')|float
* (-1)|float)| round(2) }}
friendly_name: 'Total Returned Power'
unit_of_measurement: 'W'
- platform: integration
source: sensor.total_utility_power
name: total_utility_energy
unit_prefix: k
unit_time: h
method: left
- platform: integration
source: sensor.total_consumed_power
name: total_consumed_energy
unit_prefix: k
unit_time: h
method: left
- platform: integration
source: sensor.total_returned_power
name: total_returned_energy
unit_prefix: k
unit_time: h
method: left
- platform: integration
source: sensor.solar_power
name: total_solar_energy
unit_prefix: k
unit_time: h
method: left
- platform: integration
name: Grid Import Energy
source: sensor.grid_import_power
unit_prefix: k
unit_time: h
method: left
- platform: integration
name: Grid Export Energy
source: sensor.grid_export_power
unit_prefix: k
unit_time: h
method: left
template.yaml
- sensor:
name: Grid Import Power
state_class: measurement
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
state: >
{{ [0, states('sensor.total_consumed_power') | int - states('sensor.total_solar_power') | int ] | max }}
- sensor:
name: Grid Export Power
state_class: measurement
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
state: >
{{ [0, states('sensor.total_solar_power') | int - states('sensor.total_consumed_power') | int ] | max }}
- sensor:
name: Solar Power
state_class: measurement
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
state: >
{{ [0, states('sensor.total_solar_power') | int ] | max }}
And some utility meters for fun
utiliy_meter.yaml
utility_yearly_energy:
source: sensor.total_utility_energy
cycle: yearly
tariffs:
- peak
net_consumption: false
utility_monthly_energy:
source: sensor.total_utility_energy
cycle: monthly
net_consumption: false
tariffs:
- peak
utility_daily_energy:
source: sensor.total_utility_energy
cycle: daily
net_consumption: false
tariffs:
- peak
solar_daily_energy:
source: sensor.total_solar_energy
cycle: daily
net_consumption: false
tariffs:
- peak
solar_monthly_energy:
source: sensor.total_solar_energy
cycle: monthly
net_consumption: false
tariffs:
- peak
solar_yearly_energy:
source: sensor.total_solar_energy
cycle: yearly
net_consumption: false
tariffs:
- peak
consumed_daily_energy:
source: sensor.total_consumed_energy
cycle: daily
net_consumption: false
tariffs:
- peak
consumed_monthly_energy:
source: sensor.total_consumed_energy
cycle: monthly
net_consumption: false
tariffs:
- peak
consumed_yearly_energy:
source: sensor.total_consumed_energy
cycle: yearly
net_consumption: false
tariffs:
- peak
returned_daily_energy:
source: sensor.total_returned_energy
cycle: daily
net_consumption: false
tariffs:
- peak
returned_monthly_energy:
source: sensor.total_returned_energy
cycle: monthly
net_consumption: false
tariffs:
- peak
retured_yearly_energy:
source: sensor.total_returned_energy
cycle: yearly
net_consumption: false
tariffs:
- peak