smartbox 2.0.0b2__tar.gz → 2.1.0__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.
Files changed (91) hide show
  1. smartbox-2.1.0/.github/FUNDING.yml +4 -0
  2. smartbox-2.1.0/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  3. smartbox-2.1.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. smartbox-2.1.0/.github/ISSUE_TEMPLATE/new-resailer.md +18 -0
  5. smartbox-2.1.0/.github/dependabot.yml +19 -0
  6. smartbox-2.1.0/.github/workflows/publish-to-pypi.yml +31 -0
  7. smartbox-2.1.0/.github/workflows/python-package.yml +89 -0
  8. smartbox-2.1.0/.gitignore +72 -0
  9. smartbox-2.1.0/.pre-commit-config.yaml +29 -0
  10. smartbox-2.1.0/.vscode/settings.json +7 -0
  11. smartbox-2.1.0/CHANGELOG.md +39 -0
  12. smartbox-2.1.0/CODEOWNERS +5 -0
  13. {smartbox-2.0.0b2 → smartbox-2.1.0}/PKG-INFO +106 -23
  14. smartbox-2.0.0b2/smartbox.egg-info/PKG-INFO → smartbox-2.1.0/README.md +90 -29
  15. smartbox-2.1.0/api-notes.md +141 -0
  16. smartbox-2.1.0/codecov.yml +10 -0
  17. smartbox-2.1.0/pyproject.toml +138 -0
  18. smartbox-2.1.0/requirements.txt +2 -0
  19. smartbox-2.1.0/src/smartbox/__init__.py +54 -0
  20. smartbox-2.1.0/src/smartbox/cmd.py +406 -0
  21. smartbox-2.1.0/src/smartbox/error.py +19 -0
  22. smartbox-2.1.0/src/smartbox/models.py +231 -0
  23. smartbox-2.1.0/src/smartbox/resailer.py +133 -0
  24. smartbox-2.1.0/src/smartbox/session.py +574 -0
  25. {smartbox-2.0.0b2 → smartbox-2.1.0/src}/smartbox/socket.py +72 -47
  26. {smartbox-2.0.0b2 → smartbox-2.1.0/src}/smartbox/update_manager.py +95 -49
  27. smartbox-2.1.0/tests/__init__.py +0 -0
  28. smartbox-2.1.0/tests/common.py +17 -0
  29. smartbox-2.1.0/tests/conftest.py +102 -0
  30. smartbox-2.1.0/tests/fixtures/devs/device1/acm/1/samples.json +2839 -0
  31. smartbox-2.1.0/tests/fixtures/devs/device1/acm/1/setup.json +40 -0
  32. smartbox-2.1.0/tests/fixtures/devs/device1/acm/1/status.json +24 -0
  33. smartbox-2.1.0/tests/fixtures/devs/device1/htr/0/samples.json +2839 -0
  34. smartbox-2.1.0/tests/fixtures/devs/device1/htr/0/setup.json +40 -0
  35. smartbox-2.1.0/tests/fixtures/devs/device1/htr/0/status.json +24 -0
  36. smartbox-2.1.0/tests/fixtures/devs/device1/htr_system/power_limit.json +1 -0
  37. smartbox-2.1.0/tests/fixtures/devs/device1/mgr/away_status.json +1 -0
  38. smartbox-2.1.0/tests/fixtures/devs/device1/mgr/nodes.json +18 -0
  39. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/0/samples.json +2839 -0
  40. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/0/setup.json +40 -0
  41. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/0/status.json +24 -0
  42. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/1/samples.json +1 -0
  43. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/1/setup.json +40 -0
  44. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/1/status.json +24 -0
  45. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/2/samples.json +1 -0
  46. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/2/setup.json +40 -0
  47. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/2/status.json +24 -0
  48. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/3/samples.json +1 -0
  49. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/3/setup.json +40 -0
  50. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/3/status.json +24 -0
  51. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/4/samples.json +1 -0
  52. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/4/setup.json +40 -0
  53. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/4/status.json +24 -0
  54. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/5/samples.json +1 -0
  55. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/5/setup.json +40 -0
  56. smartbox-2.1.0/tests/fixtures/devs/device2/htr_mod/5/status.json +24 -0
  57. smartbox-2.1.0/tests/fixtures/devs/device2/htr_system/power_limit.json +1 -0
  58. smartbox-2.1.0/tests/fixtures/devs/device2/mgr/away_status.json +1 -0
  59. smartbox-2.1.0/tests/fixtures/devs/device2/mgr/nodes.json +46 -0
  60. smartbox-2.1.0/tests/fixtures/devs.json +19 -0
  61. smartbox-2.1.0/tests/fixtures/grouped_devs.json +24 -0
  62. smartbox-2.1.0/tests/fixtures/groups/test_home/guest_users.json +12 -0
  63. smartbox-2.1.0/tests/fixtures/test_path.json +1 -0
  64. smartbox-2.1.0/tests/test_cmd.py +367 -0
  65. smartbox-2.1.0/tests/test_models.py +283 -0
  66. smartbox-2.1.0/tests/test_resailer.py +46 -0
  67. smartbox-2.1.0/tests/test_session.py +1398 -0
  68. smartbox-2.1.0/tests/test_update_manager.py +208 -0
  69. smartbox-2.1.0/tox.ini +14 -0
  70. smartbox-2.1.0/uv.lock +874 -0
  71. smartbox-2.0.0b2/README.md +0 -89
  72. smartbox-2.0.0b2/pyproject.toml +0 -6
  73. smartbox-2.0.0b2/setup.cfg +0 -74
  74. smartbox-2.0.0b2/smartbox/__init__.py +0 -6
  75. smartbox-2.0.0b2/smartbox/cmd.py +0 -227
  76. smartbox-2.0.0b2/smartbox/error.py +0 -4
  77. smartbox-2.0.0b2/smartbox/session.py +0 -207
  78. smartbox-2.0.0b2/smartbox.egg-info/SOURCES.txt +0 -24
  79. smartbox-2.0.0b2/smartbox.egg-info/dependency_links.txt +0 -1
  80. smartbox-2.0.0b2/smartbox.egg-info/entry_points.txt +0 -2
  81. smartbox-2.0.0b2/smartbox.egg-info/not-zip-safe +0 -1
  82. smartbox-2.0.0b2/smartbox.egg-info/requires.txt +0 -6
  83. smartbox-2.0.0b2/smartbox.egg-info/top_level.txt +0 -1
  84. smartbox-2.0.0b2/tests/test_cmd.py +0 -373
  85. smartbox-2.0.0b2/tests/test_session.py +0 -266
  86. smartbox-2.0.0b2/tests/test_socket.py +0 -337
  87. smartbox-2.0.0b2/tests/test_update_manager.py +0 -243
  88. smartbox-2.0.0b2/tests/test_update_manager_benchmark.py +0 -41
  89. smartbox-2.0.0b2/tests/test_version.py +0 -6
  90. {smartbox-2.0.0b2 → smartbox-2.1.0}/LICENSE +0 -0
  91. {smartbox-2.0.0b2 → smartbox-2.1.0/src}/smartbox/py.typed +0 -0
