cmroche / greeclimate

Python package for controlling Gree based minisplit systems
GNU General Public License v3.0
44 stars 22 forks source link

Fix push_state_update to only clear dirty properties on success #109

Open mlesniew opened 1 month ago

mlesniew commented 1 month ago

The Device.push_state_update method only pushes values of properties, which were actually changed. This is tracked using the _dirty instance variable.

So far, the _dirty flag was cleared unconditionally, before sending messages to the AC. This commit makes sure it is done only after successfully sending the message. In case of errors, the _dirty state will be preserved, so a subsequent call to push_state_update will re-attempt sending the same properties.

codecov[bot] commented 1 month ago

Codecov Report

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

Project coverage is 95.75%. Comparing base (7122cdd) to head (7347cf7). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #109 +/- ## ======================================= Coverage 95.75% 95.75% ======================================= Files 8 8 Lines 730 730 ======================================= Hits 699 699 Misses 31 31 ```

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