AlgorithmicEntropy / SolarWattHassio

Home Assistant (hass.io) custom component for SolarWatt solar system
MIT License
2 stars 0 forks source link

Energy Dashboard #2

Closed a-waider closed 3 years ago

a-waider commented 3 years ago

Hi there,

nice work with this integration :)

Is it possible to use this integration to provide data to the energy dashboard?

AlgorithmicEntropy commented 3 years ago

Yes this is possible, but you need to add some custom sensors to convert the power values to energy. This is possible using this template sensor Energy Template I added my sensors from the configuration.yaml below:

sensor:
  - platform: integration
    source: sensor.energymanager_power_consumed_from_grid
    name: energy_from_grid
    unit_prefix: k
    round: 2

  - platform: integration
    source: sensor.energymanager_power_export_to_grid
    name: energy_to_grid
    unit_prefix: k
    round: 2

  - platform: integration
    source: sensor.energymanager_power_consumed
    name: energy_consumed
    unit_prefix: k
    round: 2

  - platform: integration
    source: sensor.energymanager_pv_power
    name: energy_produced_pv
    unit_prefix: k
    round: 2

After adding these it can take some time for them to show up in the energy config (i think it needs to collect some values before they show up)

a-waider commented 3 years ago

Thanks! I added it just now and will test it tomorrow.

a-waider commented 3 years ago

So I added the sensors for the myreserve battery with the following coniguration.yaml:

sensor:
  - platform: integration
    source: sensor.energymanager_power_consumed_from_grid
    name: energy_from_grid
    unit_prefix: k
    round: 2
  - platform: integration
    source: sensor.energymanager_power_export_to_grid
    name: energy_to_grid
    unit_prefix: k
    round: 2
  - platform: integration
    source: sensor.energymanager_power_consumed
    name: energy_consumed
    unit_prefix: k
    round: 2
  - platform: integration
    source: sensor.energymanager_pv_power
    name: energy_produced_pv
    unit_prefix: k
    round: 2
  - platform: integration
    source: sensor.energymanager_myreserve_power_in_from_producers
    name: energy_battery_from_producers
    unit_prefix: k
    round: 2
  - platform: integration
    source: sensor.energymanager_myreserve_power_self_supplied
    name: energy_battery_supply
    unit_prefix: k
    round: 2

But I can only see the following sensors in my energy dashboard:

I also got following warnings in my homeassistant logs:

2021-09-07 11:09:24 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.energy_to_grid (kWh) does not match the unit of already compiled statistics (None). Generation of long term statistics will be suppressed unless the unit changes back to None
2021-09-07 11:09:24 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.energy_battery_from_producers (kWh) does not match the unit of already compiled statistics (None). Generation of long term statistics will be suppressed unless the unit changes back to None

Do you know how to delete the long term statistics of energy_battery_from_producers and energy_to_grid?

AlgorithmicEntropy commented 3 years ago

I tested it myself and ran into the same issue, found this thread on how to fix it by manually editing the database

AlgorithmicEntropy commented 3 years ago

Btw, I´m currently working on integrating the energy stats, which the energy manager keeps itself. This should fix this problem and also provide better stats instead of the calculated ones through homeassistant

a-waider commented 3 years ago

Okay nice, then I'll wait for your new release

AlgorithmicEntropy commented 3 years ago

Hi is just released version 0.2 which adds the new energy sensors I hope you can successfully integrate them in your setup

a-waider commented 3 years ago

Nice work so far 👍 I've noticed some improvements/some things that are unclear to me:

AlgorithmicEntropy commented 3 years ago

I have not found any official documentation on the meaning of all values, so i had to guess from their json names and how the values correlate with each other, so the explanations below are my best guess :)

I track the myreserve as following in the energy dashboard: -> sensor.energy_consumed_storage -> battery out -> sensor.energy_from_pv_into_storage -> battery in

This only tracks pv -> storage -> house, but i dont really care about grid -> storage (sensor.energy_grid_into_storage) or
storage -> grid (sensor.energy_to_grid_from_storage) because these are very small amounts for my setup

Thanks for the hint with the naming, i added a couple missing from to some names to make them more clear in the next release

a-waider commented 3 years ago

Thanks for pointing that out to me. I added the entities like you suggested. I'm closing this now since I believe that this issue has been resolved. Thanks again.