@@ -0,0 +1,4 @@
1
+ # These are supported funding model platforms
2
+
3
+ buy_me_a_coffee: Delmael
4
+
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: New resailer
3
+ about: Add a new available resailer.
4
+ title: "[RESAILER] New available resailer"
5
+ labels: resailer
6
+ assignees: Delmael
7
+
8
+ ---
9
+
10
+ > [!NOTE]
11
+ > If you do not see your current resailer in the available list, you can ask to add it. We cannot ensure your device go through this platform
12
+
13
+ * [ ] I have check with the `smartbox resailers` command that my resailer is not already present
14
+ * **Website url (mandatory)** :
15
+ * Name of the resailers:
16
+ * API url :
17
+ * Basic auth headers :
18
+ * Serial id:
@@ -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.13
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,89 @@
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
+ permissions:
6
+ contents: read
7
+ pull-requests: write
8
+
9
+ on:
10
+ push:
11
+ pull_request:
12
+
13
+ jobs:
14
+
15
+ linter:
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ max-parallel: 4
19
+ matrix:
20
+ python-version: [3.13]
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - name: Install uv
24
+ uses: astral-sh/setup-uv@v5
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+ - name: Set up Python ${{ matrix.python-version }}
28
+ uses: actions/setup-python@v5.4.0
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ - name: Install the project
32
+ run: uv sync --all-extras --dev
33
+ - name: Lint with ruff
34
+ run: uv run ruff check src/smartbox
35
+
36
+ typechecker:
37
+ runs-on: ubuntu-latest
38
+ strategy:
39
+ max-parallel: 1
40
+ matrix:
41
+ python-version: [3.13]
42
+
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+ - name: Install uv
46
+ uses: astral-sh/setup-uv@v5
47
+ with:
48
+ python-version: ${{ matrix.python-version }}
49
+ - name: Set up Python ${{ matrix.python-version }}
50
+ uses: actions/setup-python@v5.4.0
51
+ with:
52
+ python-version: ${{ matrix.python-version }}
53
+ - name: Install the project
54
+ run: uv sync --all-extras --dev
55
+ - name: Typecheck with mypy
56
+ run: uv run mypy src/smartbox
57
+
58
+ build:
59
+ runs-on: ubuntu-latest
60
+ strategy:
61
+ max-parallel: 4
62
+ matrix:
63
+ python-version: [3.13]
64
+
65
+ steps:
66
+ - uses: actions/checkout@v4
67
+ - name: Install uv
68
+ uses: astral-sh/setup-uv@v5
69
+ with:
70
+ python-version: ${{ matrix.python-version }}
71
+
72
+ - name: Set up Python ${{ matrix.python-version }}
73
+ uses: actions/setup-python@v5.4.0
74
+ with:
75
+ python-version: ${{ matrix.python-version }}
76
+ - name: Install the project
77
+ run: |
78
+ uv sync --all-extras --dev
79
+ tox -e py
80
+ - name: "Upload coverage to Codecov"
81
+ uses: codecov/codecov-action@v5
82
+ with:
83
+ token: ${{ secrets.CODECOV_TOKEN }}
84
+ fail_ci_if_error: true
85
+ - name: Upload test results to Codecov
86
+ if: ${{ !cancelled() }}
87
+ uses: codecov/test-results-action@v1
88
+ with:
89
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -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,7 @@
1
+ {
2
+ "python.linting.pylintEnabled": true,
3
+ "python.linting.flake8Enabled": true,
4
+ "python.linting.enabled": true,
5
+ "python.testing.unittestEnabled": false,
6
+ "python.testing.pytestEnabled": true
7
+ }
@@ -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,5 @@
1
+ # These owners will be the default owners for everything in
2
+ # the repo. Unless a later match takes precedence,
3
+ # @Delmael will be requested for
4
+ # review when someone opens a pull request.
5
+ * @Delmael
@@ -1,45 +1,71 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: smartbox
3
- Version: 2.0.0b2
3
+ Version: 2.1.0
4
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
5
+ Project-URL: Homepage, https://github.com/ajtudela/smartbox
6
+ Project-URL: Issues, https://github.com/ajtudela/smartbox/issues
7
+ Author-email: Alberto Tudela <ajtudela@gmail.com>, Delmael <delmael@outlook.com>, graham33 <graham@grahambennett.org>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.9
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.13
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
13
21
  Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
