plugwise 0.35.4__py3-none-any.whl
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.
- plugwise/__init__.py +890 -0
- plugwise/constants.py +547 -0
- plugwise/exceptions.py +49 -0
- plugwise/helper.py +1552 -0
- plugwise/py.typed +0 -0
- plugwise/util.py +65 -0
- plugwise-0.35.4.dist-info/LICENSE +21 -0
- plugwise-0.35.4.dist-info/METADATA +146 -0
- plugwise-0.35.4.dist-info/RECORD +11 -0
- plugwise-0.35.4.dist-info/WHEEL +5 -0
- plugwise-0.35.4.dist-info/top_level.txt +1 -0
plugwise/py.typed
ADDED
File without changes
|
plugwise/util.py
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
"""Plugwise protocol helpers."""
|
2
|
+
from __future__ import annotations
|
3
|
+
|
4
|
+
import re
|
5
|
+
|
6
|
+
from .constants import (
|
7
|
+
ELECTRIC_POTENTIAL_VOLT,
|
8
|
+
ENERGY_KILO_WATT_HOUR,
|
9
|
+
HW_MODELS,
|
10
|
+
PERCENTAGE,
|
11
|
+
SPECIAL_FORMAT,
|
12
|
+
TEMP_CELSIUS,
|
13
|
+
)
|
14
|
+
|
15
|
+
|
16
|
+
def escape_illegal_xml_characters(xmldata: str) -> str:
|
17
|
+
"""Replace illegal &-characters."""
|
18
|
+
return re.sub(r"&([^a-zA-Z#])", r"&\1", xmldata)
|
19
|
+
|
20
|
+
|
21
|
+
def format_measure(measure: str, unit: str) -> float | int:
|
22
|
+
"""Format measure to correct type."""
|
23
|
+
result: float | int = 0
|
24
|
+
try:
|
25
|
+
result = int(measure)
|
26
|
+
if unit == TEMP_CELSIUS:
|
27
|
+
result = float(measure)
|
28
|
+
except ValueError:
|
29
|
+
float_measure = float(measure)
|
30
|
+
if unit == PERCENTAGE:
|
31
|
+
if 0 < float_measure <= 1:
|
32
|
+
return int(float_measure * 100)
|
33
|
+
|
34
|
+
if unit == ENERGY_KILO_WATT_HOUR:
|
35
|
+
float_measure = float_measure / 1000
|
36
|
+
|
37
|
+
if unit in SPECIAL_FORMAT:
|
38
|
+
result = float(f"{round(float_measure, 3):.3f}")
|
39
|
+
elif unit == ELECTRIC_POTENTIAL_VOLT:
|
40
|
+
result = float(f"{round(float_measure, 1):.1f}")
|
41
|
+
elif abs(float_measure) < 10:
|
42
|
+
result = float(f"{round(float_measure, 2):.2f}")
|
43
|
+
elif abs(float_measure) >= 10 and abs(float_measure) < 100:
|
44
|
+
result = float(f"{round(float_measure, 1):.1f}")
|
45
|
+
elif abs(float_measure) >= 100:
|
46
|
+
result = int(round(float_measure))
|
47
|
+
|
48
|
+
return result
|
49
|
+
|
50
|
+
|
51
|
+
# NOTE: this function version_to_model is shared between Smile and USB
|
52
|
+
def version_to_model(version: str | None) -> str | None:
|
53
|
+
"""Translate hardware_version to device type."""
|
54
|
+
|
55
|
+
if version is None:
|
56
|
+
return version
|
57
|
+
|
58
|
+
model = HW_MODELS.get(version)
|
59
|
+
if model is None:
|
60
|
+
model = HW_MODELS.get(version[4:10])
|
61
|
+
if model is None:
|
62
|
+
# Try again with reversed order
|
63
|
+
model = HW_MODELS.get(version[-2:] + version[-4:-2] + version[-6:-4])
|
64
|
+
|
65
|
+
return model if model is not None else "Unknown"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 @laetificat, 2019-2020 @CoMPaTech & @bouwew, 2020-current @CoMPaTech, @bouwew & @brefra
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,146 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: plugwise
|
3
|
+
Version: 0.35.4
|
4
|
+
Summary: Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3.
|
5
|
+
Home-page: https://github.com/plugwise/python-plugwise
|
6
|
+
Author: Plugwise device owners
|
7
|
+
Maintainer: bouwew, CoMPaTech
|
8
|
+
License: MIT License
|
9
|
+
|
10
|
+
Copyright (c) 2019 @laetificat, 2019-2020 @CoMPaTech & @bouwew, 2020-current @CoMPaTech, @bouwew & @brefra
|
11
|
+
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
14
|
+
in the Software without restriction, including without limitation the rights
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
17
|
+
furnished to do so, subject to the following conditions:
|
18
|
+
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
20
|
+
copies or substantial portions of the Software.
|
21
|
+
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
28
|
+
SOFTWARE.
|
29
|
+
|
30
|
+
Project-URL: Source Code, https://github.com/plugwise/python-plugwise
|
31
|
+
Project-URL: Bug Reports, https://github.com/plugwise/python-plugwise/issues
|
32
|
+
Keywords: home,automation,plugwise,module
|
33
|
+
Platform: any
|
34
|
+
Classifier: Development Status :: 5 - Production/Stable
|
35
|
+
Classifier: Intended Audience :: Developers
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
37
|
+
Classifier: Operating System :: OS Independent
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
39
|
+
Classifier: Topic :: Home Automation
|
40
|
+
Requires-Python: >=3.12.0
|
41
|
+
Description-Content-Type: text/markdown
|
42
|
+
License-File: LICENSE
|
43
|
+
Requires-Dist: aiohttp
|
44
|
+
Requires-Dist: async-timeout
|
45
|
+
Requires-Dist: crcmod
|
46
|
+
Requires-Dist: defusedxml
|
47
|
+
Requires-Dist: munch
|
48
|
+
Requires-Dist: pyserial
|
49
|
+
Requires-Dist: python-dateutil
|
50
|
+
Requires-Dist: semver (>=3.0.0)
|
51
|
+
|
52
|
+
# Plugwise python module
|
53
|
+
|
54
|
+
This module is the backend for the [`plugwise` component](https://github.com/home-assistant/core/tree/dev/homeassistant/components/plugwise) in Home Assistant Core (which we maintain as co-code owners).
|
55
|
+
|
56
|
+
This module supports `Smile`s (and `Stretch`), i.e. the networked plugwise devices. For the USB (or Stick-standalone version) please refer to upcoming [`plugwise-usb` component](https://github.com/plugwise/plugwise_usb-beta).
|
57
|
+
|
58
|
+
Our main usage for this module is supporting [Home Assistant](https://www.home-assistant.io) / [home-assistant](http://github.com/home-assistant/core/)
|
59
|
+
|
60
|
+
[](https://github.com/plugwise)
|
61
|
+
[](https://pypi.python.org/pypi/plugwise/)
|
62
|
+
|
63
|
+
[](https://github.com/plugwise/python-plugwise/actions)
|
64
|
+
[](https://github.com/plugwise/python-plugwise/actions)
|
65
|
+
[](https://results.pre-commit.ci/latest/github/plugwise/python-plugwise/main)
|
66
|
+
[](https://github.com/plugwise/python-plugwise/issues/291)
|
67
|
+
|
68
|
+
[](https://www.codefactor.io/repository/github/plugwise/python-plugwise)
|
69
|
+
[](https://codecov.io/gh/plugwise/python-plugwise)
|
70
|
+
|
71
|
+
[](https://sonarcloud.io/summary/new_code?id=plugwise_python-plugwise)
|
72
|
+
[](https://sonarcloud.io/summary/new_code?id=plugwise_python-plugwise)
|
73
|
+
[](https://sonarcloud.io/summary/new_code?id=plugwise_python-plugwise)
|
74
|
+
|
75
|
+
## Integration
|
76
|
+
|
77
|
+
### Home-Assistant Integration
|
78
|
+
|
79
|
+
(maintained through Home-Assistant)
|
80
|
+
|
81
|
+
[](https://github.com/home-assistant/core/tree/dev/homeassistant/components/plugwise)
|
82
|
+
|
83
|
+
Works out of the box with every Home Assistant installation, use the button below to install
|
84
|
+
|
85
|
+
[](https://my.home-assistant.io/redirect/integrations/)
|
86
|
+
|
87
|
+
### Home-Assistant custom_component (beta)
|
88
|
+
|
89
|
+
We do (also) maintain a `custom_component`, please note this is **only** intended for users helping us test new features (use at your own risk)
|
90
|
+
|
91
|
+
[](https://github.com/plugwise/plugwise-beta)
|
92
|
+
|
93
|
+
You can add our `custom_component` repository to HACS, do note that we do not intent for our `beta` `custom_component` to be included in the HACS repository.
|
94
|
+
|
95
|
+
[](https://github.com/plugwise/plugwise-beta)
|
96
|
+
|
97
|
+
See the [`plugwise-beta`](https://github.com/plugwise/plugwise-beta) repository for more info.
|
98
|
+
|
99
|
+
## Development/patches
|
100
|
+
|
101
|
+
Like Home Assistant Core we use `pre-commit` and additionally run [pre-commit.ci](http://pre-commit.ci) to automatically validate your commits and PRs.
|
102
|
+
|
103
|
+
If you want to create a PR please make sure you at least run `scripts/setup.sh`. This will ensure your environment is set up correctly before attempting to `git commit`. We sincerely and highly recommended also setting up local testing, see [`tests/README.md`](https://github.com/plugwise/python-plugwise/blob/main/tests/README.md) for more information and run `scripts/setup_test.sh` to prepare your environment.
|
104
|
+
|
105
|
+
## Project support status
|
106
|
+
|
107
|
+
**Notice** at this time we are refactoring the module code to move towards a supporting way for the integration to become multiple components under an umbrella `plugwise` integration featuring multiple components.
|
108
|
+
|
109
|
+
Module providing interfacing with the Plugwise devices:
|
110
|
+
|
111
|
+
### Smile
|
112
|
+
|
113
|
+
- [x] Adam
|
114
|
+
- [x] Lisa
|
115
|
+
- [x] Jip
|
116
|
+
- [x] Floor
|
117
|
+
- [x] Tom
|
118
|
+
- [x] Koen (a Koen always comes with a Plug, the Plug is the active part)
|
119
|
+
- [x] Plug
|
120
|
+
- [x] Aqara Plug
|
121
|
+
- [x] Anna
|
122
|
+
- [x] Smile P1
|
123
|
+
- [x] Stretch
|
124
|
+
- [ ] Some of the equipment mentioned in USB when in use via Stretch or Adam
|
125
|
+
|
126
|
+
- [x] [Home-Assistant](https://home-assistant.io) via
|
127
|
+
- [x] Native supporting networked Plugwise products
|
128
|
+
- [x] [HACS](https://hacs.xyz) and `custom_component` [Plugwise Beta](https://github.com/plugwise/plugwise-beta/) (supporting all devices above)
|
129
|
+
|
130
|
+
## License, origins and contributors
|
131
|
+
|
132
|
+
As per the origins we have retained the appropriate licensing and including the MIT-license for this project.
|
133
|
+
|
134
|
+
Origins (from newest to oldest):
|
135
|
+
|
136
|
+
- Networked (Smile/Stretch) Plugwise support by @bouwew (Bouwe) and @CoMPaTech (Tom). We both support and help out @brefra (Frank) where possible, he's supporting the USB module and integration.
|
137
|
+
- 'All' available Plugwise support by @bouwew (Bouwe), @brefra (Frank) and @CoMPaTech (Tom)
|
138
|
+
- Upstreamed haanna/HA-core Anna, including all later products - 'Plugwise-Smile/Plugwise-HA/plugwise-beta` by @bouwew (Bouwe) & @CoMPaTech (Tom)
|
139
|
+
- Networked Plugwise Anna module with custom_module - `haanna/anna-ha` via <https://github.com/laetificat> (Kevin)
|
140
|
+
- USB-based stick module with custom_module - `plugwise-stick/plugwise` by @brefra (Frank)
|
141
|
+
- USB-plugwise module - `plugwise` by <https://github.com/cyberjunky/python-plugwise> (Ron) originally by <https://github.com/aequitas/python-plugwise> (Johan) (with reference only in license to Sven)
|
142
|
+
- Sensor for Plugwise Smile P1 integration - `home-assistant-sensor-plugwise-smile-p1` by <https://bitbucket.org/jvdschoot/home-assistant-sensor-plugwise-smile-p1> (Jeroen van der Schoot)
|
143
|
+
|
144
|
+
## Thanks
|
145
|
+
|
146
|
+
On behalf all of us, big thanks to Plugwise and community members @riemers and @tane from [HAshop](https://hashop.nl) for their support and obviously all our users and testers who dealt with our typos and challenges. Disclaimer, while we are communicating with Plugwise and they expressed their gratitude through their newsletter, we are not part of Plugwise as a company. We are just a bunch of guys anxious to get our (and your) Plugwise products working with Home Assistant.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
plugwise/__init__.py,sha256=-1lUf0VCVEA2BSAq1dcPsbNhAoDE7nrXZ4WW3Ddgtto,35443
|
2
|
+
plugwise/constants.py,sha256=1Jvy4ZQqHr5UhIpK7yNCcalD2AR9VXsQE3LKE5cRZ-Q,16113
|
3
|
+
plugwise/exceptions.py,sha256=rymGtWnXosdFkzSehc_41HVl2jXJEg_9Hq9APDEUwrk,1223
|
4
|
+
plugwise/helper.py,sha256=rP98bKX6LZ914ZhTqQ6v97YEnOAmSqmow0AeW2KiLic,64198
|
5
|
+
plugwise/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
plugwise/util.py,sha256=a-64-1hXCzscFQ1o_7UIa0XvW-p4LwTjhLWWPi5f8ac,1965
|
7
|
+
plugwise-0.35.4.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
|
8
|
+
plugwise-0.35.4.dist-info/METADATA,sha256=3K75FD-iRxaSLl0kznSq8GRi_IsIsMAxyXkNM6zfHv8,9046
|
9
|
+
plugwise-0.35.4.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
10
|
+
plugwise-0.35.4.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
|
11
|
+
plugwise-0.35.4.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
plugwise
|