pyecodevices-rt2 1.3.3__tar.gz → 2.0.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.
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/CONTRIBUTING.rst +15 -13
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/HISTORY.rst +12 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/PKG-INFO +44 -74
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/README.rst +15 -10
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/installation.rst +4 -2
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/usage.rst +1 -1
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/pyecodevices_rt2/__init__.py +38 -36
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/abstractsensor.py +26 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/abstractswitch.py +65 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/pyecodevices_rt2/cli.py +19 -18
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/pyecodevices_rt2/const.py +114 -111
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/counter.py +69 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/digitalinput.py +26 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/ecodevices_rt2.py +185 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/enocean.py +32 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/post.py +89 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/relay.py +23 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/supplierindex.py +29 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/toroid.py +39 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/virtualoutput.py +23 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/x4fp.py +61 -0
- pyecodevices_rt2-2.0.0/pyecodevices_rt2/xthl.py +58 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/pyecodevices_rt2.egg-info/PKG-INFO +45 -75
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/pyecodevices_rt2.egg-info/SOURCES.txt +4 -4
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/pyecodevices_rt2.egg-info/entry_points.txt +0 -1
- pyecodevices_rt2-2.0.0/pyecodevices_rt2.egg-info/requires.txt +15 -0
- pyecodevices_rt2-2.0.0/pyproject.toml +111 -0
- pyecodevices_rt2-2.0.0/setup.cfg +4 -0
- pyecodevices_rt2-2.0.0/tests/test_pyecodevices_rt2.py +287 -0
- pyecodevices_rt2-2.0.0/tests/test_unit.py +376 -0
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/abstractsensor.py +0 -26
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/abstractswitch.py +0 -68
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/counter.py +0 -59
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/digitalinput.py +0 -27
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/ecodevices_rt2.py +0 -128
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/enocean.py +0 -33
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/post.py +0 -109
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/relay.py +0 -23
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/supplierindex.py +0 -30
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/toroid.py +0 -41
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/virtualoutput.py +0 -23
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/x4fp.py +0 -48
- pyecodevices_rt2-1.3.3/pyecodevices_rt2/xthl.py +0 -62
- pyecodevices_rt2-1.3.3/pyecodevices_rt2.egg-info/requires.txt +0 -1
- pyecodevices_rt2-1.3.3/setup.cfg +0 -49
- pyecodevices_rt2-1.3.3/setup.py +0 -60
- pyecodevices_rt2-1.3.3/tests/test_pyecodevices_rt2.py +0 -346
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/AUTHORS.rst +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/LICENSE +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/MANIFEST.in +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/Makefile +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/authors.rst +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/conf.py +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/contributing.rst +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/history.rst +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/index.rst +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/make.bat +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/modules.rst +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/pyecodevices_rt2.rst +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/docs/readme.rst +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/pyecodevices_rt2/exceptions.py +0 -0
- /pyecodevices_rt2-1.3.3/pyecodevices_rt2.egg-info/not-zip-safe → /pyecodevices_rt2-2.0.0/pyecodevices_rt2/py.typed +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/pyecodevices_rt2.egg-info/dependency_links.txt +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/pyecodevices_rt2.egg-info/top_level.txt +0 -0
- {pyecodevices_rt2-1.3.3 → pyecodevices_rt2-2.0.0}/tests/__init__.py +0 -0
|
@@ -64,11 +64,13 @@ Ready to contribute? Here's how to set up `pyecodevices_rt2` for local developme
|
|
|
64
64
|
|
|
65
65
|
$ git clone git@github.com:your_name_here/pyecodevices_rt2.git
|
|
66
66
|
|
|
67
|
-
3.
|
|
67
|
+
3. Create and activate a virtual environment, then install your local copy for development::
|
|
68
68
|
|
|
69
|
-
$ mkvirtualenv pyecodevices_rt2
|
|
70
69
|
$ cd pyecodevices_rt2/
|
|
71
|
-
$
|
|
70
|
+
$ python3 -m venv .venv
|
|
71
|
+
$ source .venv/bin/activate
|
|
72
|
+
$ python -m pip install --upgrade pip
|
|
73
|
+
$ pip install -e ".[dev]"
|
|
72
74
|
|
|
73
75
|
4. Create a branch for local development::
|
|
74
76
|
|
|
@@ -76,15 +78,15 @@ Ready to contribute? Here's how to set up `pyecodevices_rt2` for local developme
|
|
|
76
78
|
|
|
77
79
|
Now you can make your changes locally.
|
|
78
80
|
|
|
79
|
-
5. When you're done making changes, check that your changes pass
|
|
81
|
+
5. When you're done making changes, check that your changes pass ruff, mypy, and the
|
|
80
82
|
tests, including testing other Python versions with tox::
|
|
81
83
|
|
|
82
|
-
$
|
|
83
|
-
$
|
|
84
|
+
$ ruff check pyecodevices_rt2 tests
|
|
85
|
+
$ ruff format --check pyecodevices_rt2 tests
|
|
86
|
+
$ mypy pyecodevices_rt2
|
|
87
|
+
$ pytest -m "not integration"
|
|
84
88
|
$ tox
|
|
85
89
|
|
|
86
|
-
To get flake8 and tox, just pip install them into your virtualenv.
|
|
87
|
-
|
|
88
90
|
6. Commit your changes and push your branch to GitHub::
|
|
89
91
|
|
|
90
92
|
$ git add .
|
|
@@ -102,9 +104,9 @@ Before you submit a pull request, check that it meets these guidelines:
|
|
|
102
104
|
2. If the pull request adds functionality, the docs should be updated. Put
|
|
103
105
|
your new functionality into a function with a docstring, and add the
|
|
104
106
|
feature to the list in README.rst.
|
|
105
|
-
3. The pull request should work for Python 3.
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
3. The pull request should work for Python 3.11, 3.12, 3.13, and 3.14. Check
|
|
108
|
+
GitHub Actions and make sure that the tests pass for all supported Python versions.
|
|
109
|
+
4. Note: AI/LLM coding assistants are used in the maintenance of this repository; all changes are reviewed and tested before release.
|
|
108
110
|
|
|
109
111
|
Tips
|
|
110
112
|
----
|
|
@@ -121,8 +123,8 @@ A reminder for the maintainers on how to deploy.
|
|
|
121
123
|
Make sure all your changes are committed (including an entry in HISTORY.rst).
|
|
122
124
|
Then run::
|
|
123
125
|
|
|
124
|
-
$
|
|
126
|
+
$ bump-my-version bump patch # possible: major / minor / patch
|
|
125
127
|
$ git push
|
|
126
128
|
$ git push --tags
|
|
127
129
|
|
|
128
|
-
|
|
130
|
+
Create a GitHub release from the tag to trigger the publish workflow to PyPI.
|
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
History
|
|
3
3
|
=======
|
|
4
4
|
|
|
5
|
+
2.0.0 (2026-11-29)
|
|
6
|
+
------------------
|
|
7
|
+
|
|
8
|
+
* Drop support for Python < 3.11 and add Python 3.11–3.14 support.
|
|
9
|
+
* Migrate packaging and tooling to ``pyproject.toml``, ``ruff``, ``mypy``, and ``bump-my-version``; add ``requests`` to runtime dependencies and ``py.typed`` marker.
|
|
10
|
+
* Reuse a thread-safe ``requests.Session`` in ``EcoDevicesRT2`` (with context manager / ``close()`` support), isolate cache per instance, use ``time.monotonic()`` for cache TTL, and mask ``apikey`` in error messages.
|
|
11
|
+
* Improve error handling and typing across all client and device classes (fix ``XTHL`` return annotations, expose ``EcoDevicesRT2.port``, validate ``X4FP`` module/zone/mode before requests).
|
|
12
|
+
* Invalidate cache on writes in ``AbstractSwitch``, ``X4FP``, and ``Counter`` instead of sleeping and re-reading immediately.
|
|
13
|
+
* Rename ``Counter.substrat`` to ``Counter.subtract`` (keeping ``substrat`` as a deprecated alias).
|
|
14
|
+
* Add a mocked unit test suite independent of a live EcoDevices RT2 and mark live tests with ``@pytest.mark.integration``.
|
|
15
|
+
* Update documentation (``.venv`` workflow and AI/LLM assistance disclosure).
|
|
16
|
+
|
|
5
17
|
1.3.1 (2022-08-07)
|
|
6
18
|
------------------
|
|
7
19
|
|
|
@@ -1,27 +1,40 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pyecodevices_rt2
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: Get information from GCE Ecodevices RT2.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
Author-email: Pierre COURBIN <pierre.courbin@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/pcourbin/pyecodevices_rt2
|
|
8
|
+
Project-URL: Documentation, https://pyecodevices-rt2.readthedocs.io
|
|
9
|
+
Project-URL: Repository, https://github.com/pcourbin/pyecodevices_rt2
|
|
10
|
+
Keywords: pyecodevices_rt2,ecodevices,rt2,gce,home-assistant
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
13
|
Classifier: Natural Language :: English
|
|
15
14
|
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.
|
|
20
|
-
Classifier:
|
|
21
|
-
Requires-Python: >=3.
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
22
21
|
Description-Content-Type: text/x-rst
|
|
23
22
|
License-File: LICENSE
|
|
24
|
-
|
|
23
|
+
Requires-Dist: Click>=7.0
|
|
24
|
+
Requires-Dist: requests>=2.28.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: bump-my-version>=0.26; extra == "dev"
|
|
28
|
+
Requires-Dist: mypy>=1.11; extra == "dev"
|
|
29
|
+
Requires-Dist: pre-commit>=3.7; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
32
|
+
Requires-Dist: python-dotenv>=1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
34
|
+
Requires-Dist: tox>=4.15; extra == "dev"
|
|
35
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
36
|
+
Requires-Dist: types-requests>=2.31; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
25
38
|
|
|
26
39
|
===============================================
|
|
27
40
|
pyecodevices-rt2 - Python `GCE Ecodevices RT2`_
|
|
@@ -29,19 +42,19 @@ pyecodevices-rt2 - Python `GCE Ecodevices RT2`_
|
|
|
29
42
|
|
|
30
43
|
|
|
31
44
|
.. image:: https://img.shields.io/pypi/v/pyecodevices_rt2.svg
|
|
32
|
-
:target: https://pypi.
|
|
45
|
+
:target: https://pypi.org/project/pyecodevices-rt2/
|
|
33
46
|
|
|
34
47
|
.. image:: https://img.shields.io/pypi/pyversions/pyecodevices_rt2.svg
|
|
35
|
-
:target: https://pypi.
|
|
48
|
+
:target: https://pypi.org/project/pyecodevices-rt2/
|
|
49
|
+
|
|
50
|
+
.. image:: https://github.com/pcourbin/pyecodevices_rt2/actions/workflows/test.yml/badge.svg
|
|
51
|
+
:target: https://github.com/pcourbin/pyecodevices_rt2/actions/workflows/test.yml
|
|
52
|
+
:alt: Tests
|
|
36
53
|
|
|
37
54
|
.. image:: https://readthedocs.org/projects/pyecodevices-rt2/badge/?version=latest
|
|
38
55
|
:target: https://pyecodevices-rt2.readthedocs.io/en/latest/?version=latest
|
|
39
56
|
:alt: Documentation Status
|
|
40
57
|
|
|
41
|
-
.. image:: https://pyup.io/repos/github/pcourbin/pyecodevices_rt2/shield.svg
|
|
42
|
-
:target: https://pyup.io/repos/github/pcourbin/pyecodevices_rt2/
|
|
43
|
-
:alt: Updates
|
|
44
|
-
|
|
45
58
|
.. image:: https://codecov.io/gh/pcourbin/pyecodevices_rt2/branch/main/graph/badge.svg
|
|
46
59
|
:target: https://codecov.io/gh/pcourbin/pyecodevices_rt2
|
|
47
60
|
|
|
@@ -49,9 +62,9 @@ pyecodevices-rt2 - Python `GCE Ecodevices RT2`_
|
|
|
49
62
|
:target: `pre-commit`_
|
|
50
63
|
:alt: pre-commit
|
|
51
64
|
|
|
52
|
-
.. image:: https://img.shields.io/badge/code%20style-
|
|
53
|
-
:target: `
|
|
54
|
-
:alt:
|
|
65
|
+
.. image:: https://img.shields.io/badge/code%20style-ruff-000000.svg
|
|
66
|
+
:target: `ruff`_
|
|
67
|
+
:alt: Ruff
|
|
55
68
|
|
|
56
69
|
.. image:: https://img.shields.io/badge/maintainer-%40pcourbin-blue.svg
|
|
57
70
|
:target: `user_profile`_
|
|
@@ -131,6 +144,11 @@ Credits
|
|
|
131
144
|
| This work is inspired by the work of `Aohzan`_.
|
|
132
145
|
| This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
|
|
133
146
|
|
|
147
|
+
AI / LLM Assistance
|
|
148
|
+
-------------------
|
|
149
|
+
|
|
150
|
+
Maintenance, refactoring, and test/documentation updates for this project now make use of AI/LLM coding assistants under maintainer review.
|
|
151
|
+
|
|
134
152
|
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
|
|
135
153
|
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
|
|
136
154
|
.. _`GCE Ecodevices RT2`: http://gce-electronics.com/fr/home/1345-suivi-consommation-ecodevices-rt2-3760309690049.html
|
|
@@ -140,54 +158,6 @@ Credits
|
|
|
140
158
|
.. _`ecodevices_rt2`: https://github.com/pcourbin/ecodevices_rt2
|
|
141
159
|
.. _`Aohzan`: https://github.com/Aohzan/pyecodevices
|
|
142
160
|
.. _`pre-commit`: https://github.com/pre-commit/pre-commit
|
|
143
|
-
.. _`
|
|
161
|
+
.. _`ruff`: https://docs.astral.sh/ruff/
|
|
144
162
|
.. _`user_profile`: https://github.com/pcourbin
|
|
145
163
|
.. _`buymecoffee`: https://www.buymeacoffee.com/pcourbin
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
=======
|
|
149
|
-
History
|
|
150
|
-
=======
|
|
151
|
-
|
|
152
|
-
1.3.1 (2022-08-07)
|
|
153
|
-
------------------
|
|
154
|
-
|
|
155
|
-
* Add option with cached_ms<0 to force use the cache, or return None
|
|
156
|
-
|
|
157
|
-
1.3.0 (2022-08-07)
|
|
158
|
-
------------------
|
|
159
|
-
|
|
160
|
-
* Update Toroid API, using new EcoRT2 version 3.00.02
|
|
161
|
-
|
|
162
|
-
1.2.1 (2021-05-15)
|
|
163
|
-
------------------
|
|
164
|
-
|
|
165
|
-
* Add "get_all_cached" function to call all resquests to get a cached value.
|
|
166
|
-
|
|
167
|
-
1.2.0 (2021-05-14)
|
|
168
|
-
------------------
|
|
169
|
-
|
|
170
|
-
* Add "cached" possibilities to reduce the number of call to the API.
|
|
171
|
-
* The cached possibilities can be defined directly to the ecodevices_rt2 object (applicable to each call), or to a specific call on a property.
|
|
172
|
-
|
|
173
|
-
1.1.0 (2021-04-17)
|
|
174
|
-
------------------
|
|
175
|
-
|
|
176
|
-
* Add classes such as `Counter`, `DigitalInput`, `EnOcean Switch or Sensor`, `Post and Sub-Post`, `Relay`, `SupplierIndex`, `Toroid`, `VirtualOutput`, `X4FP (Heaters)`, `XTHL` for ease of use
|
|
177
|
-
* Add tests to cover majority of code
|
|
178
|
-
* Add full examples in documentation
|
|
179
|
-
|
|
180
|
-
1.0.1 (2021-04-12)
|
|
181
|
-
------------------
|
|
182
|
-
|
|
183
|
-
* Update package with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
|
|
184
|
-
|
|
185
|
-
1.0.0 (2021-04-08)
|
|
186
|
-
------------------
|
|
187
|
-
|
|
188
|
-
* First release on PyPI.
|
|
189
|
-
|
|
190
|
-
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
|
|
191
|
-
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
|
|
192
|
-
|
|
193
|
-
|
|
@@ -4,19 +4,19 @@ pyecodevices-rt2 - Python `GCE Ecodevices RT2`_
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
.. image:: https://img.shields.io/pypi/v/pyecodevices_rt2.svg
|
|
7
|
-
:target: https://pypi.
|
|
7
|
+
:target: https://pypi.org/project/pyecodevices-rt2/
|
|
8
8
|
|
|
9
9
|
.. image:: https://img.shields.io/pypi/pyversions/pyecodevices_rt2.svg
|
|
10
|
-
:target: https://pypi.
|
|
10
|
+
:target: https://pypi.org/project/pyecodevices-rt2/
|
|
11
|
+
|
|
12
|
+
.. image:: https://github.com/pcourbin/pyecodevices_rt2/actions/workflows/test.yml/badge.svg
|
|
13
|
+
:target: https://github.com/pcourbin/pyecodevices_rt2/actions/workflows/test.yml
|
|
14
|
+
:alt: Tests
|
|
11
15
|
|
|
12
16
|
.. image:: https://readthedocs.org/projects/pyecodevices-rt2/badge/?version=latest
|
|
13
17
|
:target: https://pyecodevices-rt2.readthedocs.io/en/latest/?version=latest
|
|
14
18
|
:alt: Documentation Status
|
|
15
19
|
|
|
16
|
-
.. image:: https://pyup.io/repos/github/pcourbin/pyecodevices_rt2/shield.svg
|
|
17
|
-
:target: https://pyup.io/repos/github/pcourbin/pyecodevices_rt2/
|
|
18
|
-
:alt: Updates
|
|
19
|
-
|
|
20
20
|
.. image:: https://codecov.io/gh/pcourbin/pyecodevices_rt2/branch/main/graph/badge.svg
|
|
21
21
|
:target: https://codecov.io/gh/pcourbin/pyecodevices_rt2
|
|
22
22
|
|
|
@@ -24,9 +24,9 @@ pyecodevices-rt2 - Python `GCE Ecodevices RT2`_
|
|
|
24
24
|
:target: `pre-commit`_
|
|
25
25
|
:alt: pre-commit
|
|
26
26
|
|
|
27
|
-
.. image:: https://img.shields.io/badge/code%20style-
|
|
28
|
-
:target: `
|
|
29
|
-
:alt:
|
|
27
|
+
.. image:: https://img.shields.io/badge/code%20style-ruff-000000.svg
|
|
28
|
+
:target: `ruff`_
|
|
29
|
+
:alt: Ruff
|
|
30
30
|
|
|
31
31
|
.. image:: https://img.shields.io/badge/maintainer-%40pcourbin-blue.svg
|
|
32
32
|
:target: `user_profile`_
|
|
@@ -106,6 +106,11 @@ Credits
|
|
|
106
106
|
| This work is inspired by the work of `Aohzan`_.
|
|
107
107
|
| This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
|
|
108
108
|
|
|
109
|
+
AI / LLM Assistance
|
|
110
|
+
-------------------
|
|
111
|
+
|
|
112
|
+
Maintenance, refactoring, and test/documentation updates for this project now make use of AI/LLM coding assistants under maintainer review.
|
|
113
|
+
|
|
109
114
|
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
|
|
110
115
|
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
|
|
111
116
|
.. _`GCE Ecodevices RT2`: http://gce-electronics.com/fr/home/1345-suivi-consommation-ecodevices-rt2-3760309690049.html
|
|
@@ -115,6 +120,6 @@ Credits
|
|
|
115
120
|
.. _`ecodevices_rt2`: https://github.com/pcourbin/ecodevices_rt2
|
|
116
121
|
.. _`Aohzan`: https://github.com/Aohzan/pyecodevices
|
|
117
122
|
.. _`pre-commit`: https://github.com/pre-commit/pre-commit
|
|
118
|
-
.. _`
|
|
123
|
+
.. _`ruff`: https://docs.astral.sh/ruff/
|
|
119
124
|
.. _`user_profile`: https://github.com/pcourbin
|
|
120
125
|
.. _`buymecoffee`: https://www.buymeacoffee.com/pcourbin
|
|
@@ -40,11 +40,13 @@ Or download the `tarball`_:
|
|
|
40
40
|
|
|
41
41
|
$ curl -OJL https://github.com/pcourbin/pyecodevices_rt2/tarball/master
|
|
42
42
|
|
|
43
|
-
Once you have a copy of the source,
|
|
43
|
+
Once you have a copy of the source, create a virtual environment and install it with:
|
|
44
44
|
|
|
45
45
|
.. code-block:: console
|
|
46
46
|
|
|
47
|
-
$
|
|
47
|
+
$ python3 -m venv .venv
|
|
48
|
+
$ source .venv/bin/activate
|
|
49
|
+
$ pip install .
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
.. _Github repo: https://github.com/pcourbin/pyecodevices_rt2
|
|
@@ -118,7 +118,7 @@ You can define a Counter (see from the `GCE Ecodevices RT2 API`_ (or `PDF`_))::
|
|
|
118
118
|
|
|
119
119
|
test.value = 20 # Change the value of the counter to 20
|
|
120
120
|
test.add(5) # Add 5 to the counter
|
|
121
|
-
test.
|
|
121
|
+
test.subtract(10) # Subtract 10 from the counter
|
|
122
122
|
|
|
123
123
|
DigitalInput
|
|
124
124
|
------------
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
"""Get information from GCE Ecodevices RT2."""
|
|
2
|
-
|
|
3
|
-
from
|
|
4
|
-
|
|
5
|
-
from .
|
|
6
|
-
from .
|
|
7
|
-
from .
|
|
8
|
-
from .
|
|
9
|
-
from .
|
|
10
|
-
from .
|
|
11
|
-
from .
|
|
12
|
-
from .
|
|
13
|
-
from .
|
|
14
|
-
from .
|
|
15
|
-
from .
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
1
|
+
"""Get information from GCE Ecodevices RT2."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .abstractsensor import AbstractSensor
|
|
6
|
+
from .abstractswitch import AbstractSwitch
|
|
7
|
+
from .counter import Counter
|
|
8
|
+
from .digitalinput import DigitalInput
|
|
9
|
+
from .ecodevices_rt2 import EcoDevicesRT2
|
|
10
|
+
from .enocean import EnOceanSensor, EnOceanSwitch
|
|
11
|
+
from .post import Post
|
|
12
|
+
from .relay import Relay
|
|
13
|
+
from .supplierindex import SupplierIndex
|
|
14
|
+
from .toroid import Toroid
|
|
15
|
+
from .virtualoutput import VirtualOutput
|
|
16
|
+
from .x4fp import X4FP
|
|
17
|
+
from .xthl import XTHL
|
|
18
|
+
|
|
19
|
+
__author__ = """Pierre COURBIN"""
|
|
20
|
+
__email__ = "pierre.courbin@gmail.com"
|
|
21
|
+
__version__ = "2.0.0"
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"X4FP",
|
|
25
|
+
"XTHL",
|
|
26
|
+
"AbstractSensor",
|
|
27
|
+
"AbstractSwitch",
|
|
28
|
+
"Counter",
|
|
29
|
+
"DigitalInput",
|
|
30
|
+
"EcoDevicesRT2",
|
|
31
|
+
"EnOceanSensor",
|
|
32
|
+
"EnOceanSwitch",
|
|
33
|
+
"Post",
|
|
34
|
+
"Relay",
|
|
35
|
+
"SupplierIndex",
|
|
36
|
+
"Toroid",
|
|
37
|
+
"VirtualOutput",
|
|
38
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Abstract sensor base class for GCE Ecodevices RT2."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .ecodevices_rt2 import EcoDevicesRT2
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AbstractSensor:
|
|
9
|
+
"""Class representing an AbstractSensor."""
|
|
10
|
+
|
|
11
|
+
def __init__(self, ecort2: EcoDevicesRT2, id: int, get_link: str, get_entry: str) -> None:
|
|
12
|
+
self._ecort2 = ecort2
|
|
13
|
+
self._id = id
|
|
14
|
+
self._get_link = get_link
|
|
15
|
+
self._get_entry = get_entry
|
|
16
|
+
self._entry = self._get_entry % (self._id,)
|
|
17
|
+
|
|
18
|
+
def get_value(self, cached_ms: int | None = None) -> float | None:
|
|
19
|
+
"""Return the current AbstractSensor value."""
|
|
20
|
+
value: float | None = self._ecort2.get_entry(self._get_link, self._entry, cached_ms=cached_ms)
|
|
21
|
+
return value
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def value(self) -> float | None:
|
|
25
|
+
"""Return the current AbstractSensor value."""
|
|
26
|
+
return self.get_value()
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Abstract switch base class for GCE Ecodevices RT2."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .const import RESPONSE_ENTRY, RESPONSE_SUCCESS_VALUE
|
|
6
|
+
from .ecodevices_rt2 import EcoDevicesRT2
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AbstractSwitch:
|
|
10
|
+
"""Class representing an AbstractSwitch."""
|
|
11
|
+
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
ecort2: EcoDevicesRT2,
|
|
15
|
+
id: int,
|
|
16
|
+
get_link: str,
|
|
17
|
+
get_entry: str,
|
|
18
|
+
on_link: str,
|
|
19
|
+
off_link: str,
|
|
20
|
+
toggle_link: str,
|
|
21
|
+
) -> None:
|
|
22
|
+
self._ecort2 = ecort2
|
|
23
|
+
self._id = id
|
|
24
|
+
self._get_link = get_link
|
|
25
|
+
self._get_entry = get_entry
|
|
26
|
+
self._entry = self._get_entry % (self._id,)
|
|
27
|
+
self._on_link = on_link
|
|
28
|
+
self._off_link = off_link
|
|
29
|
+
self._toggle_link = toggle_link
|
|
30
|
+
|
|
31
|
+
def get_status(self, cached_ms: int | None = None) -> bool | None:
|
|
32
|
+
"""Return the current AbstractSwitch status."""
|
|
33
|
+
value = self._ecort2.get_entry(self._get_link, self._entry, cached_ms=cached_ms)
|
|
34
|
+
return None if value is None else value == 1
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def status(self) -> bool | None:
|
|
38
|
+
"""Return the current AbstractSwitch status."""
|
|
39
|
+
return self.get_status()
|
|
40
|
+
|
|
41
|
+
@status.setter
|
|
42
|
+
def status(self, value: bool) -> None:
|
|
43
|
+
"""Set the AbstractSwitch status."""
|
|
44
|
+
if value:
|
|
45
|
+
self.on()
|
|
46
|
+
else:
|
|
47
|
+
self.off()
|
|
48
|
+
|
|
49
|
+
def _execute_action(self, link_template: str) -> bool:
|
|
50
|
+
"""Send an action command and invalidate the switch status cache."""
|
|
51
|
+
response = self._ecort2.get(link_template % (self._id,), cached_ms=0)
|
|
52
|
+
self._ecort2.invalidate_cache(self._get_link)
|
|
53
|
+
return isinstance(response, dict) and response.get(RESPONSE_ENTRY) == RESPONSE_SUCCESS_VALUE
|
|
54
|
+
|
|
55
|
+
def on(self) -> bool:
|
|
56
|
+
"""Turn on the AbstractSwitch."""
|
|
57
|
+
return self._execute_action(self._on_link)
|
|
58
|
+
|
|
59
|
+
def off(self) -> bool:
|
|
60
|
+
"""Turn off the AbstractSwitch."""
|
|
61
|
+
return self._execute_action(self._off_link)
|
|
62
|
+
|
|
63
|
+
def toggle(self) -> bool:
|
|
64
|
+
"""Toggle the AbstractSwitch."""
|
|
65
|
+
return self._execute_action(self._toggle_link)
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
"""Console script for pyecodevices_rt2."""
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
click.echo("
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
"""Console script for pyecodevices_rt2."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@click.command()
|
|
11
|
+
def main(args: list[str] | None = None) -> int:
|
|
12
|
+
"""Console script for pyecodevices_rt2."""
|
|
13
|
+
click.echo("Replace this message by putting your code into pyecodevices_rt2.cli.main")
|
|
14
|
+
click.echo("See click documentation at https://click.palletsprojects.com/")
|
|
15
|
+
return 0
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
if __name__ == "__main__":
|
|
19
|
+
sys.exit(main()) # pragma: no cover
|