22
 
16
- # smartbox ![build](https://github.com/graham33/smartbox/workflows/Python%20package/badge.svg) [![PyPI version](https://badge.fury.io/py/smartbox.svg)](https://badge.fury.io/py/smartbox) [![codecov](https://codecov.io/gh/graham33/smartbox/branch/main/graph/badge.svg?token=BMCS2E9OC7)](https://codecov.io/gh/graham33/smartbox) [![PyPI license](https://img.shields.io/pypi/l/smartbox.svg)](https://pypi.python.org/pypi/smartbox/) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/smartbox.svg)](https://pypi.python.org/pypi/smartbox/)
23
+ # smartbox ![build](https://github.com/ajtudela/smartbox/workflows/Python%20package/badge.svg) [![PyPI version](https://badge.fury.io/py/smartbox.svg)](https://badge.fury.io/py/smartbox) [![codecov](https://codecov.io/gh/ajtudela/smartbox/branch/main/graph/badge.svg?token=ghNZOGVzVv)](https://codecov.io/gh/ajtudela/smartbox) [![PyPI license](https://img.shields.io/pypi/l/smartbox.svg)](https://pypi.python.org/pypi/smartbox/) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/smartbox.svg)](https://pypi.python.org/pypi/smartbox/)
17
24
 
18
25
  Python API to control heating 'smart boxes'
19
26
 
27
+
20
28
  ## Installation
21
29
 
