Default Energy Dashboard #9
Replies: 1 comment 1 reply
-
|
@dicklawhouse Energy and Power are two related concepts. Energy is what has been consumed or spent over some period of time in Wh or kWh. These can be used in the Energy Dashboard. Power is an instantaneous reading and these figures can be used elsewhere, e.g., in a guage. There are sensors for both Power and Energy in the SPAN integration and HA has an integration to convert Power to Energy Personally I like to match my readings against the power company readings so I use Left Riemann integrals to compute energy, which is an averaging algorithm that some data warehouses like your power company may use, but this is not necessary as the panel's Energy sensors are more accurate since there is no averaging or fitting over time. If you are not using the HA platform integration (which converts from power to energy) and you don't care about matching your power companies figures, taking this SPAN integration's sensors, for example Main Meter Energy Consumed/Produced) for Energy (Wh) figures and converting them to kWh will work. What follows are some example templates I use to produce Energy figures to match my power company. The first two power templates are used in the third to get kWh. # From template.yaml
- sensor:
# When the current_power is positive it means the house is importing power from the grid
# Used to compute "Energy Spent kWh" in sensors.yaml
- name: Grid To House Watts
unique_id: sensor.grid_to_house_watts
device_class: power
state_class: measurement
unit_of_measurement: W
state: >
{% set state_val = states('sensor.current_power') %}
{% if state_val is match("^-?\\d+(\\.\\d+)?$") %}
{% set float_val = state_val | float %}
{{ [0, float_val] | max }}
{% else %}
0
{% endif %}
# When the current_power is negative it means the house is exporting power to the grid
#solar sold as abvsolute value
- name: Solar Sold Watts
unique_id: sensor.solar_sold_watts
device_class: power
unit_of_measurement: W
state: >
{% set state_val = states('sensor.current_power') %}
{% if state_val is match("^-?\\d+(\\.\\d+)?$") %}
{% set float_val = state_val | float %}
{% if float_val < 0 %}
{{ float_val | abs }}
{% else %}
0
{% endif %}
{% else %}
0
{% endif %}# From sensors.yaml
- platform: integration
source: sensor.grid_to_house_watts
name: Energy Spent kWh
unique_id: sensor.energy_spent_kwh
unit_prefix: k
round: 2
- platform: integration
source: sensor.solar_inverter_instant_power
name: Solar Inverter Produced kWh
unique_id: sensor.solar_inverter_produced_kwh
unit_prefix: k
round: 2
- platform: integration
source: sensor.solar_sold_watts
name: Solar Sold kWh
unique_id: sensor.solar_sold_kwh
unit_prefix: k
round: 2 |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hello All, Is there a way to use the SPAN panel's data in the default energy dashboard of home assistant? I do see the sensor for current_power but the only options for this sensor is in watts or kilowatts, but the energy dashboard does not seem to accept this format and wants it in watt hours or kilowatt hours instead. Perhaps I am missing something, but I cannot figure it out.
Beta Was this translation helpful? Give feedback.
All reactions