thomluther / ha-anker-solix

Home Assistant integration for Anker Solix Power devices
MIT License
296 stars 4 forks source link

Energy stats reported per device but are system stats #63

Closed thomluther closed 5 months ago

thomluther commented 6 months ago

System Health details

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

Checklist

Describe the issue

Each solarbank queries the energy statistics per SN from the cloud Api. However, as discussed in https://github.com/thomluther/hacs-anker-solix/discussions/61#discussioncomment-9628481 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

thomluther commented 6 months ago

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.

thomluther commented 6 months ago

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.

thomluther commented 5 months ago

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.

thomluther commented 5 months ago

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