22
- Install using pip from [PyPI](https://pypi.python.org/pypi/smartbox/):
30
+ ## Install
31
+
32
+ To install smartbox simply run:
23
33
 
24
34
  pip install smartbox
25
35
 
36
+ Depending on your permissions you might be required to use sudo.
37
+ Once installed you can simply add `smartbox` to your Python 3 scripts by including:
38
+
39
+ import smartbox
40
+
41
+
42
+
26
43
  ## `smartbox` Command Line Tool
44
+ ### Mandatory options
27
45
  You can use the `smartbox` tool to get status information from your heaters
28
46
  (nodes) and change settings.
29
47
 
30
48
  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
49
  * `-u`/`--username`: Your username as used for the mobile app/web app.
36
50
  * `-p`/`--password`: Your password as used for the mobile app/web app.
51
+
52
+
53
+ Verbose logging can be enabled with the `-v`/`--verbose` flag.
54
+
55
+ ### Optional options
56
+ These options are useful if your resailer is not configured.
57
+
37
58
  * `-b`/`--base-auth-creds`: An HTTP Basic Auth credential used to do initial
38
59
  authentication with the server. Use the base64 encoded string directly. See
39
60
  'Basic Auth Credential' section below for more details.
61
+ * `-a`/`--api-name`: The API name for your heater vendor. This is visible in
62
+ the 'API Host' entry in the 'Version' menu item in the mobile app/web app. If
63
+ the host name is of the form `api-foo.xxxx` or `api.xxxx` use the values
64
+ `api-foo` or `api` respectively. The resailer has to be declared in the package.
65
+ * `-r`/`--x-referer`: The referer of your request.
66
+ * `-i`/`--x-serial-id`: The serial-id of your request.
40
67
 
41
- Verbose logging can be enabled with the `-v`/`--verbose` flag.
42
-
68
+ ## Availables commands
43
69
  ### Listing smartbox devices
44
70
 
45
71
  smartbox <auth options...> devices
@@ -71,6 +97,12 @@ node.
71
97
 
72
98
  smartbox <auth options...> set-setup <-d/--device-id> <device id> <-n/--node-addr> <node> <name>=<value> [<name>=<value> ...]
73
99
 
100
+ ### Setting node samples
101
+
102
+ The `node-samples` command can be used to get the historical data (temperature and consumption) of a node.
103
+
104
+ smartbox <auth options...> node-samples <-d/--device-id> <device id> <-n/--node-addr> <node> <-s/--start-time> <start time> <-e/--end-time> <end time>
105
+
74
106
  ### Getting device away status
75
107
  The `device-away-status` command lists the away status across all devices.
76
108
 
@@ -94,11 +126,62 @@ watts) on a particular device.
94
126
 
95
127
  smartbox <auth options...> set-device-power-limit <-d/--device-id> <device id> <limit>
96
128
 
97
- ## Basic Auth Credential
98
- Initial authentication to the smartbox REST API is protected by HTTP Basic Auth,
99
- in addition to the user's username and password which are then used to obtain an
100
- access token. In order not to undermine the security layer it provides, and also
101
- because it might change over time or vary between implementations, **the token
102
- is not provided here and system owners need to find it themselves**.
129
+
130
+ ### Health check
131
+ The `health-check` command can be used to know if the API is alived
132
+
133
+ smartbox <auth options...> health-check
134
+
135
+ ### List available resailers
136
+ The `resailers` command can be used to know which resailershas an automatic configuration.
137
+ If your resailer is not present you can raise an issue in github, or use the optional options.
138
+
139
+ smartbox <auth options...> resailers
140
+
103
141
 
104
142
  See [api-notes.md](./api-notes.md) for notes on REST and socket.io endpoints.
143
+
144
+
145
+
146
+ ## Development
147
+
148
+ Prerequisites:
149
+
150
+ uv
151
+ python >=3.13
152
+
153
+ Clone the repo, install dependencies and install pre-commit hooks:
154
+
155
+ git clone
156
+ cd smartbox
157
+ uv sync
158
+ pre-commit install
159
+
160
+ ## Testing
161
+
162
+ To run the full suite simply run the following command from within the virtual environment:
163
+
164
+ pytest
165
+
166
+ or
167
+
168
+ python -m pytest tests/
169
+
170
+ To generate code coverage xml (e.g. for use in VSCode) run
171
+
172
+ python -m pytest --cov-report xml:cov.xml --cov smartbox --cov-append tests/
173
+
174
+ Another way to run the tests is by using `tox`. This runs the tests against the installed package and multiple versions of python.
175
+
176
+ tox
177
+
178
+ or by specifying a python version
179
+
180
+ tox -e py313
181
+
182
+ # Support
183
+ [![Buy me a coffee][buymeacoffee-shield]][buymeacoffee]
184
+
185
+ [buymeacoffee]: https://www.buymeacoffee.com/ajtudela
186
+
187
+ [buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png