Hey everyone,
I am currently trying to get the new energy dashboard running in my environment. Before that i did everything the dashboard could do by myself with the a few SQL queries and Grafana.
My setup:
- A Growatt inverter with two 600 Watt panels
- A smart meter in the fuse box located in my flat which measures the current with CT clamps, the voltage of three phases and calculates then the individual power of the phases and the total power
- The washing machine and dryer are located in the basement. These have a smart plug each which measures the power of them. (Important: These two are located before the smart meter)
Getting the measurement into HomeAssistant is very straightforward:
- Growatt inverter: With the Growatt Intergration over there cloud
- Smart meter: It provides a simple local webpage which can get parsed with the rest sensor
- Smart plugs: These are from homematic and they are integrated over a homematicIP bridge
Based on this environment I have to calculate three values:
- Total power consumption
- Grid power supply (the power from the grid. I don’t know if “supply” is the correct wording here)
- Grid power feed
Then calculate the consumed kwH and put everything into a utility meter so the new energy intergration finds all necessary attributes. So I hvae compiled the following configuration:
rest:
- resource: http://10.0.20.52/Meter
scan_interval: 30
sensor:
- name: smartmeter_total_power_consumption
value_template: '{{ (value.replace(" ", "").split("<br>")[8].split("=")[1].replace("W","")) }}'
unit_of_measurement: W
sensor:
- platform: statistics
name: statistics_template_power_grid_supply_per_minute
entity_id: sensor.template_power_grid_supply
sampling_size: 2
- platform: template
sensors:
template_power_grid_supply:
friendly_name: "Power grid supply"
unit_of_measurement: W
value_template: >-
{% set grid_supply = states("sensor.hm_washingmachine_power") | int + states("sensor.hm_dryer_power") | int + states("sensor.smartmeter_total_power_consumption") | int %}
{% if grid_supply < 0 %} 0 {% else %} {{ grid_supply }} {% endif %}
template_grid_feed:
friendly_name: "Grid feed"
unit_of_measurement: W
value_template: >-
{% set grid_feed = states("sensor.hm_washingmachine_power") | int + states("sensor.hm_dryer_power") | int + states("sensor.smartmeter_total_power_consumption") | int %}
{% if grid_feed < 0 %} {{ grid_feed * -1}} {% else %} 0 {% endif %}
template_total_power_consumption:
friendly_name: "Total power consumption"
unit_of_measurement: W
value_template: >-
{% set grid_supply = states("sensor.hm_washingmachine_power") | int + states("sensor.hm_dryer_power") | int + states("sensor.smartmeter_total_power_consumption") | int %}
{% if grid_supply == 0 %} {{ states("sensor.growatt_total_output_power") }}
{% elif grid_supply < 0 %} {{ states("sensor.growatt_total_output_power") | int - (grid_supply * -1) }}
{% else %} {{ states("sensor.growatt_total_output_power") | int + grid_supply }}
{% endif %}
template_energy_grid_supply:
friendly_name: "Energy grid supply"
value_template: "{{ state_attr('sensor.statistics_template_power_grid_supply_per_minute', 'total') | int / (1000 * 60) }}"
unit_of_measurement: kwH
utility_meter:
utility_meter_grid_energy_supply_hourly:
source: sensor.template_energy_grid_supply
name: "utility_meter_grid_energy_supply_hourly"
cycle: monthly
utility_meter_grid_energy_supply_daily:
source: sensor.template_energy_grid_supply
name: "utility_meter_grid_energy_supply_daily"
cycle: daily
utility_meter_grid_energy_supply_monthly:
source: sensor.template_energy_grid_supply
name: "utility_meter_grid_energy_supply_monthly"
cycle: monthly
The values I get from the utilty meters seems to be right. So everything fine there. But in the energy Dashboard I get the error message “No matching statistics found”.
The funny thing is that I don’t even see the Growatt entities under Solar, even though the integration is already listed as supported on the Home Assistant homepage.
What I am doing wrong?
Home Assistant is running under the Hass Supervisor.
Supervisor Version: 2021.06.8
Home Assistant Version: 2021.8.4