Trying to figure out how I can create a sensor for “Net returned to the grid” monthly data from the Energy dashboard card. Any thoughts?
configuration.yaml
# Include Templates
template: !include_dir_list templates/
# Enable Custom Sensors
sensor: !include_dir_list sensors/
Net Power:
templates/utilities/net_power_sensor.yaml
sensor:
- name: Net Power
state_class: measurement
unit_of_measurement: W
device_class: power
icon: mdi:transmission-tower
state: >
{% set production = states('sensor.envoy_SERIAL_current_power_production') | int %}
{% set consumption = states('sensor.envoy_SERIAL_current_power_consumption') | int %}
{{ (production - consumption) }}
availability: >
{{ states('sensor.envoy_SERIAL_current_power_consumption') | is_number and states('sensor.envoy_SERIAL_current_power_production') | is_number }}
Net Energy:
sensors/grid_net_energy.yaml
platform: integration
name: Grid Net Energy
source: sensor.net_power
unit_prefix: k
unit_time: h
method: left
You can use net power with apex charts too to create something similar to Enphase power graph as well.
And make a Helper → Utility Meter and use the sensor.grid_net_energy as the source with net meter enabled
1 Like