palazzem / econnect-python

API adapter used to control programmatically an Elmo alarm system
BSD 3-Clause "New" or "Revised" License
8 stars 5 forks source link

Refactor global status check() #48

Closed palazzem closed 4 years ago

palazzem commented 4 years ago

Overview

This PR is a major refactoring that removes beautifulsoup4 in favor of (undocumented) Elmo's API. This is considered a breaking change because it alters the output of client.check(). Main changes are:

After

{ "sectors_armed": [{"id": 0, "name": "Entryway", "element": 1, "index": 0}, ...], "sectors_disarmed": [{"id": 1, "name": "Kitchen", "element": 2, "index": 1}, ...], "inputs_alerted": [{"id": 0, "name": "Door", "element": 3, "index": 0}, ...], "inputs_wait": [{"id": 1, "name": "Window", "element": 4, "index": 1}, ...], }


* Add `client._query(query)` that queries Elmo System to retrieve entries (sectors or inputs). The query method is generic, and must be used via `elmo.query` module
* Sectors and inputs descriptions are cached using the `client._get_descriptions`
codecov-io commented 4 years ago

Codecov Report

Merging #48 into master will not change coverage by %. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #48   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10         9    -1     
  Lines          229       236    +7     
=========================================
+ Hits           229       236    +7     
Impacted Files Coverage Δ
elmo/api/client.py 100.00% <100.00%> (ø)
elmo/api/exceptions.py 100.00% <100.00%> (ø)
elmo/api/router.py 100.00% <100.00%> (ø)
elmo/query.py 100.00% <100.00%> (ø)

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 4def837...a93ede7. Read the comment docs.