Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor how data is shared by API, systems, and entities #193

Merged
merged 3 commits into from
Oct 20, 2020
Merged

Conversation

bachya
Copy link
Owner

@bachya bachya commented Oct 20, 2020

Describe what the PR does:

This PR is way larger than it should be, FYI, but it was necessary to accommodate the scope of the changes I wanted.

I recently came to the conclusion that the interdependencies between the API, the system, and the entity were a mess: copies of data were being shared all over the place, it wasn't clear which object was responsible for what, and I felt anxious every time I had to look at it. 😆 So, this PR unwinds things and makes data responsibilities clearer:

  • The API is responsible for subscription data. System and entity properties/methods that need this data have references to it in the API object, meaning that updates to the API data will automatically carry through to the necessary points in systems and entities.
  • System objects are responsible for system, settings, and entity data. It, too, shares this data appropriately with entities so they can be automatically updated upon data updates.
  • Cameras are split out from entities, as they don't have enough in common to suggest inheritance.
  • Adds camera documentation that was missed in Added support to expose camera and doorbell data #182.

Does this fix a specific issue?

N/A

Checklist:

  • Confirm that one or more new tests are written for the new functionality.
  • Run tests and ensure everything passes (with 100% test coverage).
  • Update README.md and docs/ with any new documentation.
  • Add yourself to AUTHORS.md.

@codecov
Copy link

codecov bot commented Oct 20, 2020

Codecov Report

Merging #193 into dev will increase coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##              dev      #193      +/-   ##
===========================================
+ Coverage   99.84%   100.00%   +0.15%     
===========================================
  Files          12        13       +1     
  Lines         650       685      +35     
===========================================
+ Hits          649       685      +36     
+ Misses          1         0       -1     
Impacted Files Coverage Δ
simplipy/api.py 100.00% <100.00%> (+0.73%) ⬆️
simplipy/camera.py 100.00% <100.00%> (ø)
simplipy/entity/__init__.py 100.00% <100.00%> (ø)
simplipy/entity/factory.py 100.00% <100.00%> (ø)
simplipy/lock.py 100.00% <100.00%> (ø)
simplipy/sensor/v2.py 100.00% <100.00%> (ø)
simplipy/sensor/v3.py 100.00% <100.00%> (ø)
simplipy/system/v2.py 100.00% <100.00%> (ø)
simplipy/system/v3.py 100.00% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb71449...f15d766. Read the comment docs.

@codeclimate
Copy link

codeclimate bot commented Oct 20, 2020

Code Climate has analyzed commit f15d766 and detected 0 issues on this pull request.

View more on Code Climate.

@bachya bachya self-assigned this Oct 20, 2020
@bachya bachya added the maintenance Generic library tasks label Oct 20, 2020
@bachya bachya merged commit b985637 into dev Oct 20, 2020
@bachya bachya deleted the rearch branch October 20, 2020 16:25
@bachya bachya mentioned this pull request Oct 21, 2020
4 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
maintenance Generic library tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant