tinkerforge-async 1.5.2__tar.gz → 1.6.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.
- {tinkerforge_async-1.5.2/tinkerforge_async.egg-info → tinkerforge_async-1.6.0}/PKG-INFO +9 -9
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/README.md +5 -4
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/pyproject.toml +1 -3
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/__init__.py +1 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/_version.py +1 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/async_event_bus.py +3 -2
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/brick_master.py +8 -7
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_ambient_light_v2.py +2 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_ambient_light_v3.py +3 -2
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_analog_in.py +2 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_barometer.py +2 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_barometer_v2.py +5 -4
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_humidity.py +2 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_humidity_v2.py +4 -3
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_industrial_dual_analog_in_v2.py +7 -4
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_industrial_ptc.py +1 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_io16.py +11 -10
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_io4_v2.py +178 -25
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_isolator.py +1 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_moisture.py +2 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_motion_detector_v2.py +1 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_ptc.py +2 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_ptc_v2.py +4 -3
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_rs232_v2.py +2 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_segment_display_4x7.py +2 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_segment_display_4x7_v2.py +2 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_temperature.py +2 -1
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_temperature_v2.py +3 -2
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_thermocouple_v2.py +3 -2
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/device_factory.py +1 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/devices.py +1 -0
- tinkerforge_async-1.6.0/tinkerforge_async/helper.py +42 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/ip_connection.py +9 -9
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/ip_connection_helper.py +1 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0/tinkerforge_async.egg-info}/PKG-INFO +9 -9
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async.egg-info/SOURCES.txt +1 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/LICENSE +0 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/setup.cfg +0 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/setup.py +0 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async.egg-info/dependency_links.txt +0 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async.egg-info/requires.txt +0 -0
- {tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
2
|
-
Name:
|
3
|
-
Version: 1.
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: tinkerforge-async
|
3
|
+
Version: 1.6.0
|
4
4
|
Summary: Python3 AsyncIO Tinkerforge driver
|
5
5
|
Author-email: Patrick Baus <patrick.baus@physik.tu-darmstadt.de>
|
6
6
|
License: GNU General Public License v3 (GPLv3)
|
@@ -9,8 +9,6 @@ Project-URL: Bug Tracker, https://github.com/PatrickBaus/tinkerforge_async/issue
|
|
9
9
|
Project-URL: Download, https://github.com/PatrickBaus/tinkerforge_async/releases
|
10
10
|
Keywords: IoT,Tinkerforge,API
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
12
|
-
Classifier: Programming Language :: Python :: 3.7
|
13
|
-
Classifier: Programming Language :: Python :: 3.8
|
14
12
|
Classifier: Programming Language :: Python :: 3.9
|
15
13
|
Classifier: Programming Language :: Python :: 3.10
|
16
14
|
Classifier: Programming Language :: Python :: 3.11
|
@@ -44,6 +42,7 @@ Requires-Dist: mypy; extra == "test"
|
|
44
42
|
Requires-Dist: pylint; extra == "test"
|
45
43
|
Requires-Dist: pytest; extra == "test"
|
46
44
|
Requires-Dist: setuptools; extra == "test"
|
45
|
+
Dynamic: license-file
|
47
46
|
|
48
47
|
[](../../actions/workflows/pylint.yml)
|
49
48
|
[](https://pypi.org/project/tinkerforge-async/)
|
@@ -106,7 +105,7 @@ pip install tinkerforge-async
|
|
106
105
|
# Changes made to the API
|
107
106
|
Some design choices of the original Tinkerforge API are overly complex. I therefore replaced them with a simpler and more intuitive approach. A list of things that were changed can be found below:
|
108
107
|
## Design Changes
|
109
|
-
- Only Python 3 is supported (3.
|
108
|
+
- Only Python 3 is supported (3.9+)
|
110
109
|
- Replaced threads with an async event loop
|
111
110
|
- Completely rewritten how responses from bricks/bricklets work. All setters now have a `response_expected` parameter, which is set to `True` by default. If there is an error when calling the function, it will then raise an exception - either an `AttributeError` if the function is unknown, or a `ValueError` if one or more parameters are invalid.
|
112
111
|
|
@@ -188,9 +187,11 @@ Some design choices of the original Tinkerforge API are overly complex. I theref
|
|
188
187
|
- `IPConnection.register_callback(callback_id, function)`: Replaced by `register_event_queue()`
|
189
188
|
- `IPConnection.connect(host, port=4223, authentication_secret='')`: If `authentication_secret` is not empty, try to authenticate.
|
190
189
|
|
191
|
-
- ### [
|
190
|
+
- ### [IO-4 Bricklet 2.0](https://www.tinkerforge.com/de/doc/Software/Bricklets/IO4V2_Bricklet_Python.html)
|
192
191
|
- `BrickletIO4V2.set_pwm_configuration()` will now take the frequency in units of Hz and the duty cycle is normalized to 1, so it will take a float from [0...1].
|
193
|
-
- `BrickletIO4V2.get_pwm_configuration()` will return the frequency in units of
|
192
|
+
- `BrickletIO4V2.get_pwm_configuration()` will return the frequency in units of Hz and the duty cycle is normalized to 1.
|
193
|
+
- `BrickletIO4V2.set_edge_count_callback_configuration()` sets the callback configuration for the edge counter callback. Its secondary ids are in [5...8] for channels [0...3].
|
194
|
+
- `BrickletIO4V2.get_edge_count_callback_configuration()` returns the callback configuration for the edge counter callback.
|
194
195
|
|
195
196
|
- ### [Master Brick](https://www.tinkerforge.com/en/doc/Software/Bricks/Master_Brick_Python.html)
|
196
197
|
- `BrickMaster.set_wifi_configuration()`/`BrickMaster.get_wifi_configuration()` will take/return all ips in natural order
|
@@ -210,7 +211,6 @@ Some design choices of the original Tinkerforge API are overly complex. I theref
|
|
210
211
|
- `BrickletThermocoupleV2()` takes an additional parameter to define the type of sensor. The options are of type `BrickletThermocoupleV2.SensorType`. The default is `BrickletPtc.SensorType.TYPE_K`.
|
211
212
|
- `BrickletThermocoupleV2.sensor_type` getter and setter to change the type of sensor used.
|
212
213
|
|
213
|
-
|
214
214
|
- ### [Segment Display 4x7 Bricklet 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Segment_Display_4x7_V2.html)
|
215
215
|
- `BrickletSegmentDisplay4x7V2.set_segments()` takes a `list`/`tuple` of 4 `int` instead of digit0, digit1, digit2, digit3. This is the same API as the older [Segment Display 4x7 Bricklet](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Segment_Display_4x7.html).
|
216
216
|
|
@@ -59,7 +59,7 @@ pip install tinkerforge-async
|
|
59
59
|
# Changes made to the API
|
60
60
|
Some design choices of the original Tinkerforge API are overly complex. I therefore replaced them with a simpler and more intuitive approach. A list of things that were changed can be found below:
|
61
61
|
## Design Changes
|
62
|
-
- Only Python 3 is supported (3.
|
62
|
+
- Only Python 3 is supported (3.9+)
|
63
63
|
- Replaced threads with an async event loop
|
64
64
|
- Completely rewritten how responses from bricks/bricklets work. All setters now have a `response_expected` parameter, which is set to `True` by default. If there is an error when calling the function, it will then raise an exception - either an `AttributeError` if the function is unknown, or a `ValueError` if one or more parameters are invalid.
|
65
65
|
|
@@ -141,9 +141,11 @@ Some design choices of the original Tinkerforge API are overly complex. I theref
|
|
141
141
|
- `IPConnection.register_callback(callback_id, function)`: Replaced by `register_event_queue()`
|
142
142
|
- `IPConnection.connect(host, port=4223, authentication_secret='')`: If `authentication_secret` is not empty, try to authenticate.
|
143
143
|
|
144
|
-
- ### [
|
144
|
+
- ### [IO-4 Bricklet 2.0](https://www.tinkerforge.com/de/doc/Software/Bricklets/IO4V2_Bricklet_Python.html)
|
145
145
|
- `BrickletIO4V2.set_pwm_configuration()` will now take the frequency in units of Hz and the duty cycle is normalized to 1, so it will take a float from [0...1].
|
146
|
-
- `BrickletIO4V2.get_pwm_configuration()` will return the frequency in units of
|
146
|
+
- `BrickletIO4V2.get_pwm_configuration()` will return the frequency in units of Hz and the duty cycle is normalized to 1.
|
147
|
+
- `BrickletIO4V2.set_edge_count_callback_configuration()` sets the callback configuration for the edge counter callback. Its secondary ids are in [5...8] for channels [0...3].
|
148
|
+
- `BrickletIO4V2.get_edge_count_callback_configuration()` returns the callback configuration for the edge counter callback.
|
147
149
|
|
148
150
|
- ### [Master Brick](https://www.tinkerforge.com/en/doc/Software/Bricks/Master_Brick_Python.html)
|
149
151
|
- `BrickMaster.set_wifi_configuration()`/`BrickMaster.get_wifi_configuration()` will take/return all ips in natural order
|
@@ -163,7 +165,6 @@ Some design choices of the original Tinkerforge API are overly complex. I theref
|
|
163
165
|
- `BrickletThermocoupleV2()` takes an additional parameter to define the type of sensor. The options are of type `BrickletThermocoupleV2.SensorType`. The default is `BrickletPtc.SensorType.TYPE_K`.
|
164
166
|
- `BrickletThermocoupleV2.sensor_type` getter and setter to change the type of sensor used.
|
165
167
|
|
166
|
-
|
167
168
|
- ### [Segment Display 4x7 Bricklet 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Segment_Display_4x7_V2.html)
|
168
169
|
- `BrickletSegmentDisplay4x7V2.set_segments()` takes a `list`/`tuple` of 4 `int` instead of digit0, digit1, digit2, digit3. This is the same API as the older [Segment Display 4x7 Bricklet](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Segment_Display_4x7.html).
|
169
170
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
[project]
|
2
|
-
name = "
|
2
|
+
name = "tinkerforge-async"
|
3
3
|
authors = [
|
4
4
|
{ name="Patrick Baus", email="patrick.baus@physik.tu-darmstadt.de" },
|
5
5
|
]
|
@@ -9,8 +9,6 @@ license = { text="GNU General Public License v3 (GPLv3)" }
|
|
9
9
|
requires-python = ">=3.7"
|
10
10
|
classifiers = [
|
11
11
|
"Programming Language :: Python :: 3",
|
12
|
-
"Programming Language :: Python :: 3.7",
|
13
|
-
"Programming Language :: Python :: 3.8",
|
14
12
|
"Programming Language :: Python :: 3.9",
|
15
13
|
"Programming Language :: Python :: 3.10",
|
16
14
|
"Programming Language :: Python :: 3.11",
|
@@ -3,6 +3,7 @@ This is a reimplementation of the Tinkerforge Python bindings
|
|
3
3
|
([original Python bindings](https://www.tinkerforge.com/en/doc/Software/API_Bindings_Python.html)) using Python 3
|
4
4
|
asyncio.
|
5
5
|
"""
|
6
|
+
|
6
7
|
from ._version import __version__
|
7
8
|
from .device_factory import device_factory
|
8
9
|
from .ip_connection import IPConnectionAsync
|
@@ -1,2 +1,2 @@
|
|
1
1
|
# pylint: disable=missing-module-docstring
|
2
|
-
__version__ = "1.
|
2
|
+
__version__ = "1.6.0"
|
@@ -2,13 +2,14 @@
|
|
2
2
|
A lightweight event bus for the asyncio framework, that relies on asynchronous
|
3
3
|
generators to deliver messages.
|
4
4
|
"""
|
5
|
+
|
5
6
|
import asyncio
|
6
7
|
from typing import Any, AsyncGenerator
|
7
8
|
|
8
9
|
|
9
10
|
class EventBus:
|
10
11
|
"""
|
11
|
-
An event bus
|
12
|
+
An event bus that is using the async generator syntax for distributing events.
|
12
13
|
It uses dicts and sets internally to ensure good performance.
|
13
14
|
"""
|
14
15
|
|
@@ -17,7 +18,7 @@ class EventBus:
|
|
17
18
|
|
18
19
|
async def register(self, event_name: str) -> AsyncGenerator[Any, None]:
|
19
20
|
"""
|
20
|
-
The async generator
|
21
|
+
The async generator that yields events subscribed to `event_name`.
|
21
22
|
|
22
23
|
Parameters
|
23
24
|
----------
|
@@ -3,6 +3,7 @@ Module for the Tinkerforge Master Brick (https://www.tinkerforge.com/en/doc/Hard
|
|
3
3
|
implemented using Python AsyncIO. It does the low-level communication with the Tinkerforge ip connection and also
|
4
4
|
handles conversion of raw units to SI units.
|
5
5
|
"""
|
6
|
+
|
6
7
|
# pylint: disable=too-many-lines
|
7
8
|
from __future__ import annotations
|
8
9
|
|
@@ -1251,7 +1252,7 @@ class BrickMaster(DeviceWithMCU): # pylint: disable=too-many-public-methods
|
|
1251
1252
|
)
|
1252
1253
|
return unpack_payload(payload, "!")
|
1253
1254
|
|
1254
|
-
async def set_wifi_configuration( # pylint: disable=too-many-arguments
|
1255
|
+
async def set_wifi_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
1255
1256
|
self,
|
1256
1257
|
ssid: str | bytes,
|
1257
1258
|
connection: _WifiConnection | int,
|
@@ -1333,7 +1334,7 @@ class BrickMaster(DeviceWithMCU): # pylint: disable=too-many-public-methods
|
|
1333
1334
|
ssid, WifiConnection(connection), ip_addr[::-1], subnet_mask[::-1], gateway[::-1], port
|
1334
1335
|
)
|
1335
1336
|
|
1336
|
-
async def set_wifi_encryption( # pylint: disable=too-many-arguments
|
1337
|
+
async def set_wifi_encryption( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
1337
1338
|
self,
|
1338
1339
|
encryption: WifiEncryptionMode,
|
1339
1340
|
key_index: int = 1,
|
@@ -2083,7 +2084,7 @@ class BrickMaster(DeviceWithMCU): # pylint: disable=too-many-public-methods
|
|
2083
2084
|
|
2084
2085
|
return unpack_payload(payload, "!")
|
2085
2086
|
|
2086
|
-
async def set_ethernet_configuration( # pylint: disable=too-many-arguments
|
2087
|
+
async def set_ethernet_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
2087
2088
|
self,
|
2088
2089
|
connection: _EthernetConnection,
|
2089
2090
|
ip_address: tuple[int, int, int, int] = (0, 0, 0, 0),
|
@@ -2509,7 +2510,7 @@ class BrickMaster(DeviceWithMCU): # pylint: disable=too-many-public-methods
|
|
2509
2510
|
|
2510
2511
|
return unpack_payload(payload, "64s")
|
2511
2512
|
|
2512
|
-
async def set_wifi2_configuration( # pylint: disable=too-many-arguments
|
2513
|
+
async def set_wifi2_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
2513
2514
|
self,
|
2514
2515
|
port: int = 4223,
|
2515
2516
|
websocket_port: int = 4280,
|
@@ -2635,7 +2636,7 @@ class BrickMaster(DeviceWithMCU): # pylint: disable=too-many-public-methods
|
|
2635
2636
|
ap_connected_count,
|
2636
2637
|
)
|
2637
2638
|
|
2638
|
-
async def set_wifi2_client_configuration( # pylint: disable=too-many-arguments
|
2639
|
+
async def set_wifi2_client_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
2639
2640
|
self,
|
2640
2641
|
enable: bool = True,
|
2641
2642
|
ssid: bytes | str = "tinkerforge",
|
@@ -2808,7 +2809,7 @@ class BrickMaster(DeviceWithMCU): # pylint: disable=too-many-public-methods
|
|
2808
2809
|
)
|
2809
2810
|
return unpack_payload(payload, "64s")
|
2810
2811
|
|
2811
|
-
async def set_wifi2_ap_configuration( # pylint: disable=too-many-arguments
|
2812
|
+
async def set_wifi2_ap_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
2812
2813
|
self,
|
2813
2814
|
enable: bool = True,
|
2814
2815
|
ssid: bytes | str = "WIFI Extension 2.0 Access Point",
|
@@ -3025,7 +3026,7 @@ class BrickMaster(DeviceWithMCU): # pylint: disable=too-many-public-methods
|
|
3025
3026
|
)
|
3026
3027
|
return unpack_payload(payload, "!")
|
3027
3028
|
|
3028
|
-
async def set_wifi2_mesh_configuration( # pylint: disable=too-many-arguments
|
3029
|
+
async def set_wifi2_mesh_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
3029
3030
|
self,
|
3030
3031
|
enable: bool = False,
|
3031
3032
|
root_ip: tuple[int, int, int, int] = (0, 0, 0, 0),
|
{tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_ambient_light_v2.py
RENAMED
@@ -3,6 +3,7 @@ Module for the Tinkerforge Ambient Light Bricklet 2.0
|
|
3
3
|
(https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Ambient_Light_V2.html) implemented using Python asyncio. It does
|
4
4
|
the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units.
|
5
5
|
"""
|
6
|
+
|
6
7
|
# pylint: disable=duplicate-code # Many sensors of different generations have a similar API
|
7
8
|
from __future__ import annotations
|
8
9
|
|
@@ -130,7 +131,7 @@ class BrickletAmbientLightV2(Device):
|
|
130
131
|
|
131
132
|
return await self.get_illuminance()
|
132
133
|
|
133
|
-
async def set_callback_configuration( # pylint: disable=too-many-arguments,unused-argument
|
134
|
+
async def set_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments,unused-argument
|
134
135
|
self,
|
135
136
|
sid: int,
|
136
137
|
period: int = 0,
|
{tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_ambient_light_v3.py
RENAMED
@@ -3,6 +3,7 @@ Module for the Tinkerforge Ambient Light Bricklet 3.0
|
|
3
3
|
(https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Ambient_Light_V3.html) implemented using Python asyncio. It does
|
4
4
|
the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units.
|
5
5
|
"""
|
6
|
+
|
6
7
|
# pylint: disable=duplicate-code # Many sensors of different generations have a similar API
|
7
8
|
from __future__ import annotations
|
8
9
|
|
@@ -123,7 +124,7 @@ class BrickletAmbientLightV3(BrickletWithMCU):
|
|
123
124
|
|
124
125
|
return await self.get_illuminance()
|
125
126
|
|
126
|
-
async def set_callback_configuration( # pylint: disable=too-many-arguments
|
127
|
+
async def set_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
127
128
|
self,
|
128
129
|
sid: int,
|
129
130
|
period: int = 0,
|
@@ -166,7 +167,7 @@ class BrickletAmbientLightV3(BrickletWithMCU):
|
|
166
167
|
print(unpack_payload(payload, "I"))
|
167
168
|
return self.__value_to_si(unpack_payload(payload, "I"))
|
168
169
|
|
169
|
-
async def set_illuminance_callback_configuration( # pylint: disable=too-many-arguments
|
170
|
+
async def set_illuminance_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
170
171
|
self,
|
171
172
|
period: int = 0,
|
172
173
|
value_has_to_change: bool = False,
|
@@ -3,6 +3,7 @@ Module for the Tinkerforge Analog In Bricklet (https://www.tinkerforge.com/en/do
|
|
3
3
|
implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also
|
4
4
|
handles conversion of raw units to SI units.
|
5
5
|
"""
|
6
|
+
|
6
7
|
# pylint: disable=duplicate-code # Many sensors of different generations have a similar API
|
7
8
|
from __future__ import annotations
|
8
9
|
|
@@ -124,7 +125,7 @@ class BrickletAnalogIn(Device):
|
|
124
125
|
return await self.get_voltage()
|
125
126
|
return await self.get_analog_value()
|
126
127
|
|
127
|
-
async def set_callback_configuration( # pylint: disable=too-many-arguments,unused-argument
|
128
|
+
async def set_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments,unused-argument
|
128
129
|
self,
|
129
130
|
sid: int,
|
130
131
|
period: int = 0,
|
@@ -3,6 +3,7 @@ Module for the Tinkerforge Barometer Bricklet (https://www.tinkerforge.com/en/do
|
|
3
3
|
implemented using Python AsyncIO. It does the low-level communication with the Tinkerforge ip connection and also
|
4
4
|
handles conversion of raw units to SI units.
|
5
5
|
"""
|
6
|
+
|
6
7
|
# pylint: disable=duplicate-code # Many sensors of different generations have a similar API
|
7
8
|
from __future__ import annotations
|
8
9
|
|
@@ -106,7 +107,7 @@ class BrickletBarometer(Device): # pylint: disable=too-many-public-methods
|
|
106
107
|
return await self.get_air_pressure()
|
107
108
|
return await self.get_altitude()
|
108
109
|
|
109
|
-
async def set_callback_configuration( # pylint: disable=too-many-arguments,unused-argument
|
110
|
+
async def set_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments,unused-argument
|
110
111
|
self,
|
111
112
|
sid: int,
|
112
113
|
period: int = 0,
|
{tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_barometer_v2.py
RENAMED
@@ -3,6 +3,7 @@ Module for the Tinkerforge Barometer Bricklet 2.0
|
|
3
3
|
(https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Barometer_V2.html) implemented using Python asyncio. It does the
|
4
4
|
low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units.
|
5
5
|
"""
|
6
|
+
|
6
7
|
# pylint: disable=duplicate-code # Many sensors of different generations have a similar API
|
7
8
|
from __future__ import annotations
|
8
9
|
|
@@ -148,7 +149,7 @@ class BrickletBarometerV2(BrickletWithMCU): # pylint: disable=too-many-public-m
|
|
148
149
|
return await self.get_altitude()
|
149
150
|
return await self.get_temperature()
|
150
151
|
|
151
|
-
async def set_callback_configuration( # pylint: disable=too-many-arguments
|
152
|
+
async def set_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
152
153
|
self,
|
153
154
|
sid: int,
|
154
155
|
period: int = 0,
|
@@ -198,7 +199,7 @@ class BrickletBarometerV2(BrickletWithMCU): # pylint: disable=too-many-public-m
|
|
198
199
|
)
|
199
200
|
return self.__air_pressure_sensor_to_si(unpack_payload(payload, "i"))
|
200
201
|
|
201
|
-
async def set_air_pressure_callback_configuration( # pylint: disable=too-many-arguments
|
202
|
+
async def set_air_pressure_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
202
203
|
self,
|
203
204
|
period: int = 0,
|
204
205
|
value_has_to_change: bool = False,
|
@@ -282,7 +283,7 @@ class BrickletBarometerV2(BrickletWithMCU): # pylint: disable=too-many-public-m
|
|
282
283
|
)
|
283
284
|
return self.__altitude_sensor_to_si(unpack_payload(payload, "i"))
|
284
285
|
|
285
|
-
async def set_altitude_callback_configuration( # pylint: disable=too-many-arguments
|
286
|
+
async def set_altitude_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
286
287
|
self,
|
287
288
|
period: int = 0,
|
288
289
|
value_has_to_change: bool = False,
|
@@ -366,7 +367,7 @@ class BrickletBarometerV2(BrickletWithMCU): # pylint: disable=too-many-public-m
|
|
366
367
|
)
|
367
368
|
return self.__temperature_sensor_to_si(unpack_payload(payload, "i"))
|
368
369
|
|
369
|
-
async def set_temperature_callback_configuration( # pylint: disable=too-many-arguments
|
370
|
+
async def set_temperature_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
370
371
|
self,
|
371
372
|
period: int = 0,
|
372
373
|
value_has_to_change: bool = False,
|
@@ -3,6 +3,7 @@ Module for the Tinkerforge Humidity Bricklet (https://www.tinkerforge.com/en/doc
|
|
3
3
|
implemented using Python AsyncIO. It does the low-level communication with the Tinkerforge ip connection and also
|
4
4
|
handles conversion of raw units to SI units.
|
5
5
|
"""
|
6
|
+
|
6
7
|
# pylint: disable=duplicate-code # Many sensors of different generations have a similar API
|
7
8
|
from __future__ import annotations
|
8
9
|
|
@@ -96,7 +97,7 @@ class BrickletHumidity(Device):
|
|
96
97
|
return await self.get_humidity()
|
97
98
|
return await self.get_analog_value()
|
98
99
|
|
99
|
-
async def set_callback_configuration( # pylint: disable=too-many-arguments,unused-argument
|
100
|
+
async def set_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments,unused-argument
|
100
101
|
self,
|
101
102
|
sid: int,
|
102
103
|
period: int = 0,
|
{tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_humidity_v2.py
RENAMED
@@ -3,6 +3,7 @@ Module for the Tinkerforge Humidity Bricklet 2.0
|
|
3
3
|
(https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Humidity_V2.html) implemented using Python asyncIO. It does the
|
4
4
|
low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units.
|
5
5
|
"""
|
6
|
+
|
6
7
|
# pylint: disable=duplicate-code # Many sensors of different generations have a similar API
|
7
8
|
from __future__ import annotations
|
8
9
|
|
@@ -128,7 +129,7 @@ class BrickletHumidityV2(BrickletWithMCU):
|
|
128
129
|
return await self.get_humidity()
|
129
130
|
return await self.get_temperature()
|
130
131
|
|
131
|
-
async def set_callback_configuration( # pylint: disable=too-many-arguments
|
132
|
+
async def set_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
132
133
|
self,
|
133
134
|
sid: int,
|
134
135
|
period: int = 0,
|
@@ -175,7 +176,7 @@ class BrickletHumidityV2(BrickletWithMCU):
|
|
175
176
|
)
|
176
177
|
return self.__humidity_sensor_to_si(unpack_payload(payload, "H"))
|
177
178
|
|
178
|
-
async def set_humidity_callback_configuration( # pylint: disable=too-many-arguments
|
179
|
+
async def set_humidity_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
179
180
|
self,
|
180
181
|
period: int = 0,
|
181
182
|
value_has_to_change: bool = False,
|
@@ -266,7 +267,7 @@ class BrickletHumidityV2(BrickletWithMCU):
|
|
266
267
|
)
|
267
268
|
return self.__temperature_sensor_to_si(unpack_payload(payload, "h"))
|
268
269
|
|
269
|
-
async def set_temperature_callback_configuration( # pylint: disable=too-many-arguments
|
270
|
+
async def set_temperature_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
270
271
|
self,
|
271
272
|
period: int = 0,
|
272
273
|
value_has_to_change: bool = False,
|
@@ -4,6 +4,7 @@ Module for the Tinkerforge Industrial Dual Analog In Bricklet 2.0
|
|
4
4
|
asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units
|
5
5
|
to SI units.
|
6
6
|
"""
|
7
|
+
|
7
8
|
# pylint: disable=duplicate-code # Many sensors of different generations have a similar API
|
8
9
|
from __future__ import annotations
|
9
10
|
|
@@ -20,7 +21,9 @@ from .devices import (
|
|
20
21
|
SimpleCallbackConfiguration,
|
21
22
|
)
|
22
23
|
from .devices import ThresholdOption as Threshold
|
23
|
-
from .devices import
|
24
|
+
from .devices import (
|
25
|
+
_FunctionID,
|
26
|
+
)
|
24
27
|
from .ip_connection_helper import pack_payload, unpack_payload
|
25
28
|
|
26
29
|
if TYPE_CHECKING:
|
@@ -148,7 +151,7 @@ class BrickletIndustrialDualAnalogInV2(BrickletWithMCU):
|
|
148
151
|
return await self.get_voltage(sid)
|
149
152
|
return await self.get_all_voltages()
|
150
153
|
|
151
|
-
async def set_callback_configuration( # pylint: disable=too-many-arguments
|
154
|
+
async def set_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
152
155
|
self,
|
153
156
|
sid: int,
|
154
157
|
period: int = 0,
|
@@ -196,7 +199,7 @@ class BrickletIndustrialDualAnalogInV2(BrickletWithMCU):
|
|
196
199
|
)
|
197
200
|
return self.__value_to_si(unpack_payload(payload, "i"))
|
198
201
|
|
199
|
-
async def set_voltage_callback_configuration( # pylint: disable=too-many-arguments
|
202
|
+
async def set_voltage_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
200
203
|
self,
|
201
204
|
channel: int,
|
202
205
|
period: int = 0,
|
@@ -429,7 +432,7 @@ class BrickletIndustrialDualAnalogInV2(BrickletWithMCU):
|
|
429
432
|
|
430
433
|
return LedConfig(unpack_payload(payload, "B"))
|
431
434
|
|
432
|
-
async def set_channel_led_status_config( # pylint: disable=too-many-arguments
|
435
|
+
async def set_channel_led_status_config( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
433
436
|
self,
|
434
437
|
channel: int,
|
435
438
|
minimum: float | Decimal,
|
{tinkerforge_async-1.5.2 → tinkerforge_async-1.6.0}/tinkerforge_async/bricklet_industrial_ptc.py
RENAMED
@@ -4,6 +4,7 @@ Module for the Tinkerforge Industrial PTC Bricklet
|
|
4
4
|
implemented using Python asyncIO. It does the low-level communication with the Tinkerforge ip connection and also
|
5
5
|
handles conversion of raw units to SI units.
|
6
6
|
"""
|
7
|
+
|
7
8
|
from .bricklet_ptc_v2 import BrickletPtcV2
|
8
9
|
from .devices import DeviceIdentifier
|
9
10
|
|
@@ -3,6 +3,7 @@ Module for the Tinkerforge IO-16 Bricklet (https://www.tinkerforge.com/en/doc/Ha
|
|
3
3
|
implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also
|
4
4
|
handles conversion of raw units to SI units.
|
5
5
|
"""
|
6
|
+
|
6
7
|
# pylint: disable=duplicate-code # Many sensors of different generations have a similar API
|
7
8
|
from __future__ import annotations
|
8
9
|
|
@@ -209,7 +210,7 @@ class BrickletIO16(Device):
|
|
209
210
|
)
|
210
211
|
return unpack_payload(payload, "B")
|
211
212
|
|
212
|
-
async def set_port_configuration( # pylint: disable=too-many-arguments
|
213
|
+
async def set_port_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
213
214
|
self,
|
214
215
|
port: _Port | str,
|
215
216
|
selection_mask: int,
|
@@ -277,7 +278,7 @@ class BrickletIO16(Device):
|
|
277
278
|
)
|
278
279
|
return GetPortConfiguration(*unpack_payload(payload, "B B"))
|
279
280
|
|
280
|
-
async def set_callback_configuration( # pylint: disable=too-many-arguments,unused-argument
|
281
|
+
async def set_callback_configuration( # pylint: disable=too-many-arguments,too-many-positional-arguments,unused-argument
|
281
282
|
self,
|
282
283
|
sid: int,
|
283
284
|
period: int = 0,
|
@@ -287,16 +288,16 @@ class BrickletIO16(Device):
|
|
287
288
|
maximum: float | Decimal | None = None,
|
288
289
|
response_expected: bool = True,
|
289
290
|
) -> None:
|
290
|
-
port = Port.A if sid <
|
291
|
+
port = Port.A if sid < 8 else Port.B
|
291
292
|
interrupt_mask = await self.get_port_interrupt(port)
|
292
|
-
interrupt_mask &= ~(1 << (sid %
|
293
|
-
interrupt_mask |= int(bool(period)) << (sid %
|
293
|
+
interrupt_mask &= ~(1 << (sid % 8)) # Reset the bit a position sid
|
294
|
+
interrupt_mask |= int(bool(period)) << (sid % 8) # if period is non-zero, enable the interrupt
|
294
295
|
await self.set_port_interrupt(port, interrupt_mask)
|
295
296
|
|
296
297
|
async def get_callback_configuration(self, sid: int) -> AdvancedCallbackConfiguration:
|
297
|
-
port = Port.A if sid <
|
298
|
+
port = Port.A if sid < 8 else Port.B
|
298
299
|
interrupt_mask = await self.get_port_interrupt(port)
|
299
|
-
value = interrupt_mask & (1 << (sid %
|
300
|
+
value = interrupt_mask & (1 << (sid % 8))
|
300
301
|
return AdvancedCallbackConfiguration(int(bool(value)), False, None, None, None)
|
301
302
|
|
302
303
|
async def set_debounce_period(self, debounce_period: int = 100, response_expected: bool = True) -> None:
|
@@ -359,7 +360,7 @@ class BrickletIO16(Device):
|
|
359
360
|
)
|
360
361
|
return unpack_payload(payload, "B")
|
361
362
|
|
362
|
-
async def set_port_monoflop( # pylint: disable=too-many-arguments
|
363
|
+
async def set_port_monoflop( # pylint: disable=too-many-arguments,too-many-positional-arguments
|
363
364
|
self, port: _Port | str, selection_mask: int, value_mask: int, time: int, response_expected: bool = True
|
364
365
|
) -> None:
|
365
366
|
"""
|
@@ -445,7 +446,7 @@ class BrickletIO16(Device):
|
|
445
446
|
|
446
447
|
.. versionadded:: 2.0.3$nbsp;(Plugin)
|
447
448
|
"""
|
448
|
-
assert isinstance(pin, int) and (0 <= pin <=
|
449
|
+
assert isinstance(pin, int) and (0 <= pin <= 1)
|
449
450
|
|
450
451
|
_, payload = await self.ipcon.send_request(
|
451
452
|
device=self,
|
@@ -496,7 +497,7 @@ class BrickletIO16(Device):
|
|
496
497
|
|
497
498
|
.. versionadded:: 2.0.3$nbsp;(Plugin)
|
498
499
|
"""
|
499
|
-
assert isinstance(pin, int) and (0 <= pin <=
|
500
|
+
assert isinstance(pin, int) and (0 <= pin <= 1)
|
500
501
|
|
501
502
|
_, payload = await self.ipcon.send_request(
|
502
503
|
device=self,
|