thomluther/ha-anker-solix

Energy stats reported per device but are system stats

thomluther opened this issue · 4 comments

System Health details

see discussion #61 (comment)

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of any previous issues..

Describe the issue

Each solarbank queries the energy statistics per SN from the cloud Api. However, as discussed in #61 (comment) it appears the cloud is tracking and reporting energy stats only per system.
This is no difference for single solarbank systems, but for dual solarbank systems it is a duplication of Api queries and entities that show the same values per device, although the values are for the appliance (system).
There values are daily solar energy, charge and discharge energy, solar and battery share percentages.

Reproduction steps

In dual solarbank systems, compare the daily device energy entities with eachother and the daily system energies as reported in the Anker app diagrams and totals for a day. The cloud does not provide energy stats breakdown per device.

Debug logs

see discussion https://github.com/thomluther/hacs-anker-solix/discussions/61#discussioncomment-9628481

Diagnostics dump

No response

The fix for this problem is twofold

  1. Reduce energy stat queries to only first solarbank in a system and duplicate the values instead
  2. Evaluate to move the energy stats to the System device and remove them from the solarbank device. This will be a breaking change and may break user energy dashboard integration if direct integration sensors are used. This is not recommended anyway, but may still be in place. If daily device energy sensors are used in template sensors, they would have to be updated since move to system device will cause require a renaming of the unique IDs and history data would also be cut.

This change will require updates in the Api library as well to consider exclusion categories properly.
The energy stat helper method needs enhancements anyway for new solarbank 2 home_usage and smartreader grid energy stats, that is being presented on Solarbank 2 systems in the Anker app diagrams.

Implemented first part as quick fix to avoid duplicate queries for the same energy data.
In dual solarbank systems, the energy data of the first queried solarbank is copied to the other solarbank.

Evaluation whether energy data is being moved to system entities needs to be evaluated if enhancements for Solarbank 2 will be implemented in the future