thomluther / anker-solix-api

Python library for Anker Solix API
MIT License
74 stars 15 forks source link

Site Update is removing stand alone devices from api dicts #77

Closed thomluther closed 6 months ago

thomluther commented 6 months ago

A site Update is removing all devices from the API devices dict which are not boundary to a site. This is done to avoid keeping orphaned device info in Api dict. However, that means stand alone devices are cleared even if the are available for account owners. Orphaned devices need to be cleaned by device Update Routine.

thomluther commented 6 months ago

The active devices per account is a combination of devices listed in scene_info query for a site and devices listed for bind_devices. The cleanup of orphaned devices was moved from the update_sites method (which is now just saving the active devices in a set) to the get_bind_devices method, that is called at the beginning of the device details method. The get_bind_device method adds all listed devices with details to the api devices dict. After this step, the combination of recorded active site devices and reported bind devices form the overall device list managed by the account. Any device not contained in that combined list will be removed from the api devices dict.