tinkerforge-async


Nametinkerforge-async JSON
Version 1.5.3 PyPI version JSON
download
home_pageNone
SummaryPython3 AsyncIO Tinkerforge driver
upload_time2024-06-22 11:53:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseGNU General Public License v3 (GPLv3)
keywords iot tinkerforge api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![pylint](../../actions/workflows/pylint.yml/badge.svg)](../../actions/workflows/pylint.yml)
[![PyPI](https://img.shields.io/pypi/v/tinkerforge-async)](https://pypi.org/project/tinkerforge-async/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tinkerforge-async)
![PyPI - Status](https://img.shields.io/pypi/status/tinkerforge-async)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](LICENSE)
[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
# TinkerforgeAsync
This is a reimplementation of the Tinkerforge Python bindings ([original Python bindings](https://www.tinkerforge.com/en/doc/Software/API_Bindings_Python.html)) using Python 3 asyncio. The original bindings used threads to manage the blocking operations. A much cleaner implementation is possible using the `await` syntax from asyncio.

**Note: This API implementation is not an official Tinkerforge implementation. I am in no way affiliated with the Tinkerforge GmbH. Use at your own risk. If you find any bugs, please report them.**

The library is fully type-hinted.

# Supported Bricks/Bricklets
|Brick|Supported|Tested|Comments|
|--|--|--|--|
|[Master](https://www.tinkerforge.com/en/doc/Hardware/Bricks/Master_Brick.html)|:heavy_check_mark:|:heavy_check_mark:|  |

| Bricklet                                                                                                                 |Supported|Tested|
|--------------------------------------------------------------------------------------------------------------------------|--|--|
| [Ambient Light 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Ambient_Light_V2.html)                         |:heavy_check_mark:|:heavy_check_mark:|
| [Ambient Light 3.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Ambient_Light_V3.html)                         |:heavy_check_mark:|:heavy_check_mark:|
| [Analog In](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Analog_In.html)                                        |:heavy_check_mark:|:heavy_check_mark:|
| [Barometer](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Barometer.html)                                        |:heavy_check_mark:|:heavy_check_mark:|
| [Barometer 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Barometer_V2.html)                                 |:heavy_check_mark:|:heavy_check_mark:|
| [Humidity](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Humidity.html)                                          |:heavy_check_mark:|:heavy_check_mark:|
| [Humidity 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Humidity_V2.html)                                   |:heavy_check_mark:|:heavy_check_mark:|
| [Industrial Dual Analog In 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Dual_Analog_In_V2.html) |:heavy_check_mark:|:heavy_check_mark:|
| [Industrial PTC](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_PTC.html)                              |:heavy_check_mark:|:heavy_check_mark:|
| [IO-4 2.0](https://www.tinkerforge.com/de/doc/Hardware/Bricklets/IO4_V2.html)                                            |:heavy_check_mark:|:heavy_check_mark:|
| [IO-16](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/IO16.html)                                                 |:heavy_check_mark:|:heavy_check_mark:|
| [Isolator](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Isolator.html)                                          |:heavy_check_mark:|:heavy_check_mark:|
| [Moisture](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Moisture.html)                                          |:heavy_check_mark:|:heavy_check_mark:|
| [Motion Detector 2.0](https://www.tinkerforge.com/de/doc/Hardware/Bricklets/Motion_Detector_V2.html)                     |:heavy_check_mark:|:heavy_check_mark:|
| [PTC](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/PTC.html)                                                    |:heavy_check_mark:|:heavy_check_mark:|
| [PTC 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/PTC_V2.html)                                             |:heavy_check_mark:|:heavy_check_mark:|
| [RS232 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/RS232_V2.html)                                         |:heavy_check_mark:|:heavy_check_mark:|
| [Segment Display 4x7](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Segment_Display_4x7.html)                    |:heavy_check_mark:|:heavy_check_mark:|
| [Segment Display 4x7 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Segment_Display_4x7_V2.html)             |:heavy_check_mark:|:heavy_check_mark:|
| [Temperature](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Temperature.html)                                    |:heavy_check_mark:|:heavy_check_mark:|
| [Temperature 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Temperature_V2.html)                             |:heavy_check_mark:|:heavy_check_mark:|
| [Thermocouple 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermocouple_V2.html)                           |:heavy_check_mark:|:heavy_check_mark:|

## Documentation
The documentation is currently work in progress. The full documentation will be moved to
[https://patrickbaus.github.io/tinkerforge_async/](https://patrickbaus.github.io/tinkerforge_async/). Below you can
find the current state of the documentation. I use the
[Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) style for documentation and
[Sphinx](https://www.sphinx-doc.org/en/master/index.html) for compiling it.

# Setup
To install the library in a virtual environment (always use venvs with every project):
```bash
python3 -m venv env  # virtual environment, optional
source env/bin/activate  # only if the virtual environment is used
pip install tinkerforge-async
```

# Changes made to the API
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:
## Design Changes
- Only Python 3 is supported (3.7+)
 - Replaced threads with an async event loop
 - 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.

   Old style:
   ```python
   bricklet = BrickletHumidity(UID, ipcon)
   bricklet.set_response_expected(
       BrickletHumidity.FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD, True
   )
   bricklet.set_humidity_callback_period(1000)
   ```
   New style:
   ```python
   bricklet = BrickletHumidity(UID, ipcon)
   await bricklet.set_humidity_callback_period(
       1000, response_expected=True
   )  # Raises an exception if unsuccessful
   ```
 - Replaced all constants with Enums and enforced their use using assertions. This will allow beginners to spot their mistakes earlier and make the code more readable, including any debug output statements.

   Old style:
   ```python
   class BrickletHumidity(Device):
       FUNCTION_GET_HUMIDITY = 1
       FUNCTION_GET_ANALOG_VALUE = 2
       FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD = 3
       FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD = 4
       FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD = 5
       FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD = 6
       FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD = 7
       FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD = 8
       FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD = 9
       FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD = 10
       FUNCTION_SET_DEBOUNCE_PERIOD = 11
       FUNCTION_GET_DEBOUNCE_PERIOD = 12
       FUNCTION_GET_IDENTITY = 255
   ```

   New style:
   ```python
   class BrickletHumidity(Device):
       @unique
       class FunctionID(Enum):
           GET_HUMIDITY = 1
           GET_ANALOG_VALUE = 2
           SET_HUMIDITY_CALLBACK_PERIOD = 3
           GET_HUMIDITY_CALLBACK_PERIOD = 4
           SET_ANALOG_VALUE_CALLBACK_PERIOD = 5
           GET_ANALOG_VALUE_CALLBACK_PERIOD = 6
           SET_HUMIDITY_CALLBACK_THRESHOLD = 7
           GET_HUMIDITY_CALLBACK_THRESHOLD = 8
           SET_ANALOG_VALUE_CALLBACK_THRESHOLD = 9
           GET_ANALOG_VALUE_CALLBACK_THRESHOLD = 10
           SET_DEBOUNCE_PERIOD = 11
           GET_DEBOUNCE_PERIOD = 12
   ```
 - Moved from base58 encoded uids to integers.
 - Moved from callbacks to queues in order to keep users out of the callback hell. It makes the code style more readable when using the `await` syntax anyway.
 - Payloads will now be decoded by the `Device` object and no longer by the `ip_connection`. This makes the code a lot more readable. To do so, the payload and decoded header will be handed to the device. It will then decode it, if possible, and pass it on to the queue.
 - If physical quantities are measured we will now return standard SI units, not some unexpected stuff like centi °C (Temperature Bricklet). To preserve the precision the Decimal package is used. The only exception to this rule is the use of °C for temperature. This is for convenience.
 - All callbacks now contain a timestamp (Unix timestamp) and the device object.

   Example:
   ```
    Event(timestamp=1658756708.6839857, sender=Temperature Bricklet 2.0 with uid 161085 connected at IPConnectionAsync(192.168.1.164:4223), sid=0, function_id=CallbackID.TEMPERATURE, payload=305.46)
   ```

 - Added the concept of secondary ids (`sid`). By default, the secondary id is `0`. If there is more than one sensor on the bricklet, they will have a `sid` value of 1,2, etc. This is especially useful for sensors like the [Industrial Dual Analog In Bricklet 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Dual_Analog_In_V2.html), which returns its two channels via the same callback.
 - New functions:

   `BrickMaster.set_wpa_enterprise_username(username)`: Set the WPA enterprise username without calling `BrickMaster.set_wifi_certificate()`. Takes a `string` instead of an array of `int`.
   `BrickMaster.set_wpa_enterprise_password(password)`: Set the WPA enterprise password without calling `BrickMaster.set_wifi_certificate()`. Takes a `string` instead of an array of `int`.
   `BrickMaster.get_wpa_enterprise_username()`: Get the WPA enterprise password without calling `BrickMaster.get_wifi_certificate()`. Also returns a `string` instead of an array of `int`.
   `BrickMaster.get_wpa_enterprise_password()`: Get the WPA enterprise password without calling `BrickMaster.get_wifi_certificate()`. Also returns a `string` instead of an array of `int`.

- ### [IP Connection](https://www.tinkerforge.com/en/doc/Software/IPConnection_Python.html#api)
   - `IPConnection.authenticate(secret)`: removed. This can now be done through connect()
   - `IPConnection.set_timeout/IPConnection.get_timeout`: Replaced by a property
   - `IPConnection.register_callback(callback_id, function)`: Replaced by `register_event_queue()`
   - `IPConnection.connect(host, port=4223, authentication_secret='')`: If `authentication_secret` is not empty, try to authenticate.

- ### [IP Connection](https://www.tinkerforge.com/de/doc/Software/Bricklets/IO4V2_Bricklet_Python.html)
   - `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].
   - `BrickletIO4V2.get_pwm_configuration()` will return the frequency in units of HZ and the duty cycle is normalized to 1.

- ### [Master Brick](https://www.tinkerforge.com/en/doc/Software/Bricks/Master_Brick_Python.html)
   - `BrickMaster.set_wifi_configuration()`/`BrickMaster.get_wifi_configuration()` will take/return all ips in natural order
   - `BrickMaster.set_ethernet_configuration()`/`BrickMaster.get_ethernet_configuration()` will take/return all ips in natural order
   - `BrickMaster.write_wifi2_serial_port()` will only accept a `bytestring` and no length argument. The length will be automatically determined from the string.
   - `BrickMaster.set_wifi2_status_led(enabled)` added. This allows setting the status led by value instead of calling `enable_wifi2_status_led`/`disable_wifi2_status_led`

- ### [PTC Bricklet](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/PTC.html)
   - `BrickletPtc()` takes an additional parameter to define the type of sensor. The options are `BrickletPtc.SensorType.PT_100` and `BrickletPtc.SensorType.PT_1000`. This only determines the resistance returned by the bricklet. The default is `BrickletPtc.SensorType.PT_100`.
   - `BrickletPtc.sensor_type` getter and setter to change the type of sensor used.

- ### [PTC Bricklet 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/PTC_V2.html)
   - `BrickletPtcV2()` takes an additional parameter to define the type of sensor. The options are `BrickletPtc.SensorType.PT_100` and `BrickletPtc.SensorType.PT_1000`. This only determines the resistance returned by the bricklet. The default is `BrickletPtc.SensorType.PT_100`.
   - `BrickletPtcV2.sensor_type` getter and setter to change the type of sensor used.

- ### [Thermocouple Bricklet 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermocouple_V2.html)
   - `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`.
   - `BrickletThermocoupleV2.sensor_type` getter and setter to change the type of sensor used.


- ### [Segment Display 4x7 Bricklet 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Segment_Display_4x7_V2.html)
   - `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).

# Setup
There are currently no packages available at the PyPi repository. To install the module, clone the repository and run:
```bash
python3 -m venv env  # virtual environment, optional
source env/bin/activate  # only if the virtual environment is used
python3 setup.py install
```

## Versioning
I use [SemVer](http://semver.org/) for versioning. For the versions available, see the
[tags on this repository](../../tags).

## Authors
* **Patrick Baus** - *Initial work* - [PatrickBaus](https://github.com/PatrickBaus)

## License
This project is licensed under the GPL v3 license - see the
[LICENSE](LICENSE) file for details

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tinkerforge-async",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "IoT, Tinkerforge, API",
    "author": null,
    "author_email": "Patrick Baus <patrick.baus@physik.tu-darmstadt.de>",
    "download_url": "https://files.pythonhosted.org/packages/42/9c/d199a595268b3e576b9db7eeded0435f13621f54a8f44efe2e96178ca2e0/tinkerforge_async-1.5.3.tar.gz",
    "platform": null,
    "description": "[![pylint](../../actions/workflows/pylint.yml/badge.svg)](../../actions/workflows/pylint.yml)\n[![PyPI](https://img.shields.io/pypi/v/tinkerforge-async)](https://pypi.org/project/tinkerforge-async/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tinkerforge-async)\n![PyPI - Status](https://img.shields.io/pypi/status/tinkerforge-async)\n[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](LICENSE)\n[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n# TinkerforgeAsync\nThis is a reimplementation of the Tinkerforge Python bindings ([original Python bindings](https://www.tinkerforge.com/en/doc/Software/API_Bindings_Python.html)) using Python 3 asyncio. The original bindings used threads to manage the blocking operations. A much cleaner implementation is possible using the `await` syntax from asyncio.\n\n**Note: This API implementation is not an official Tinkerforge implementation. I am in no way affiliated with the Tinkerforge GmbH. Use at your own risk. If you find any bugs, please report them.**\n\nThe library is fully type-hinted.\n\n# Supported Bricks/Bricklets\n|Brick|Supported|Tested|Comments|\n|--|--|--|--|\n|[Master](https://www.tinkerforge.com/en/doc/Hardware/Bricks/Master_Brick.html)|:heavy_check_mark:|:heavy_check_mark:|  |\n\n| Bricklet                                                                                                                 |Supported|Tested|\n|--------------------------------------------------------------------------------------------------------------------------|--|--|\n| [Ambient Light 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Ambient_Light_V2.html)                         |:heavy_check_mark:|:heavy_check_mark:|\n| [Ambient Light 3.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Ambient_Light_V3.html)                         |:heavy_check_mark:|:heavy_check_mark:|\n| [Analog In](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Analog_In.html)                                        |:heavy_check_mark:|:heavy_check_mark:|\n| [Barometer](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Barometer.html)                                        |:heavy_check_mark:|:heavy_check_mark:|\n| [Barometer 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Barometer_V2.html)                                 |:heavy_check_mark:|:heavy_check_mark:|\n| [Humidity](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Humidity.html)                                          |:heavy_check_mark:|:heavy_check_mark:|\n| [Humidity 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Humidity_V2.html)                                   |:heavy_check_mark:|:heavy_check_mark:|\n| [Industrial Dual Analog In 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Dual_Analog_In_V2.html) |:heavy_check_mark:|:heavy_check_mark:|\n| [Industrial PTC](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_PTC.html)                              |:heavy_check_mark:|:heavy_check_mark:|\n| [IO-4 2.0](https://www.tinkerforge.com/de/doc/Hardware/Bricklets/IO4_V2.html)                                            |:heavy_check_mark:|:heavy_check_mark:|\n| [IO-16](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/IO16.html)                                                 |:heavy_check_mark:|:heavy_check_mark:|\n| [Isolator](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Isolator.html)                                          |:heavy_check_mark:|:heavy_check_mark:|\n| [Moisture](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Moisture.html)                                          |:heavy_check_mark:|:heavy_check_mark:|\n| [Motion Detector 2.0](https://www.tinkerforge.com/de/doc/Hardware/Bricklets/Motion_Detector_V2.html)                     |:heavy_check_mark:|:heavy_check_mark:|\n| [PTC](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/PTC.html)                                                    |:heavy_check_mark:|:heavy_check_mark:|\n| [PTC 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/PTC_V2.html)                                             |:heavy_check_mark:|:heavy_check_mark:|\n| [RS232 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/RS232_V2.html)                                         |:heavy_check_mark:|:heavy_check_mark:|\n| [Segment Display 4x7](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Segment_Display_4x7.html)                    |:heavy_check_mark:|:heavy_check_mark:|\n| [Segment Display 4x7 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Segment_Display_4x7_V2.html)             |:heavy_check_mark:|:heavy_check_mark:|\n| [Temperature](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Temperature.html)                                    |:heavy_check_mark:|:heavy_check_mark:|\n| [Temperature 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Temperature_V2.html)                             |:heavy_check_mark:|:heavy_check_mark:|\n| [Thermocouple 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermocouple_V2.html)                           |:heavy_check_mark:|:heavy_check_mark:|\n\n## Documentation\nThe documentation is currently work in progress. The full documentation will be moved to\n[https://patrickbaus.github.io/tinkerforge_async/](https://patrickbaus.github.io/tinkerforge_async/). Below you can\nfind the current state of the documentation. I use the\n[Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) style for documentation and\n[Sphinx](https://www.sphinx-doc.org/en/master/index.html) for compiling it.\n\n# Setup\nTo install the library in a virtual environment (always use venvs with every project):\n```bash\npython3 -m venv env  # virtual environment, optional\nsource env/bin/activate  # only if the virtual environment is used\npip install tinkerforge-async\n```\n\n# Changes made to the API\nSome 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:\n## Design Changes\n- Only Python 3 is supported (3.7+)\n - Replaced threads with an async event loop\n - 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.\n\n   Old style:\n   ```python\n   bricklet = BrickletHumidity(UID, ipcon)\n   bricklet.set_response_expected(\n       BrickletHumidity.FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD, True\n   )\n   bricklet.set_humidity_callback_period(1000)\n   ```\n   New style:\n   ```python\n   bricklet = BrickletHumidity(UID, ipcon)\n   await bricklet.set_humidity_callback_period(\n       1000, response_expected=True\n   )  # Raises an exception if unsuccessful\n   ```\n - Replaced all constants with Enums and enforced their use using assertions. This will allow beginners to spot their mistakes earlier and make the code more readable, including any debug output statements.\n\n   Old style:\n   ```python\n   class BrickletHumidity(Device):\n       FUNCTION_GET_HUMIDITY = 1\n       FUNCTION_GET_ANALOG_VALUE = 2\n       FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD = 3\n       FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD = 4\n       FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD = 5\n       FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD = 6\n       FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD = 7\n       FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD = 8\n       FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD = 9\n       FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD = 10\n       FUNCTION_SET_DEBOUNCE_PERIOD = 11\n       FUNCTION_GET_DEBOUNCE_PERIOD = 12\n       FUNCTION_GET_IDENTITY = 255\n   ```\n\n   New style:\n   ```python\n   class BrickletHumidity(Device):\n       @unique\n       class FunctionID(Enum):\n           GET_HUMIDITY = 1\n           GET_ANALOG_VALUE = 2\n           SET_HUMIDITY_CALLBACK_PERIOD = 3\n           GET_HUMIDITY_CALLBACK_PERIOD = 4\n           SET_ANALOG_VALUE_CALLBACK_PERIOD = 5\n           GET_ANALOG_VALUE_CALLBACK_PERIOD = 6\n           SET_HUMIDITY_CALLBACK_THRESHOLD = 7\n           GET_HUMIDITY_CALLBACK_THRESHOLD = 8\n           SET_ANALOG_VALUE_CALLBACK_THRESHOLD = 9\n           GET_ANALOG_VALUE_CALLBACK_THRESHOLD = 10\n           SET_DEBOUNCE_PERIOD = 11\n           GET_DEBOUNCE_PERIOD = 12\n   ```\n - Moved from base58 encoded uids to integers.\n - Moved from callbacks to queues in order to keep users out of the callback hell. It makes the code style more readable when using the `await` syntax anyway.\n - Payloads will now be decoded by the `Device` object and no longer by the `ip_connection`. This makes the code a lot more readable. To do so, the payload and decoded header will be handed to the device. It will then decode it, if possible, and pass it on to the queue.\n - If physical quantities are measured we will now return standard SI units, not some unexpected stuff like centi \u00b0C (Temperature Bricklet). To preserve the precision the Decimal package is used. The only exception to this rule is the use of \u00b0C for temperature. This is for convenience.\n - All callbacks now contain a timestamp (Unix timestamp) and the device object.\n\n   Example:\n   ```\n    Event(timestamp=1658756708.6839857, sender=Temperature Bricklet 2.0 with uid 161085 connected at IPConnectionAsync(192.168.1.164:4223), sid=0, function_id=CallbackID.TEMPERATURE, payload=305.46)\n   ```\n\n - Added the concept of secondary ids (`sid`). By default, the secondary id is `0`. If there is more than one sensor on the bricklet, they will have a `sid` value of 1,2, etc. This is especially useful for sensors like the [Industrial Dual Analog In Bricklet 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Dual_Analog_In_V2.html), which returns its two channels via the same callback.\n - New functions:\n\n   `BrickMaster.set_wpa_enterprise_username(username)`: Set the WPA enterprise username without calling `BrickMaster.set_wifi_certificate()`. Takes a `string` instead of an array of `int`.\n   `BrickMaster.set_wpa_enterprise_password(password)`: Set the WPA enterprise password without calling `BrickMaster.set_wifi_certificate()`. Takes a `string` instead of an array of `int`.\n   `BrickMaster.get_wpa_enterprise_username()`: Get the WPA enterprise password without calling `BrickMaster.get_wifi_certificate()`. Also returns a `string` instead of an array of `int`.\n   `BrickMaster.get_wpa_enterprise_password()`: Get the WPA enterprise password without calling `BrickMaster.get_wifi_certificate()`. Also returns a `string` instead of an array of `int`.\n\n- ### [IP Connection](https://www.tinkerforge.com/en/doc/Software/IPConnection_Python.html#api)\n   - `IPConnection.authenticate(secret)`: removed. This can now be done through connect()\n   - `IPConnection.set_timeout/IPConnection.get_timeout`: Replaced by a property\n   - `IPConnection.register_callback(callback_id, function)`: Replaced by `register_event_queue()`\n   - `IPConnection.connect(host, port=4223, authentication_secret='')`: If `authentication_secret` is not empty, try to authenticate.\n\n- ### [IP Connection](https://www.tinkerforge.com/de/doc/Software/Bricklets/IO4V2_Bricklet_Python.html)\n   - `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].\n   - `BrickletIO4V2.get_pwm_configuration()` will return the frequency in units of HZ and the duty cycle is normalized to 1.\n\n- ### [Master Brick](https://www.tinkerforge.com/en/doc/Software/Bricks/Master_Brick_Python.html)\n   - `BrickMaster.set_wifi_configuration()`/`BrickMaster.get_wifi_configuration()` will take/return all ips in natural order\n   - `BrickMaster.set_ethernet_configuration()`/`BrickMaster.get_ethernet_configuration()` will take/return all ips in natural order\n   - `BrickMaster.write_wifi2_serial_port()` will only accept a `bytestring` and no length argument. The length will be automatically determined from the string.\n   - `BrickMaster.set_wifi2_status_led(enabled)` added. This allows setting the status led by value instead of calling `enable_wifi2_status_led`/`disable_wifi2_status_led`\n\n- ### [PTC Bricklet](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/PTC.html)\n   - `BrickletPtc()` takes an additional parameter to define the type of sensor. The options are `BrickletPtc.SensorType.PT_100` and `BrickletPtc.SensorType.PT_1000`. This only determines the resistance returned by the bricklet. The default is `BrickletPtc.SensorType.PT_100`.\n   - `BrickletPtc.sensor_type` getter and setter to change the type of sensor used.\n\n- ### [PTC Bricklet 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/PTC_V2.html)\n   - `BrickletPtcV2()` takes an additional parameter to define the type of sensor. The options are `BrickletPtc.SensorType.PT_100` and `BrickletPtc.SensorType.PT_1000`. This only determines the resistance returned by the bricklet. The default is `BrickletPtc.SensorType.PT_100`.\n   - `BrickletPtcV2.sensor_type` getter and setter to change the type of sensor used.\n\n- ### [Thermocouple Bricklet 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermocouple_V2.html)\n   - `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`.\n   - `BrickletThermocoupleV2.sensor_type` getter and setter to change the type of sensor used.\n\n\n- ### [Segment Display 4x7 Bricklet 2.0](https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Segment_Display_4x7_V2.html)\n   - `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).\n\n# Setup\nThere are currently no packages available at the PyPi repository. To install the module, clone the repository and run:\n```bash\npython3 -m venv env  # virtual environment, optional\nsource env/bin/activate  # only if the virtual environment is used\npython3 setup.py install\n```\n\n## Versioning\nI use [SemVer](http://semver.org/) for versioning. For the versions available, see the\n[tags on this repository](../../tags).\n\n## Authors\n* **Patrick Baus** - *Initial work* - [PatrickBaus](https://github.com/PatrickBaus)\n\n## License\nThis project is licensed under the GPL v3 license - see the\n[LICENSE](LICENSE) file for details\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3 (GPLv3)",
    "summary": "Python3 AsyncIO Tinkerforge driver",
    "version": "1.5.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/PatrickBaus/tinkerforge_async/issues",
        "Download": "https://github.com/PatrickBaus/tinkerforge_async/releases",
        "Homepage": "https://github.com/PatrickBaus/tinkerforge_async"
    },
    "split_keywords": [
        "iot",
        " tinkerforge",
        " api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6e80c9f17de5a2438f9bd94f140cb201ca04552ea8169435600ad2ab61da0d90",
                "md5": "d01f6e0afddcfe94934842f61675c00e",
                "sha256": "1c62629428d9aff5022a26e01cc2b9b543a79c017b5505f087a123e81df75488"
            },
            "downloads": -1,
            "filename": "tinkerforge_async-1.5.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d01f6e0afddcfe94934842f61675c00e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 137063,
            "upload_time": "2024-06-22T11:53:56",
            "upload_time_iso_8601": "2024-06-22T11:53:56.270313Z",
            "url": "https://files.pythonhosted.org/packages/6e/80/c9f17de5a2438f9bd94f140cb201ca04552ea8169435600ad2ab61da0d90/tinkerforge_async-1.5.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "429cd199a595268b3e576b9db7eeded0435f13621f54a8f44efe2e96178ca2e0",
                "md5": "5876a0c58c7669529dd2b836d443cc19",
                "sha256": "ccae473f2841f6db74e863f4849f029f380ad5b8022a8742ebd55e6c510edb23"
            },
            "downloads": -1,
            "filename": "tinkerforge_async-1.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "5876a0c58c7669529dd2b836d443cc19",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 95647,
            "upload_time": "2024-06-22T11:53:58",
            "upload_time_iso_8601": "2024-06-22T11:53:58.344117Z",
            "url": "https://files.pythonhosted.org/packages/42/9c/d199a595268b3e576b9db7eeded0435f13621f54a8f44efe2e96178ca2e0/tinkerforge_async-1.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-22 11:53:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PatrickBaus",
    "github_project": "tinkerforge_async",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tinkerforge-async"
}
        
Elapsed time: 0.67052s