Skip to content

Commit 1806046

Browse files
committed
init
0 parents  commit 1806046

22 files changed

+2238
-0
lines changed

.bandit.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
tests:
3+
- B103
4+
- B108
5+
- B306
6+
- B307
7+
- B313
8+
- B314
9+
- B315
10+
- B316
11+
- B317
12+
- B318
13+
- B319
14+
- B320
15+
- B325
16+
- B601
17+
- B602
18+
- B604
19+
- B608
20+
- B609

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
ignore = E203, E266, E501, F811, W503
3+
max-line-length = 80
4+
max-complexity = 18
5+
select = B,C,E,F,W,T4,B9
6+
exclude = .git,__pycache__,.venv,docs/source/conf.py,old,build,dist

.gitignore

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/

.pre-commit-config.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
repos:
3+
- repo: https://github.com/PyCQA/bandit
4+
rev: 1.6.2
5+
hooks:
6+
- id: bandit
7+
args:
8+
- --quiet
9+
- --format=custom
10+
- --configfile=.bandit.yaml
11+
files: ^pyhilo/.+\.py$
12+
- repo: https://github.com/python/black
13+
rev: 21.7b0
14+
hooks:
15+
- id: black
16+
args:
17+
- --safe
18+
- --quiet
19+
language_version: python3
20+
files: ^((pyhilo|tests)/.+)?[^/]+\.py$
21+
- repo: https://github.com/codespell-project/codespell
22+
rev: v1.16.0
23+
hooks:
24+
- id: codespell
25+
args:
26+
- --skip="./.*,*.json"
27+
- --quiet-level=4
28+
- -L ba,celcius
29+
exclude_types: [json]
30+
- repo: https://gitlab.com/pycqa/flake8
31+
rev: 4.0.1
32+
hooks:
33+
- id: flake8
34+
additional_dependencies:
35+
- flake8-docstrings==1.5.0
36+
- pydocstyle==5.0.1
37+
files: ^pyhilo/.+\.py$
38+
- repo: https://github.com/pre-commit/mirrors-isort
39+
rev: v4.3.21
40+
hooks:
41+
- id: isort
42+
additional_dependencies:
43+
- toml
44+
files: ^(pyhilo|tests)/.+\.py$
45+
- repo: https://github.com/pre-commit/mirrors-mypy
46+
rev: v0.920
47+
hooks:
48+
- id: mypy
49+
files: ^pyhilo/.+\.py$
50+
additional_dependencies:
51+
- types-python-dateutil==2.8.0
52+
53+
- repo: https://github.com/pre-commit/pre-commit-hooks
54+
rev: v2.4.0
55+
hooks:
56+
- id: check-json
57+
- id: no-commit-to-branch
58+
args:
59+
- --branch=dev
60+
- --branch=master
61+
# - repo: https://github.com/PyCQA/pydocstyle
62+
# rev: 5.0.2
63+
# hooks:
64+
# - id: pydocstyle
65+
# files: ^((pyhilo|tests)/.+)?[^/]+\.py$
66+
- repo: https://github.com/gruntwork-io/pre-commit
67+
rev: v0.1.12
68+
hooks:
69+
- id: shellcheck
70+
files: ^script/.+

LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <https://unlicense.org>

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# python-hilo
2+
3+
`python-hilo` (aka `pyhilo`) is a Python 3.9, `asyncio`-driven interface to the unofficial
4+
Hilo API from Hydro Quebec. This is meant to be integrated into Home Assistant.
5+
6+
Nothing is fully functional right now except for the PoC. Before this package, the Hilo API
7+
was returning all information via some REST calls. Since the end of 2021, Hilo has deprecated
8+
some of the endpoints including the ones that returns the status of the devices. This was
9+
replaced with a websocket system using Google Firebase.
10+
11+
## Running the PoC
12+
13+
```
14+
$ python -m virtualenv .venv
15+
$ source .venv/bin/activate
16+
$ pip install -r requirements.txt
17+
$ cat << EOF > .env
18+
export hilo_username="moi@gmail.com"
19+
export hilo_password="secretpassword"
20+
$ source .env
21+
$ ./test.py
22+
```
23+
24+
## TODO
25+
- Creating device classes for each types and map similarly to HA
26+
- Light switches and dimmers
27+
- Gateway
28+
- Power Sensors
29+
- Hilo Challenge events
30+
- Type everything: almost done, got a few "type: ignore" to fix
31+
- Home Assistant component integration
32+
- Publish this package
33+
34+
## Later?
35+
- Full docstrings and doc generation
36+
- Unit testing
37+
- Functional testing
38+
39+
If anyone wants to contribute, feel free to submit a PR. If you'd like to sync up first, you can
40+
fire me an email me@dvd.dev

pyhilo/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Define the hilo package."""
2+
from pyhilo.api import API # noqa
3+
from pyhilo.hilo import Hilo # noqa

0 commit comments

Comments
 (0)