nwp500-python 2.0.0__tar.gz → 3.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.
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/.github/copilot-instructions.md +31 -1
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/CHANGELOG.rst +20 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/CONTRIBUTING.rst +1 -1
- {nwp500_python-2.0.0/src/nwp500_python.egg-info → nwp500_python-3.1.0}/PKG-INFO +1 -1
- nwp500_python-3.1.0/docs/configuration.rst +331 -0
- nwp500_python-3.1.0/docs/development/contributing.rst +1 -0
- nwp500_python-2.0.0/docs/DEVELOPMENT.rst → nwp500_python-3.1.0/docs/development/history.rst +8 -8
- nwp500_python-2.0.0/docs/AUTO_RECOVERY.rst → nwp500_python-3.1.0/docs/guides/auto_recovery.rst +2 -2
- nwp500_python-2.0.0/docs/COMMAND_QUEUE.rst → nwp500_python-3.1.0/docs/guides/command_queue.rst +3 -3
- nwp500_python-2.0.0/docs/ENERGY_MONITORING.rst → nwp500_python-3.1.0/docs/guides/energy_monitoring.rst +3 -3
- nwp500_python-3.1.0/docs/guides/event_system.rst +513 -0
- nwp500_python-3.1.0/docs/guides/reservations.rst +687 -0
- nwp500_python-3.1.0/docs/guides/time_of_use.rst +976 -0
- nwp500_python-3.1.0/docs/index.rst +152 -0
- nwp500_python-3.1.0/docs/installation.rst +153 -0
- nwp500_python-2.0.0/docs/DEVICE_FEATURE_FIELDS.rst → nwp500_python-3.1.0/docs/protocol/device_features.rst +4 -4
- nwp500_python-2.0.0/docs/DEVICE_STATUS_FIELDS.rst → nwp500_python-3.1.0/docs/protocol/device_status.rst +3 -3
- nwp500_python-2.0.0/docs/ERROR_CODES.rst → nwp500_python-3.1.0/docs/protocol/error_codes.rst +2 -2
- nwp500_python-3.1.0/docs/protocol/mqtt_protocol.rst +475 -0
- nwp500_python-3.1.0/docs/protocol/rest_api.rst +424 -0
- nwp500_python-3.1.0/docs/python_api/api_client.rst +529 -0
- nwp500_python-3.1.0/docs/python_api/auth_client.rst +497 -0
- nwp500_python-3.1.0/docs/python_api/cli.rst +654 -0
- nwp500_python-3.1.0/docs/python_api/constants.rst +374 -0
- nwp500_python-3.1.0/docs/python_api/events.rst +358 -0
- nwp500_python-3.1.0/docs/python_api/exceptions.rst +429 -0
- nwp500_python-3.1.0/docs/python_api/models.rst +718 -0
- nwp500_python-3.1.0/docs/python_api/mqtt_client.rst +1084 -0
- nwp500_python-3.1.0/docs/quickstart.rst +278 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/README.md +48 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/api_client_example.py +39 -16
- nwp500_python-3.1.0/examples/tou_openei_example.py +321 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/pyproject.toml +54 -1
- nwp500_python-3.1.0/src/nwp500/__init__.py +131 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/src/nwp500/api_client.py +49 -193
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/src/nwp500/auth.py +98 -36
- nwp500_python-3.1.0/src/nwp500/cli/__init__.py +52 -0
- nwp500_python-3.1.0/src/nwp500/cli/__main__.py +475 -0
- nwp500_python-3.1.0/src/nwp500/cli/commands.py +613 -0
- nwp500_python-3.1.0/src/nwp500/cli/monitoring.py +44 -0
- nwp500_python-3.1.0/src/nwp500/cli/output_formatters.py +98 -0
- nwp500_python-3.1.0/src/nwp500/cli/token_storage.py +82 -0
- nwp500_python-3.1.0/src/nwp500/cli.py +77 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/src/nwp500/config.py +1 -3
- nwp500_python-3.1.0/src/nwp500/constants.py +101 -0
- nwp500_python-3.1.0/src/nwp500/encoding.py +444 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/src/nwp500/events.py +83 -38
- nwp500_python-3.1.0/src/nwp500/models.py +977 -0
- nwp500_python-3.1.0/src/nwp500/mqtt_client.py +1306 -0
- nwp500_python-3.1.0/src/nwp500/mqtt_command_queue.py +205 -0
- nwp500_python-3.1.0/src/nwp500/mqtt_connection.py +322 -0
- nwp500_python-3.1.0/src/nwp500/mqtt_device_control.py +691 -0
- nwp500_python-3.1.0/src/nwp500/mqtt_periodic.py +381 -0
- nwp500_python-3.1.0/src/nwp500/mqtt_reconnection.py +205 -0
- nwp500_python-3.1.0/src/nwp500/mqtt_subscriptions.py +687 -0
- nwp500_python-3.1.0/src/nwp500/mqtt_utils.py +215 -0
- nwp500_python-3.1.0/src/nwp500/py.typed +1 -0
- nwp500_python-3.1.0/src/nwp500/utils.py +71 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0/src/nwp500_python.egg-info}/PKG-INFO +1 -1
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/src/nwp500_python.egg-info/SOURCES.txt +44 -20
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/tests/test_api_helpers.py +26 -17
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/tests/test_command_queue.py +8 -3
- nwp500_python-3.1.0/tests/test_utils.py +203 -0
- nwp500_python-2.0.0/BREAKING_CHANGES_V3.md +0 -122
- nwp500_python-2.0.0/MIGRATION.md +0 -217
- nwp500_python-2.0.0/docs/API_CLIENT.rst +0 -541
- nwp500_python-2.0.0/docs/API_REFERENCE.rst +0 -31
- nwp500_python-2.0.0/docs/AUTHENTICATION.rst +0 -605
- nwp500_python-2.0.0/docs/AUTO_RECOVERY_QUICK.rst +0 -192
- nwp500_python-2.0.0/docs/EVENT_EMITTER.rst +0 -691
- nwp500_python-2.0.0/docs/MQTT_CLIENT.rst +0 -1490
- nwp500_python-2.0.0/docs/MQTT_MESSAGES.rst +0 -919
- nwp500_python-2.0.0/docs/contributing.rst +0 -1
- nwp500_python-2.0.0/docs/index.rst +0 -365
- nwp500_python-2.0.0/docs/readme.rst +0 -2
- nwp500_python-2.0.0/src/nwp500/__init__.py +0 -160
- nwp500_python-2.0.0/src/nwp500/cli.py +0 -703
- nwp500_python-2.0.0/src/nwp500/constants.py +0 -45
- nwp500_python-2.0.0/src/nwp500/models.py +0 -902
- nwp500_python-2.0.0/src/nwp500/mqtt_client.py +0 -2130
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/.coveragerc +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/.github/workflows/ci.yml +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/.github/workflows/release.yml +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/.gitignore +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/.pre-commit-config.yaml +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/.readthedocs.yml +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/AUTHORS.rst +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/LICENSE.txt +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/Makefile +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/README.rst +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/RELEASE.md +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/docs/Makefile +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/docs/_static/.gitignore +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/docs/authors.rst +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/docs/changelog.rst +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/docs/conf.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/docs/license.rst +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/docs/openapi.yaml +0 -0
- /nwp500_python-2.0.0/docs/FIRMWARE_TRACKING.rst → /nwp500_python-3.1.0/docs/protocol/firmware_tracking.rst +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/docs/requirements.txt +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/.ruff.toml +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/anti_legionella_example.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/auth_constructor_example.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/authenticate.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/auto_recovery_example.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/combined_callbacks.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/command_queue_demo.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/device_feature_callback.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/device_status_callback.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/device_status_callback_debug.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/energy_usage_example.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/event_emitter_demo.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/improved_auth_pattern.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/mask.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/mqtt_client_example.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/periodic_device_info.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/periodic_requests.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/power_control_example.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/reconnection_demo.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/reservation_schedule_example.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/set_dhw_temperature_example.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/set_mode_example.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/simple_auto_recovery.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/simple_periodic_info.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/simple_periodic_status.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/test_api_client.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/test_mqtt_connection.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/test_mqtt_messaging.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/test_periodic_minimal.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/examples/tou_schedule_example.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/scripts/format.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/scripts/lint.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/scripts/setup-dev.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/setup.cfg +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/setup.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/src/nwp500_python.egg-info/dependency_links.txt +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/src/nwp500_python.egg-info/entry_points.txt +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/src/nwp500_python.egg-info/not-zip-safe +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/src/nwp500_python.egg-info/requires.txt +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/src/nwp500_python.egg-info/top_level.txt +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/tests/conftest.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/tests/test_events.py +0 -0
- {nwp500_python-2.0.0 → nwp500_python-3.1.0}/tox.ini +0 -0
|
@@ -14,11 +14,25 @@
|
|
|
14
14
|
- **Lint/format**: `ruff format --check src/ tests/ examples/` (use `ruff format ...` to auto-format)
|
|
15
15
|
- **CI-compatible linting**: `make ci-lint` (run before finalizing changes to ensure CI will pass)
|
|
16
16
|
- **CI-compatible formatting**: `make ci-format` (auto-fix formatting issues)
|
|
17
|
+
- **Type checking**: `python3 -m mypy src/nwp500 --config-file pyproject.toml` (static type analysis)
|
|
17
18
|
- **Build docs**: `tox -e docs` (Sphinx docs in `docs/`)
|
|
18
19
|
- **Preview docs**: `python3 -m http.server --directory docs/_build/html`
|
|
19
20
|
|
|
20
21
|
### Before Committing Changes
|
|
21
|
-
Always run
|
|
22
|
+
Always run these checks before finalizing changes to ensure your code will pass CI:
|
|
23
|
+
1. **Linting**: `make ci-lint` - Ensures code style matches CI requirements
|
|
24
|
+
2. **Type checking**: `python3 -m mypy src/nwp500 --config-file pyproject.toml` - Catches type errors
|
|
25
|
+
3. **Tests**: `pytest` - Ensures functionality isn't broken
|
|
26
|
+
|
|
27
|
+
This prevents "passes locally but fails in CI" issues.
|
|
28
|
+
|
|
29
|
+
### After Completing a Task
|
|
30
|
+
Always run these checks after completing a task to validate your changes:
|
|
31
|
+
1. **Type checking**: `python3 -m mypy src/nwp500 --config-file pyproject.toml` - Verify no type errors were introduced
|
|
32
|
+
2. **Linting**: `make ci-lint` - Verify code style compliance
|
|
33
|
+
3. **Tests** (if applicable): `pytest` - Verify functionality works as expected
|
|
34
|
+
|
|
35
|
+
Report the results of these checks in your final summary.
|
|
22
36
|
|
|
23
37
|
## Patterns & Conventions
|
|
24
38
|
- **Async context managers** for authentication: `async with NavienAuthClient(email, password) as auth_client:`
|
|
@@ -44,6 +58,22 @@ Always run `make ci-lint` before finalizing changes to ensure your code will pas
|
|
|
44
58
|
- If tests hang, check network connectivity and API endpoint status
|
|
45
59
|
- For MQTT, ensure AWS credentials are valid and endpoint is reachable
|
|
46
60
|
|
|
61
|
+
## Communication Style
|
|
62
|
+
- **Progress updates**: Save summaries for the end of work. Don't provide interim status reports.
|
|
63
|
+
- **Final summaries**: Keep them concise. Example format:
|
|
64
|
+
```
|
|
65
|
+
## Final Results
|
|
66
|
+
**Starting point:** X errors
|
|
67
|
+
**Ending point:** 0 errors ✅
|
|
68
|
+
**Tests:** All passing ✓
|
|
69
|
+
|
|
70
|
+
## What Was Fixed
|
|
71
|
+
- Module 1 - Brief description (N errors)
|
|
72
|
+
- Module 2 - Brief description (N errors)
|
|
73
|
+
```
|
|
74
|
+
- **No markdown files**: Don't create separate summary files. Provide summaries inline when requested.
|
|
75
|
+
- **Focus on execution**: Perform the work, then summarize results at the end.
|
|
76
|
+
|
|
47
77
|
---
|
|
48
78
|
|
|
49
79
|
If any section is unclear or missing important project-specific details, please provide feedback so this guide can be improved for future AI agents.
|
|
@@ -2,12 +2,32 @@
|
|
|
2
2
|
Changelog
|
|
3
3
|
=========
|
|
4
4
|
|
|
5
|
+
Version 3.0.0 (Unreleased)
|
|
6
|
+
==========================
|
|
7
|
+
|
|
8
|
+
**Breaking Changes**
|
|
9
|
+
|
|
10
|
+
- **REMOVED**: ``OperationMode`` enum has been removed
|
|
11
|
+
|
|
12
|
+
- This enum was deprecated in v2.0.0 and has now been fully removed
|
|
13
|
+
- Use ``DhwOperationSetting`` for user-configured mode preferences (values 1-6)
|
|
14
|
+
- Use ``CurrentOperationMode`` for real-time operational states (values 0, 32, 64, 96)
|
|
15
|
+
- Migration was supported throughout the v2.x series
|
|
16
|
+
|
|
17
|
+
- **REMOVED**: Migration helper functions and deprecation infrastructure
|
|
18
|
+
|
|
19
|
+
- Removed ``migrate_operation_mode_usage()`` function
|
|
20
|
+
- Removed ``enable_deprecation_warnings()`` function
|
|
21
|
+
- Removed migration documentation files (MIGRATION.md, BREAKING_CHANGES_V3.md)
|
|
22
|
+
- All functionality available through ``DhwOperationSetting`` and ``CurrentOperationMode``
|
|
23
|
+
|
|
5
24
|
Version 2.0.0 (Unreleased)
|
|
6
25
|
==========================
|
|
7
26
|
|
|
8
27
|
**Breaking Changes (Planned for v3.0.0)**
|
|
9
28
|
|
|
10
29
|
- **DEPRECATION**: ``OperationMode`` enum is deprecated and will be removed in v3.0.0
|
|
30
|
+
|
|
11
31
|
|
|
12
32
|
- Use ``DhwOperationSetting`` for user-configured mode preferences (values 1-6)
|
|
13
33
|
- Use ``CurrentOperationMode`` for real-time operational states (values 0, 32, 64, 96)
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
=============
|
|
2
|
+
Configuration
|
|
3
|
+
=============
|
|
4
|
+
|
|
5
|
+
This guide covers configuring the nwp500-python library for your
|
|
6
|
+
environment.
|
|
7
|
+
|
|
8
|
+
Credentials
|
|
9
|
+
===========
|
|
10
|
+
|
|
11
|
+
The library requires your Navien Smart Control credentials (email and
|
|
12
|
+
password used in the Navilink mobile app).
|
|
13
|
+
|
|
14
|
+
Environment Variables (Recommended)
|
|
15
|
+
------------------------------------
|
|
16
|
+
|
|
17
|
+
Store credentials in environment variables for security:
|
|
18
|
+
|
|
19
|
+
**Linux/macOS:**
|
|
20
|
+
|
|
21
|
+
.. code-block:: bash
|
|
22
|
+
|
|
23
|
+
export NAVIEN_EMAIL="your-email@example.com"
|
|
24
|
+
export NAVIEN_PASSWORD="your-password"
|
|
25
|
+
|
|
26
|
+
**Windows (PowerShell):**
|
|
27
|
+
|
|
28
|
+
.. code-block:: powershell
|
|
29
|
+
|
|
30
|
+
$env:NAVIEN_EMAIL="your-email@example.com"
|
|
31
|
+
$env:NAVIEN_PASSWORD="your-password"
|
|
32
|
+
|
|
33
|
+
**Windows (Command Prompt):**
|
|
34
|
+
|
|
35
|
+
.. code-block:: bat
|
|
36
|
+
|
|
37
|
+
set NAVIEN_EMAIL=your-email@example.com
|
|
38
|
+
set NAVIEN_PASSWORD=your-password
|
|
39
|
+
|
|
40
|
+
Then in your code:
|
|
41
|
+
|
|
42
|
+
.. code-block:: python
|
|
43
|
+
|
|
44
|
+
import os
|
|
45
|
+
from nwp500 import NavienAuthClient
|
|
46
|
+
|
|
47
|
+
email = os.getenv("NAVIEN_EMAIL")
|
|
48
|
+
password = os.getenv("NAVIEN_PASSWORD")
|
|
49
|
+
|
|
50
|
+
async with NavienAuthClient(email, password) as auth:
|
|
51
|
+
# ...
|
|
52
|
+
|
|
53
|
+
Configuration File
|
|
54
|
+
------------------
|
|
55
|
+
|
|
56
|
+
Create a config file (keep this private!):
|
|
57
|
+
|
|
58
|
+
.. code-block:: ini
|
|
59
|
+
|
|
60
|
+
# config.ini
|
|
61
|
+
[navien]
|
|
62
|
+
email = your-email@example.com
|
|
63
|
+
password = your-password
|
|
64
|
+
|
|
65
|
+
Load it in your code:
|
|
66
|
+
|
|
67
|
+
.. code-block:: python
|
|
68
|
+
|
|
69
|
+
import configparser
|
|
70
|
+
from nwp500 import NavienAuthClient
|
|
71
|
+
|
|
72
|
+
config = configparser.ConfigParser()
|
|
73
|
+
config.read('config.ini')
|
|
74
|
+
|
|
75
|
+
email = config['navien']['email']
|
|
76
|
+
password = config['navien']['password']
|
|
77
|
+
|
|
78
|
+
async with NavienAuthClient(email, password) as auth:
|
|
79
|
+
# ...
|
|
80
|
+
|
|
81
|
+
.. warning::
|
|
82
|
+
Never commit configuration files with credentials to version control!
|
|
83
|
+
Add ``config.ini`` to your ``.gitignore`` file.
|
|
84
|
+
|
|
85
|
+
Direct in Code (Not Recommended)
|
|
86
|
+
---------------------------------
|
|
87
|
+
|
|
88
|
+
Only for testing:
|
|
89
|
+
|
|
90
|
+
.. code-block:: python
|
|
91
|
+
|
|
92
|
+
from nwp500 import NavienAuthClient
|
|
93
|
+
|
|
94
|
+
async with NavienAuthClient(
|
|
95
|
+
"your-email@example.com",
|
|
96
|
+
"your-password"
|
|
97
|
+
) as auth:
|
|
98
|
+
# ...
|
|
99
|
+
|
|
100
|
+
Authentication Options
|
|
101
|
+
======================
|
|
102
|
+
|
|
103
|
+
Timeout Settings
|
|
104
|
+
----------------
|
|
105
|
+
|
|
106
|
+
Configure request timeouts:
|
|
107
|
+
|
|
108
|
+
.. code-block:: python
|
|
109
|
+
|
|
110
|
+
from nwp500 import NavienAuthClient
|
|
111
|
+
|
|
112
|
+
# Increase timeout for slow connections
|
|
113
|
+
async with NavienAuthClient(
|
|
114
|
+
email,
|
|
115
|
+
password,
|
|
116
|
+
timeout=60 # seconds
|
|
117
|
+
) as auth:
|
|
118
|
+
# ...
|
|
119
|
+
|
|
120
|
+
Custom Base URL
|
|
121
|
+
---------------
|
|
122
|
+
|
|
123
|
+
Use a different API endpoint (for testing or proxies):
|
|
124
|
+
|
|
125
|
+
.. code-block:: python
|
|
126
|
+
|
|
127
|
+
from nwp500 import NavienAuthClient, NavienAPIClient
|
|
128
|
+
|
|
129
|
+
async with NavienAuthClient(email, password) as auth:
|
|
130
|
+
api = NavienAPIClient(
|
|
131
|
+
auth,
|
|
132
|
+
base_url="https://custom.api.url/api/v2.1"
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
MQTT Configuration
|
|
136
|
+
==================
|
|
137
|
+
|
|
138
|
+
The MQTT client supports various configuration options through
|
|
139
|
+
``MqttConnectionConfig``:
|
|
140
|
+
|
|
141
|
+
Basic Configuration
|
|
142
|
+
-------------------
|
|
143
|
+
|
|
144
|
+
.. code-block:: python
|
|
145
|
+
|
|
146
|
+
from nwp500 import NavienMqttClient, MqttConnectionConfig
|
|
147
|
+
from nwp500.mqtt_utils import MqttConnectionConfig
|
|
148
|
+
|
|
149
|
+
config = MqttConnectionConfig(
|
|
150
|
+
client_id="my-custom-client", # or None for auto-generated
|
|
151
|
+
clean_session=True,
|
|
152
|
+
keep_alive_secs=1200
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
mqtt = NavienMqttClient(auth, config=config)
|
|
156
|
+
|
|
157
|
+
Reconnection Settings
|
|
158
|
+
---------------------
|
|
159
|
+
|
|
160
|
+
Configure automatic reconnection behavior:
|
|
161
|
+
|
|
162
|
+
.. code-block:: python
|
|
163
|
+
|
|
164
|
+
config = MqttConnectionConfig(
|
|
165
|
+
auto_reconnect=True,
|
|
166
|
+
max_reconnect_attempts=15,
|
|
167
|
+
initial_reconnect_delay=1.0, # seconds
|
|
168
|
+
max_reconnect_delay=120.0, # seconds
|
|
169
|
+
reconnect_backoff_multiplier=2.0
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
Command Queue Settings
|
|
173
|
+
----------------------
|
|
174
|
+
|
|
175
|
+
Configure command queueing when disconnected:
|
|
176
|
+
|
|
177
|
+
.. code-block:: python
|
|
178
|
+
|
|
179
|
+
config = MqttConnectionConfig(
|
|
180
|
+
enable_command_queue=True,
|
|
181
|
+
max_queued_commands=100
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
Complete Example
|
|
185
|
+
----------------
|
|
186
|
+
|
|
187
|
+
.. code-block:: python
|
|
188
|
+
|
|
189
|
+
from nwp500 import NavienMqttClient
|
|
190
|
+
from nwp500.mqtt_utils import MqttConnectionConfig
|
|
191
|
+
|
|
192
|
+
config = MqttConnectionConfig(
|
|
193
|
+
# Connection
|
|
194
|
+
endpoint="a1t30mldyslmuq-ats.iot.us-east-1.amazonaws.com",
|
|
195
|
+
region="us-east-1",
|
|
196
|
+
client_id="my-app-client",
|
|
197
|
+
clean_session=True,
|
|
198
|
+
keep_alive_secs=1200,
|
|
199
|
+
|
|
200
|
+
# Reconnection
|
|
201
|
+
auto_reconnect=True,
|
|
202
|
+
max_reconnect_attempts=10,
|
|
203
|
+
initial_reconnect_delay=1.0,
|
|
204
|
+
max_reconnect_delay=120.0,
|
|
205
|
+
reconnect_backoff_multiplier=2.0,
|
|
206
|
+
|
|
207
|
+
# Command queue
|
|
208
|
+
enable_command_queue=True,
|
|
209
|
+
max_queued_commands=100
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
mqtt = NavienMqttClient(auth, config=config)
|
|
213
|
+
|
|
214
|
+
Logging Configuration
|
|
215
|
+
=====================
|
|
216
|
+
|
|
217
|
+
The library uses Python's standard logging module:
|
|
218
|
+
|
|
219
|
+
Basic Logging
|
|
220
|
+
-------------
|
|
221
|
+
|
|
222
|
+
.. code-block:: python
|
|
223
|
+
|
|
224
|
+
import logging
|
|
225
|
+
|
|
226
|
+
# Enable all library logs
|
|
227
|
+
logging.basicConfig(
|
|
228
|
+
level=logging.DEBUG,
|
|
229
|
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
Selective Logging
|
|
233
|
+
-----------------
|
|
234
|
+
|
|
235
|
+
.. code-block:: python
|
|
236
|
+
|
|
237
|
+
import logging
|
|
238
|
+
|
|
239
|
+
# Only log from nwp500 library
|
|
240
|
+
nwp_logger = logging.getLogger('nwp500')
|
|
241
|
+
nwp_logger.setLevel(logging.INFO)
|
|
242
|
+
|
|
243
|
+
# Only log MQTT messages
|
|
244
|
+
mqtt_logger = logging.getLogger('nwp500.mqtt_client')
|
|
245
|
+
mqtt_logger.setLevel(logging.DEBUG)
|
|
246
|
+
|
|
247
|
+
Log to File
|
|
248
|
+
-----------
|
|
249
|
+
|
|
250
|
+
.. code-block:: python
|
|
251
|
+
|
|
252
|
+
import logging
|
|
253
|
+
|
|
254
|
+
logging.basicConfig(
|
|
255
|
+
level=logging.INFO,
|
|
256
|
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
257
|
+
handlers=[
|
|
258
|
+
logging.FileHandler('navien.log'),
|
|
259
|
+
logging.StreamHandler()
|
|
260
|
+
]
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
Best Practices
|
|
264
|
+
==============
|
|
265
|
+
|
|
266
|
+
1. **Never hardcode credentials** - Use environment variables or config
|
|
267
|
+
files
|
|
268
|
+
2. **Use async context managers** - Ensures proper cleanup
|
|
269
|
+
3. **Enable logging** - Helps debug issues
|
|
270
|
+
4. **Handle exceptions** - Network errors are common
|
|
271
|
+
5. **Rate limit API calls** - Use MQTT for real-time updates
|
|
272
|
+
6. **Secure config files** - Set proper file permissions (chmod 600)
|
|
273
|
+
|
|
274
|
+
Example: Production Configuration
|
|
275
|
+
==================================
|
|
276
|
+
|
|
277
|
+
.. code-block:: python
|
|
278
|
+
|
|
279
|
+
import os
|
|
280
|
+
import logging
|
|
281
|
+
from nwp500 import NavienAuthClient, NavienMqttClient
|
|
282
|
+
from nwp500.mqtt_utils import MqttConnectionConfig
|
|
283
|
+
|
|
284
|
+
# Configure logging
|
|
285
|
+
logging.basicConfig(
|
|
286
|
+
level=logging.INFO,
|
|
287
|
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
288
|
+
handlers=[
|
|
289
|
+
logging.FileHandler('/var/log/navien.log'),
|
|
290
|
+
logging.StreamHandler()
|
|
291
|
+
]
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
# Get credentials from environment
|
|
295
|
+
email = os.getenv("NAVIEN_EMAIL")
|
|
296
|
+
password = os.getenv("NAVIEN_PASSWORD")
|
|
297
|
+
|
|
298
|
+
if not email or not password:
|
|
299
|
+
raise ValueError(
|
|
300
|
+
"NAVIEN_EMAIL and NAVIEN_PASSWORD must be set"
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
# Configure MQTT with reconnection
|
|
304
|
+
mqtt_config = MqttConnectionConfig(
|
|
305
|
+
auto_reconnect=True,
|
|
306
|
+
max_reconnect_attempts=15,
|
|
307
|
+
enable_command_queue=True
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
async def main():
|
|
311
|
+
try:
|
|
312
|
+
async with NavienAuthClient(
|
|
313
|
+
email,
|
|
314
|
+
password,
|
|
315
|
+
timeout=30
|
|
316
|
+
) as auth:
|
|
317
|
+
mqtt = NavienMqttClient(auth, config=mqtt_config)
|
|
318
|
+
await mqtt.connect()
|
|
319
|
+
# ... your application code ...
|
|
320
|
+
await mqtt.disconnect()
|
|
321
|
+
except Exception as e:
|
|
322
|
+
logging.error(f"Application error: {e}", exc_info=True)
|
|
323
|
+
raise
|
|
324
|
+
|
|
325
|
+
Next Steps
|
|
326
|
+
==========
|
|
327
|
+
|
|
328
|
+
* :doc:`quickstart` - Build your first application
|
|
329
|
+
* :doc:`python_api/auth_client` - Authentication details
|
|
330
|
+
* :doc:`python_api/mqtt_client` - MQTT client configuration
|
|
331
|
+
* :doc:`guides/auto_recovery` - Automatic reconnection guide
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.. include:: ../../CONTRIBUTING.rst
|
|
@@ -87,8 +87,8 @@ compatibility - Automatic credential handling from authentication API -
|
|
|
87
87
|
Session ID generation for connection tracking
|
|
88
88
|
|
|
89
89
|
**Key Files:** - ``src/nwp500/mqtt_client.py`` - MQTT client
|
|
90
|
-
implementation - :doc
|
|
91
|
-
:doc
|
|
90
|
+
implementation - :doc:`../python_api/mqtt_client` - Complete documentation -
|
|
91
|
+
:doc:`../protocol/mqtt_protocol` - Message format reference
|
|
92
92
|
|
|
93
93
|
Device Status & Feature Callbacks (October 7, 2025)
|
|
94
94
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -268,7 +268,7 @@ Complete event-driven architecture for device state changes:
|
|
|
268
268
|
- ``src/nwp500/mqtt_client.py`` - MQTT integration with event emitter
|
|
269
269
|
- ``examples/event_emitter_demo.py`` - Comprehensive demonstration
|
|
270
270
|
- ``tests/test_events.py`` - Unit tests (19 tests)
|
|
271
|
-
- :doc
|
|
271
|
+
- :doc:`../python_api/events` - Feature documentation
|
|
272
272
|
|
|
273
273
|
**Thread Safety Implementation:**
|
|
274
274
|
|
|
@@ -337,8 +337,8 @@ References
|
|
|
337
337
|
----------
|
|
338
338
|
|
|
339
339
|
- `OpenAPI Specification <openapi.yaml>`__ - API specification
|
|
340
|
-
- :doc
|
|
341
|
-
- :doc
|
|
342
|
-
- :doc
|
|
343
|
-
- :doc
|
|
344
|
-
- :doc
|
|
340
|
+
- :doc:`../protocol/mqtt_protocol` - MQTT message reference
|
|
341
|
+
- :doc:`../protocol/device_status` - Device status fields
|
|
342
|
+
- :doc:`../python_api/auth_client` - Authentication guide
|
|
343
|
+
- :doc:`../python_api/api_client` - API client guide
|
|
344
|
+
- :doc:`../python_api/mqtt_client` - MQTT client guide
|
nwp500_python-2.0.0/docs/AUTO_RECOVERY.rst → nwp500_python-3.1.0/docs/guides/auto_recovery.rst
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
===============================================
|
|
2
2
|
Automatic Reconnection After Connection Failure
|
|
3
|
-
|
|
3
|
+
===============================================
|
|
4
4
|
|
|
5
5
|
This guide explains how to automatically recover from permanent MQTT connection failures (after max reconnection attempts are exhausted).
|
|
6
6
|
|
nwp500_python-2.0.0/docs/COMMAND_QUEUE.rst → nwp500_python-3.1.0/docs/guides/command_queue.rst
RENAMED
|
@@ -300,9 +300,9 @@ Technical Notes
|
|
|
300
300
|
See Also
|
|
301
301
|
========
|
|
302
302
|
|
|
303
|
-
- :doc
|
|
304
|
-
- :doc
|
|
305
|
-
- :doc
|
|
303
|
+
- :doc:`../python_api/mqtt_client` - MQTT client documentation
|
|
304
|
+
- :doc:`../python_api/events` - Event emitter documentation
|
|
305
|
+
- :doc:`../python_api/auth_client` - Authentication and tokens
|
|
306
306
|
|
|
307
307
|
Example Code
|
|
308
308
|
============
|
|
@@ -334,6 +334,6 @@ Notes
|
|
|
334
334
|
See Also
|
|
335
335
|
--------
|
|
336
336
|
|
|
337
|
-
- :doc
|
|
338
|
-
- :doc
|
|
339
|
-
- :doc
|
|
337
|
+
- :doc:`../protocol/device_status` - Complete list of all status fields
|
|
338
|
+
- :doc:`../python_api/mqtt_client` - How to connect and subscribe to device updates
|
|
339
|
+
- :doc:`../protocol/mqtt_protocol` - Message format reference
|