smartbox 2.0.0b2__tar.gz → 2.1.0b2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smartbox-2.1.0b2/.github/dependabot.yml +19 -0
- smartbox-2.1.0b2/.github/workflows/publish-to-pypi.yml +31 -0
- smartbox-2.1.0b2/.github/workflows/python-package.yml +83 -0
- smartbox-2.1.0b2/.gitignore +72 -0
- smartbox-2.1.0b2/.pre-commit-config.yaml +29 -0
- smartbox-2.1.0b2/.vscode/settings.json +7 -0
- smartbox-2.1.0b2/CHANGELOG.md +39 -0
- smartbox-2.1.0b2/CODEOWNERS +5 -0
- smartbox-2.1.0b2/PKG-INFO +179 -0
- smartbox-2.0.0b2/smartbox.egg-info/PKG-INFO → smartbox-2.1.0b2/README.md +84 -31
- smartbox-2.1.0b2/api-notes.md +141 -0
- smartbox-2.1.0b2/codecov.yml +10 -0
- smartbox-2.1.0b2/pyproject.toml +137 -0
- smartbox-2.1.0b2/requirements.txt +2 -0
- smartbox-2.1.0b2/src/smartbox/__init__.py +48 -0
- smartbox-2.1.0b2/src/smartbox/cmd.py +391 -0
- smartbox-2.1.0b2/src/smartbox/error.py +19 -0
- smartbox-2.1.0b2/src/smartbox/models.py +218 -0
- smartbox-2.1.0b2/src/smartbox/resailer.py +133 -0
- smartbox-2.1.0b2/src/smartbox/session.py +556 -0
- {smartbox-2.0.0b2 → smartbox-2.1.0b2/src}/smartbox/socket.py +72 -47
- {smartbox-2.0.0b2 → smartbox-2.1.0b2/src}/smartbox/update_manager.py +95 -49
- smartbox-2.1.0b2/tests/__init__.py +0 -0
- smartbox-2.1.0b2/tests/common.py +17 -0
- smartbox-2.1.0b2/tests/conftest.py +102 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device1/acm/1/samples.json +2839 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device1/acm/1/setup.json +40 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device1/acm/1/status.json +24 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device1/htr/0/samples.json +2839 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device1/htr/0/setup.json +40 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device1/htr/0/status.json +24 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device1/htr_system/power_limit.json +1 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device1/mgr/away_status.json +1 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device1/mgr/nodes.json +18 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/0/samples.json +2839 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/0/setup.json +40 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/0/status.json +24 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/1/samples.json +1 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/1/setup.json +40 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/1/status.json +24 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/2/samples.json +1 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/2/setup.json +40 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/2/status.json +24 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/3/samples.json +1 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/3/setup.json +40 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/3/status.json +24 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/4/samples.json +1 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/4/setup.json +40 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/4/status.json +24 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/5/samples.json +1 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/5/setup.json +40 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_mod/5/status.json +24 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/htr_system/power_limit.json +1 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/mgr/away_status.json +1 -0
- smartbox-2.1.0b2/tests/fixtures/devs/device2/mgr/nodes.json +46 -0
- smartbox-2.1.0b2/tests/fixtures/devs.json +19 -0
- smartbox-2.1.0b2/tests/fixtures/grouped_devs.json +24 -0
- smartbox-2.1.0b2/tests/fixtures/test_path.json +1 -0
- smartbox-2.1.0b2/tests/test_cmd.py +347 -0
- smartbox-2.1.0b2/tests/test_models.py +252 -0
- smartbox-2.1.0b2/tests/test_resailer.py +46 -0
- smartbox-2.1.0b2/tests/test_session.py +1350 -0
- smartbox-2.1.0b2/tests/test_update_manager.py +208 -0
- smartbox-2.1.0b2/tox.ini +14 -0
- smartbox-2.1.0b2/uv.lock +1025 -0
- smartbox-2.0.0b2/PKG-INFO +0 -104
- smartbox-2.0.0b2/README.md +0 -89
- smartbox-2.0.0b2/pyproject.toml +0 -6
- smartbox-2.0.0b2/setup.cfg +0 -74
- smartbox-2.0.0b2/smartbox/__init__.py +0 -6
- smartbox-2.0.0b2/smartbox/cmd.py +0 -227
- smartbox-2.0.0b2/smartbox/error.py +0 -4
- smartbox-2.0.0b2/smartbox/session.py +0 -207
- smartbox-2.0.0b2/smartbox.egg-info/SOURCES.txt +0 -24
- smartbox-2.0.0b2/smartbox.egg-info/dependency_links.txt +0 -1
- smartbox-2.0.0b2/smartbox.egg-info/entry_points.txt +0 -2
- smartbox-2.0.0b2/smartbox.egg-info/not-zip-safe +0 -1
- smartbox-2.0.0b2/smartbox.egg-info/requires.txt +0 -6
- smartbox-2.0.0b2/smartbox.egg-info/top_level.txt +0 -1
- smartbox-2.0.0b2/tests/test_cmd.py +0 -373
- smartbox-2.0.0b2/tests/test_session.py +0 -266
- smartbox-2.0.0b2/tests/test_socket.py +0 -337
- smartbox-2.0.0b2/tests/test_update_manager.py +0 -243
- smartbox-2.0.0b2/tests/test_update_manager_benchmark.py +0 -41
- smartbox-2.0.0b2/tests/test_version.py +0 -6
- {smartbox-2.0.0b2 → smartbox-2.1.0b2}/LICENSE +0 -0
- {smartbox-2.0.0b2 → smartbox-2.1.0b2/src}/smartbox/py.typed +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "github-actions"
|
|
9
|
+
directory: "/"
|
|
10
|
+
schedule:
|
|
11
|
+
# Check for updates to GitHub Actions every weekday
|
|
12
|
+
interval: "daily"
|
|
13
|
+
|
|
14
|
+
- package-ecosystem: "pip" # See documentation for possible values
|
|
15
|
+
directory: "/" # Location of package manifests
|
|
16
|
+
schedule:
|
|
17
|
+
interval: "weekly"
|
|
18
|
+
# Check for pip updates on Sundays
|
|
19
|
+
day: "sunday"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Publish 📦 to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
env:
|
|
8
|
+
PYTHON_VERSION: 3.12
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build-n-publish:
|
|
12
|
+
name: Build and publish 📦 to PyPI
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
24
|
+
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
|
25
|
+
uses: actions/setup-python@v5.4.0
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
28
|
+
- name: Build a binary wheel and a source tarball
|
|
29
|
+
run: uv build
|
|
30
|
+
- name: Publish 📦 to PyPI
|
|
31
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
3
|
+
|
|
4
|
+
name: Python package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
pull_request:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
|
|
12
|
+
linter:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
max-parallel: 4
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: [3.12, 3.13]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
25
|
+
uses: actions/setup-python@v5.4.0
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
- name: Install the project
|
|
29
|
+
run: uv sync --all-extras --dev
|
|
30
|
+
- name: Lint with ruff
|
|
31
|
+
run: uv run ruff check src/smartbox
|
|
32
|
+
|
|
33
|
+
typechecker:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
strategy:
|
|
36
|
+
max-parallel: 1
|
|
37
|
+
matrix:
|
|
38
|
+
python-version: [3.12, 3.13]
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
- name: Install uv
|
|
43
|
+
uses: astral-sh/setup-uv@v5
|
|
44
|
+
with:
|
|
45
|
+
python-version: ${{ matrix.python-version }}
|
|
46
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
47
|
+
uses: actions/setup-python@v5.4.0
|
|
48
|
+
with:
|
|
49
|
+
python-version: ${{ matrix.python-version }}
|
|
50
|
+
- name: Install the project
|
|
51
|
+
run: uv sync --all-extras --dev
|
|
52
|
+
- name: Typecheck with mypy
|
|
53
|
+
run: uv run mypy src/smartbox
|
|
54
|
+
|
|
55
|
+
build:
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
strategy:
|
|
58
|
+
max-parallel: 4
|
|
59
|
+
matrix:
|
|
60
|
+
python-version: [3.12, 3.13]
|
|
61
|
+
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v4
|
|
64
|
+
- name: Install uv
|
|
65
|
+
uses: astral-sh/setup-uv@v5
|
|
66
|
+
with:
|
|
67
|
+
python-version: ${{ matrix.python-version }}
|
|
68
|
+
|
|
69
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
70
|
+
uses: actions/setup-python@v5.4.0
|
|
71
|
+
with:
|
|
72
|
+
python-version: ${{ matrix.python-version }}
|
|
73
|
+
- name: Install the project
|
|
74
|
+
run: |
|
|
75
|
+
uv sync --all-extras --dev
|
|
76
|
+
tox -e py
|
|
77
|
+
- name: "Upload coverage to Codecov"
|
|
78
|
+
uses: codecov/codecov-action@v5
|
|
79
|
+
with:
|
|
80
|
+
fail_ci_if_error: true
|
|
81
|
+
- name: Upload test results to Codecov
|
|
82
|
+
if: ${{ !cancelled() }}
|
|
83
|
+
uses: codecov/test-results-action@v1
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# VSCode
|
|
2
|
+
.vscode/*
|
|
3
|
+
!.vscode/settings.json
|
|
4
|
+
!.vscode/tasks.json
|
|
5
|
+
!.vscode/extensions.json
|
|
6
|
+
!.vscode/*.code-snippets
|
|
7
|
+
|
|
8
|
+
# Byte-compiled / optimized / DLL files
|
|
9
|
+
__pycache__/
|
|
10
|
+
*.py[cod]
|
|
11
|
+
*$py.class
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
pip-wheel-metadata/
|
|
28
|
+
share/python-wheels/
|
|
29
|
+
*.egg-info/
|
|
30
|
+
.installed.cfg
|
|
31
|
+
*.egg
|
|
32
|
+
MANIFEST
|
|
33
|
+
|
|
34
|
+
# PyInstaller
|
|
35
|
+
# Usually these files are written by a python script from a template
|
|
36
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
37
|
+
*.manifest
|
|
38
|
+
*.spec
|
|
39
|
+
|
|
40
|
+
# Installer logs
|
|
41
|
+
pip-log.txt
|
|
42
|
+
pip-delete-this-directory.txt
|
|
43
|
+
|
|
44
|
+
# Unit test / coverage reports
|
|
45
|
+
htmlcov/
|
|
46
|
+
.tox/
|
|
47
|
+
.nox/
|
|
48
|
+
.coverage
|
|
49
|
+
.coverage.*
|
|
50
|
+
.cache
|
|
51
|
+
nosetests.xml
|
|
52
|
+
coverage.xml
|
|
53
|
+
*.cover
|
|
54
|
+
*.py,cover
|
|
55
|
+
.hypothesis/
|
|
56
|
+
.pytest_cache/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Environments
|
|
63
|
+
.direnv
|
|
64
|
+
.env
|
|
65
|
+
.venv
|
|
66
|
+
env/
|
|
67
|
+
venv/
|
|
68
|
+
ENV/
|
|
69
|
+
env.bak/
|
|
70
|
+
venv.bak/
|
|
71
|
+
junit.xml
|
|
72
|
+
.DS_Store
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
|
|
3
|
+
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
4
|
+
# uv version.
|
|
5
|
+
rev: 0.5.26
|
|
6
|
+
hooks:
|
|
7
|
+
# Update the uv lockfile
|
|
8
|
+
- id: uv-lock
|
|
9
|
+
|
|
10
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
11
|
+
rev: v5.0.0
|
|
12
|
+
hooks:
|
|
13
|
+
- id: trailing-whitespace
|
|
14
|
+
- id: end-of-file-fixer
|
|
15
|
+
- id: check-yaml
|
|
16
|
+
- id: debug-statements
|
|
17
|
+
- id: check-ast
|
|
18
|
+
- id: check-merge-conflict
|
|
19
|
+
- id: pretty-format-json
|
|
20
|
+
args:
|
|
21
|
+
- "--autofix"
|
|
22
|
+
- "--indent=4"
|
|
23
|
+
|
|
24
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
25
|
+
rev: v0.9.4
|
|
26
|
+
hooks:
|
|
27
|
+
- id: ruff
|
|
28
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
29
|
+
- id: ruff-format
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.0.5 (alpha)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
* Rename `away_status` to `device_away_status`
|
|
7
|
+
* Update API docs
|
|
8
|
+
* Add tox, tox and flake8 on github action
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
* Pin dependency of python-socketio to match server
|
|
12
|
+
|
|
13
|
+
## 0.0.4 (alpha)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
* Refactor socket session and implement reconnect
|
|
17
|
+
* Add note on basic auth credentials
|
|
18
|
+
|
|
19
|
+
## 0.0.3 (alpha)
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
* Fixed packaging
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
* Fixed disconnect handling on token refresh
|
|
26
|
+
|
|
27
|
+
## 0.0.2 (alpha)
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
* Added `get_api_name` function
|
|
31
|
+
* Added basic tests for REST interactions
|
|
32
|
+
* Added token refresh support
|
|
33
|
+
* Added socket.io interface via `open_socket` function (no tests as yet)
|
|
34
|
+
* Added documentation for known REST and websocket endpoints
|
|
35
|
+
|
|
36
|
+
## 0.0.1 (alpha)
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
* Initial version supporting some REST endpoints
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: smartbox
|
|
3
|
+
Version: 2.1.0b2
|
|
4
|
+
Summary: Python API to control heating 'smart boxes'
|
|
5
|
+
Project-URL: Homepage, https://github.com/delmael/smartbox
|
|
6
|
+
Project-URL: Issues, https://github.com/delmael/smartbox/issues
|
|
7
|
+
Author-email: Delmael <delmael@outlook.com>, graham33 <graham@grahambennett.org>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.12
|
|
14
|
+
Requires-Dist: aiohttp>=3.11.11
|
|
15
|
+
Requires-Dist: asyncclick>=8.1.8
|
|
16
|
+
Requires-Dist: jq>=1.8.0
|
|
17
|
+
Requires-Dist: pydantic==2.10.4
|
|
18
|
+
Requires-Dist: python-socketio==5.12.1
|
|
19
|
+
Requires-Dist: requests>=2.32.3
|
|
20
|
+
Requires-Dist: websocket-client>=1.8.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# smartbox  [](https://badge.fury.io/py/smartbox) [](https://codecov.io/gh/delmael/smartbox) [](https://pypi.python.org/pypi/smartbox/) [](https://pypi.python.org/pypi/smartbox/)
|
|
24
|
+
|
|
25
|
+
Python API to control heating Haverland 'smart boxes'
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
To install pyatmo simply run:
|
|
32
|
+
|
|
33
|
+
pip install smartbox
|
|
34
|
+
|
|
35
|
+
Depending on your permissions you might be required to use sudo.
|
|
36
|
+
Once installed you can simply add `smartbox` to your Python 3 scripts by including:
|
|
37
|
+
|
|
38
|
+
import smartbox
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## `smartbox` Command Line Tool
|
|
43
|
+
### Mandatory options
|
|
44
|
+
You can use the `smartbox` tool to get status information from your heaters
|
|
45
|
+
(nodes) and change settings.
|
|
46
|
+
|
|
47
|
+
A few common options are required for all commands:
|
|
48
|
+
* `-u`/`--username`: Your username as used for the mobile app/web app.
|
|
49
|
+
* `-p`/`--password`: Your password as used for the mobile app/web app.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
Verbose logging can be enabled with the `-v`/`--verbose` flag.
|
|
53
|
+
|
|
54
|
+
### Optional options
|
|
55
|
+
These options are useful if your resailer is not configured.
|
|
56
|
+
|
|
57
|
+
* `-b`/`--base-auth-creds`: An HTTP Basic Auth credential used to do initial
|
|
58
|
+
authentication with the server. Use the base64 encoded string directly. See
|
|
59
|
+
'Basic Auth Credential' section below for more details.
|
|
60
|
+
* `-a`/`--api-name`: The API name for your heater vendor. This is visible in
|
|
61
|
+
the 'API Host' entry in the 'Version' menu item in the mobile app/web app. If
|
|
62
|
+
the host name is of the form `api-foo.xxxx` or `api.xxxx` use the values
|
|
63
|
+
`api-foo` or `api` respectively. The resailer has to be declared in the package.
|
|
64
|
+
* `-r`/`--x-referer`: The referer of your request.
|
|
65
|
+
* `-i`/`--x-serial-id`: The serial-id of your request.
|
|
66
|
+
|
|
67
|
+
## Availables commands
|
|
68
|
+
### Listing smartbox devices
|
|
69
|
+
|
|
70
|
+
smartbox <auth options...> devices
|
|
71
|
+
|
|
72
|
+
### Listing smartbox nodes
|
|
73
|
+
The `nodes` command lists nodes across all devices.
|
|
74
|
+
|
|
75
|
+
smartbox <auth options...> nodes
|
|
76
|
+
|
|
77
|
+
### Getting node status
|
|
78
|
+
The `status` command lists status across all nodes and devices.
|
|
79
|
+
|
|
80
|
+
smartbox <auth options...> status
|
|
81
|
+
|
|
82
|
+
### Setting node status
|
|
83
|
+
The `set-status` command can be used to change a status item on a particular
|
|
84
|
+
node.
|
|
85
|
+
|
|
86
|
+
smartbox <auth options...> set-status <-d/--device-id> <device id> <-n/--node-addr> <node> <name>=<value> [<name>=<value> ...]
|
|
87
|
+
|
|
88
|
+
### Getting node setup
|
|
89
|
+
The `setup` command lists setup across all nodes and devices.
|
|
90
|
+
|
|
91
|
+
smartbox <auth options...> setup
|
|
92
|
+
|
|
93
|
+
### Setting node setup
|
|
94
|
+
The `set-setup` command can be used to change a setup item on a particular
|
|
95
|
+
node.
|
|
96
|
+
|
|
97
|
+
smartbox <auth options...> set-setup <-d/--device-id> <device id> <-n/--node-addr> <node> <name>=<value> [<name>=<value> ...]
|
|
98
|
+
|
|
99
|
+
### Setting node samples
|
|
100
|
+
|
|
101
|
+
The `node-samples` command can be used to get the historical data (temperature and consumption) of a node.
|
|
102
|
+
|
|
103
|
+
smartbox <auth options...> node-samples <-d/--device-id> <device id> <-n/--node-addr> <node> <-s/--start-time> <start time> <-e/--end-time> <end time>
|
|
104
|
+
|
|
105
|
+
### Getting device away status
|
|
106
|
+
The `device-away-status` command lists the away status across all devices.
|
|
107
|
+
|
|
108
|
+
smartbox <auth options...> device-away-status
|
|
109
|
+
|
|
110
|
+
### Setting device away status
|
|
111
|
+
The `set-device-away-status` command can be used to change the away status on a
|
|
112
|
+
particular device.
|
|
113
|
+
|
|
114
|
+
smartbox <auth options...> set-device-away-status <-d/--device-id> <device id> <name>=<value> [<name>=<value> ...]
|
|
115
|
+
|
|
116
|
+
### Getting device power limit
|
|
117
|
+
The `device-power-limit` command lists the power limit (in watts) across all
|
|
118
|
+
devices.
|
|
119
|
+
|
|
120
|
+
smartbox <auth options...> device-power-limit
|
|
121
|
+
|
|
122
|
+
### Setting device power limit
|
|
123
|
+
The `set-device-power-limit` command can be used to change the power limit (in
|
|
124
|
+
watts) on a particular device.
|
|
125
|
+
|
|
126
|
+
smartbox <auth options...> set-device-power-limit <-d/--device-id> <device id> <limit>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Health check
|
|
130
|
+
The `health-check` command can be used to know if the API is alived
|
|
131
|
+
|
|
132
|
+
smartbox <auth options...> health-check
|
|
133
|
+
|
|
134
|
+
### List available resailers
|
|
135
|
+
The `resailers` command can be used to know which resailershas an automatic configuration.
|
|
136
|
+
If your resailer is not present you can raise an issue in github, or use the optional options.
|
|
137
|
+
|
|
138
|
+
smartbox <auth options...> resailers
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
See [api-notes.md](./api-notes.md) for notes on REST and socket.io endpoints.
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
Prerequisites:
|
|
148
|
+
|
|
149
|
+
uv
|
|
150
|
+
python >=3.12
|
|
151
|
+
|
|
152
|
+
Clone the repo, install dependencies and install pre-commit hooks:
|
|
153
|
+
|
|
154
|
+
git clone
|
|
155
|
+
cd smartbox
|
|
156
|
+
uv sync
|
|
157
|
+
pre-commit install
|
|
158
|
+
|
|
159
|
+
## Testing
|
|
160
|
+
|
|
161
|
+
To run the full suite simply run the following command from within the virtual environment:
|
|
162
|
+
|
|
163
|
+
pytest
|
|
164
|
+
|
|
165
|
+
or
|
|
166
|
+
|
|
167
|
+
python -m pytest tests/
|
|
168
|
+
|
|
169
|
+
To generate code coverage xml (e.g. for use in VSCode) run
|
|
170
|
+
|
|
171
|
+
python -m pytest --cov-report xml:cov.xml --cov smartbox --cov-append tests/
|
|
172
|
+
|
|
173
|
+
Another way to run the tests is by using `tox`. This runs the tests against the installed package and multiple versions of python.
|
|
174
|
+
|
|
175
|
+
tox
|
|
176
|
+
|
|
177
|
+
or by specifying a python version
|
|
178
|
+
|
|
179
|
+
tox -e py312
|
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Summary: Python API to control heating 'smart boxes'
|
|
5
|
-
Home-page: https://github.com/graham33/smartbox
|
|
6
|
-
Author: Graham Bennett
|
|
7
|
-
Author-email: graham@grahambennett.org
|
|
8
|
-
Project-URL: Bug Tracker, https://github.com/graham33/smartbox/issues
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.9
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE
|
|
15
|
-
|
|
16
|
-
# smartbox  [](https://badge.fury.io/py/smartbox) [](https://codecov.io/gh/graham33/smartbox) [](https://pypi.python.org/pypi/smartbox/) [](https://pypi.python.org/pypi/smartbox/)
|
|
17
|
-
|
|
18
|
-
Python API to control heating 'smart boxes'
|
|
1
|
+
# smartbox  [](https://badge.fury.io/py/smartbox) [](https://codecov.io/gh/delmael/smartbox) [](https://pypi.python.org/pypi/smartbox/) [](https://pypi.python.org/pypi/smartbox/)
|
|
2
|
+
|
|
3
|
+
Python API to control heating Haverland 'smart boxes'
|
|
19
4
|
|
|
20
5
|
## Installation
|
|
21
6
|
|
|
22
|
-
Install
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
To install pyatmo simply run:
|
|
23
10
|
|
|
24
11
|
pip install smartbox
|
|
25
12
|
|
|
13
|
+
Depending on your permissions you might be required to use sudo.
|
|
14
|
+
Once installed you can simply add `smartbox` to your Python 3 scripts by including:
|
|
15
|
+
|
|
16
|
+
import smartbox
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
26
20
|
## `smartbox` Command Line Tool
|
|
21
|
+
### Mandatory options
|
|
27
22
|
You can use the `smartbox` tool to get status information from your heaters
|
|
28
23
|
(nodes) and change settings.
|
|
29
24
|
|
|
30
25
|
A few common options are required for all commands:
|
|
31
|
-
* `-a`/`--api-name`: The API name for your heater vendor. This is visible in
|
|
32
|
-
the 'API Host' entry in the 'Version' menu item in the mobile app/web app. If
|
|
33
|
-
the host name is of the form `api-foo.xxxx` or `api.xxxx` use the values
|
|
34
|
-
`api-foo` or `api` respectively.
|
|
35
26
|
* `-u`/`--username`: Your username as used for the mobile app/web app.
|
|
36
27
|
* `-p`/`--password`: Your password as used for the mobile app/web app.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Verbose logging can be enabled with the `-v`/`--verbose` flag.
|
|
31
|
+
|
|
32
|
+
### Optional options
|
|
33
|
+
These options are useful if your resailer is not configured.
|
|
34
|
+
|
|
37
35
|
* `-b`/`--base-auth-creds`: An HTTP Basic Auth credential used to do initial
|
|
38
36
|
authentication with the server. Use the base64 encoded string directly. See
|
|
39
37
|
'Basic Auth Credential' section below for more details.
|
|
38
|
+
* `-a`/`--api-name`: The API name for your heater vendor. This is visible in
|
|
39
|
+
the 'API Host' entry in the 'Version' menu item in the mobile app/web app. If
|
|
40
|
+
the host name is of the form `api-foo.xxxx` or `api.xxxx` use the values
|
|
41
|
+
`api-foo` or `api` respectively. The resailer has to be declared in the package.
|
|
42
|
+
* `-r`/`--x-referer`: The referer of your request.
|
|
43
|
+
* `-i`/`--x-serial-id`: The serial-id of your request.
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
## Availables commands
|
|
43
46
|
### Listing smartbox devices
|
|
44
47
|
|
|
45
48
|
smartbox <auth options...> devices
|
|
@@ -71,6 +74,12 @@ node.
|
|
|
71
74
|
|
|
72
75
|
smartbox <auth options...> set-setup <-d/--device-id> <device id> <-n/--node-addr> <node> <name>=<value> [<name>=<value> ...]
|
|
73
76
|
|
|
77
|
+
### Setting node samples
|
|
78
|
+
|
|
79
|
+
The `node-samples` command can be used to get the historical data (temperature and consumption) of a node.
|
|
80
|
+
|
|
81
|
+
smartbox <auth options...> node-samples <-d/--device-id> <device id> <-n/--node-addr> <node> <-s/--start-time> <start time> <-e/--end-time> <end time>
|
|
82
|
+
|
|
74
83
|
### Getting device away status
|
|
75
84
|
The `device-away-status` command lists the away status across all devices.
|
|
76
85
|
|
|
@@ -94,11 +103,55 @@ watts) on a particular device.
|
|
|
94
103
|
|
|
95
104
|
smartbox <auth options...> set-device-power-limit <-d/--device-id> <device id> <limit>
|
|
96
105
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
|
|
107
|
+
### Health check
|
|
108
|
+
The `health-check` command can be used to know if the API is alived
|
|
109
|
+
|
|
110
|
+
smartbox <auth options...> health-check
|
|
111
|
+
|
|
112
|
+
### List available resailers
|
|
113
|
+
The `resailers` command can be used to know which resailershas an automatic configuration.
|
|
114
|
+
If your resailer is not present you can raise an issue in github, or use the optional options.
|
|
115
|
+
|
|
116
|
+
smartbox <auth options...> resailers
|
|
117
|
+
|
|
103
118
|
|
|
104
119
|
See [api-notes.md](./api-notes.md) for notes on REST and socket.io endpoints.
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
## Development
|
|
124
|
+
|
|
125
|
+
Prerequisites:
|
|
126
|
+
|
|
127
|
+
uv
|
|
128
|
+
python >=3.12
|
|
129
|
+
|
|
130
|
+
Clone the repo, install dependencies and install pre-commit hooks:
|
|
131
|
+
|
|
132
|
+
git clone
|
|
133
|
+
cd smartbox
|
|
134
|
+
uv sync
|
|
135
|
+
pre-commit install
|
|
136
|
+
|
|
137
|
+
## Testing
|
|
138
|
+
|
|
139
|
+
To run the full suite simply run the following command from within the virtual environment:
|
|
140
|
+
|
|
141
|
+
pytest
|
|
142
|
+
|
|
143
|
+
or
|
|
144
|
+
|
|
145
|
+
python -m pytest tests/
|
|
146
|
+
|
|
147
|
+
To generate code coverage xml (e.g. for use in VSCode) run
|
|
148
|
+
|
|
149
|
+
python -m pytest --cov-report xml:cov.xml --cov smartbox --cov-append tests/
|
|
150
|
+
|
|
151
|
+
Another way to run the tests is by using `tox`. This runs the tests against the installed package and multiple versions of python.
|
|
152
|
+
|
|
153
|
+
tox
|
|
154
|
+
|
|
155
|
+
or by specifying a python version
|
|
156
|
+
|
|
157
|
+
tox -e py312
|