aiounifi icon indicating copy to clipboard operation
aiounifi copied to clipboard

Support incremental device information updates

Open J3173 opened this issue 2 years ago • 1 comments

device:sync messages are only send out when a UniFi device is in the Online state.

This implements the device:update message so device information is updated when a device is in another state, e.g. Updating. This is needed to display up-to-date state of the device in Home Assistant when the device is updating.

The data in device:update contains only the fields that are modified since the previous device:sync or device:update message. This PR adds a new incremental_update method to the APIItem class which updates the exiting raw data with the newly received information.

This PR also modifies existing tests to deepcopy the fixture data when calling process_raw or setting websocket._data to prevent accidental modifying the fixture data.

Tested with UniFi Network Application version 7.1.66.

J3173 avatar Jun 18 '22 09:06 J3173

Awesome!

I'm doing some streamlining and improvements with internal signalling (https://github.com/Kane610/aiounifi/pull/134) which will break this. I'm working on these to better scale changes in the future. Im gonna try to get it done this weekend to not block you too much. Feedback is appreciated.

Kane610 avatar Jun 18 '22 11:06 Kane610