kingsleyadam / local-abbfreeathome

A Python Package for interacting with the ABB (Busch Jaeger) Free@Home System via the Local API
MIT License
3 stars 2 forks source link

Optimize callbacks to reduce noise #38

Closed kingsleyadam closed 4 days ago

kingsleyadam commented 4 days ago

While implementing a new device I noticed a few things that could be improved in the Base class.

This PR adds new classes _refresh_state_from_output and _refresh_state_from_input to handle the state updates and only call the callbacks if the state was actually updated. I've moved the update_device logic to the Base class as that logic is generally the same between devices, but can be overwritten. Adds an additional test to test the scenario where the websocket would send a device update that doesn't affect the state of the device.