zigpy / zha

Zigbee Home Automation
Apache License 2.0
10 stars 4 forks source link

Reduce the number of polling tasks #21

Closed dmulcahey closed 3 months ago

dmulcahey commented 3 months ago

This PR creates 2 helpers that are used to reduce the overhead needed to refresh polling things.

GlobalUpdater is added to refresh things that need to update from local state (non async). DeviceCounterSensor, RSSISensor and LQISensor are currently using this. These should be updated to leverage events or callbacks once zigpy provides the appropriate feedback mechanism.

DeviceAvailabilityChecker is added to periodically check the available state of a device

a new flag was also added to Device that tracks whether or not a device is on the network

fixes #9 fixes #10

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.55%. Comparing base (db12f68) to head (89fd3cd).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #21 +/- ## ========================================== + Coverage 93.50% 93.55% +0.05% ========================================== Files 61 61 Lines 9330 9409 +79 ========================================== + Hits 8724 8803 +79 Misses 606 606 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.