thomluther / anker-solix-api

Python library for Anker Solix API
MIT License
38 stars 12 forks source link

Findings in system exports #55

Closed thomluther closed 4 months ago

thomluther commented 4 months ago

The system export needs fixes for following problems:

thomluther commented 4 months ago

All right, did couple of changes and optimizations for the export module:

The export routine now only makes an update of the sites to get all site ids and device serials in the config. Then the endpoint queries are done for the export with randomized data Lastly the api dictionaries are updated from the exported files instead of updating from the server which needs another more complex randomization of values and keys. The import from randomized files avoids the complex key randomization and the api_devices and api_sites json files now allow direct validation if the data in the output files is randomized.

thomluther commented 4 months ago

The missing energy and capacity fields were not related to the dual solarbank setup, but related to the use of alias names. There is another weird bug in the server api, which returns different values for the same field names on different queries. The device_name in scene info result is actually the alias_name of the device, NOT the device_name. The fixed device_name is only returned in the bind_devices query. Fixed the mapping for the devices dictionary accordingly. When the real device_name is added/updated in the devices dictionary, the battery capacity and energy need to be re-calculated, since the capacity can only be derived from the fixed solarbank name.

thomluther commented 4 months ago

The missed set_output_power field in the exported data was probably related to the dictionary export routine, which was located within the device loop by mistake. This was corrected, so the dictionary export is only done at the very end when all output files are generated.