Simple Wappsto Python user-interface to Wappsto IoT
Project description
Wappsto IoT
The wappstoiot module provide a simple python interface to wappsto.com for easy prototyping.
Prerequisites
A wappsto.com Account, that the unit can connect to.
The wappsto module requires a set of certificates for authentication. The certificates can be downloaded from wappsto.com, or with the build-in CLI tool: python3 -m wappstoiot
.
The certificates provides the unit with the secure connection to wappsto.com.
To read more about how the Wappsto IoT inner workings, go here.
The Basics
To understand how to use Wappsto IoT, there is some terms that need to be known.
- Control
- Change request value.
- Report
- The current value.
- Refresh
- Value Update request.
- Delete
- inform that a delete have happened.
- network -> device -> value
- ...
Getting Started
Installation using pip
The wappsto module can be installed using PIP (Python Package Index) as follows:
$ pip install -U wappstoiot
Working examples of usage can be found in the example folder.
The needed certificates can be downloaded with IoT Certificate Manager. Where path is the path to the config-folder, given in the following code example.
Echo example
The following explains the example code found in echo.py.
wappstoiot.config(
config_Folder="echo"
)
network = wappstoiot.createNetwork(
name="echo",
)
device = network.createDevice(
name="EchoDevice"
)
value = device.createValue(
name="Moeller",
permission=wappstoiot.PermissionType.READWRITE,
value_template=wappstoiot.ValueTemplate.STRING
)
value.onControl(
callback=lambda obj, new_value: obj.report(new_value)
)
value.onRefresh(
callback=lambda obj: obj.report(f"{obj.data} Refreshed!")
)
try:
while True:
time.sleep(0.5)
except KeyboardInterrupt:
pass
finally:
wappstoiot.close()
License
This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.
v0.8.0 (Nov 17 2023)
Added
- Period and Delta functionality.
- Can now send log data. Log data are not shown as a new value update.
- Option in
config
to set rpc_timeout. - Added
max_reconnect_retry_count
in config, when reach it will raise a ConnectionError. - Devices
createValue
now takeperiod
&delta
settings.
Fixed
- Fixed an issue that resulted in refresh did not work.
- Fix a issue there the Value type was not properly changed on value type change.
Changed
wait_for_offline_storage
now had a retry option, where it make a socket reconnect on timeout util the retry count reached.
v0.7.1 (Sep 26 2023)
Added
- Added functionality to check offline storage stored size. (
wappsto.iot.offline_storage_size
) - Added functionality to wait for offline storage to upload all. (
wappsto.iot.wait_for_offline_storage
) - OfflineStorage ABC class now contain a
storage_size
method. - Functions
connect
,disconnect
&reconnect
is now implemented.
Fixed
- Issue where it could not resend offline data after migration to Pydantic 2.
v0.7.0 (Sep 22 2023)
Changed
- Breaking Change! - If the server do not reply on any messages, it will now cast a
TimeoutError
exception.
v0.6.10 (Sep 15 2023)
Added
remove_illegal_characters
function to help remove the illegal characters.
Changed
- Extended the legal characters list for name.
- Migrated to Pydantic 2.
v0.6.9 (Aug 18 2023)
Removed
- The CLI interface to create certificates. Use
https://wappsto.com/store/application/iot_certificate_manager
instead. - Remove the
Tracer
(Package flow tracing).
Changed
- Pydantic version to be between 1.0.0 & 2.0.0 for better compatibility.
v0.6.8 (Aug 04 2023)
Added
report
now take aLogValue
or a list ofLogValue
s.
Changed
- It will now bulk report data, if a list af
LogValue
s is given. - Bulk report data will now be sorted.
Fixed
- Handle a rare error case from the server.
v0.6.7 (Jul 07 2023)
Added
- Scandinavian special letters to the legal list
Changed
- Updated the
wappstoiot.ValueTemplate
to version v0.0.5 - Set Pydantic version to be
v1.10.11
until migration tov2
is done.
v0.6.6 (Jun 22 2023)
Added
- Code Stub.
Changed
- Now inform which characters are illegal in the given name.
Fixed
- The
getReportTimestamp
&getControlTimestamp
now ensures the return isNone
or of type datetime.
v0.6.5 (Feb 28 2023)
Fixed
- Report & Control now generate a timestamp in UTC time.
v0.6.4 (Feb 27 2023)
Added
- onControlCancel
- onReportCancel
Fixed
- Check on the argument count on callbacks on adding them.
- Now the on-function returns the callback it was given.
- Should now covert the timestamp correctly.
- Fix an issue where it could not close the socket.
Changed
- Updated the
wappstoiot.ValueTemplate
to version 0.0.3
v0.6.3 (May 5 2022)
Fixed
- Fixed a issue with the control method, there it broke if it got out of sink with the report.
getReportData
now returns the Report data instead of control.- Fixed a issue that prevented in report/control values with old timestamps.
v0.6.2 (Mar 10 2022)
Fixed
- Now
pathlib.Path
can also be used for the config config_folder input. - Fixed a issue where it always where asking for the value.
- Fixed a issue where it did not create the need states, if the device existed.
- Fixed a issue where it will fail om the smallest schema change.
Changed
- Naming policy are now enforced. Have to be set, and may only contain: ALPHA/DIGIT/" . "/" ~ "/"(space)"/" - "/" _ "
- Breaking Change! - Changes the 'ValueTypes' to 'ValueTemplates', which are a more meaningful name. The createValue input 'value_type', have also change to 'value_template'
- Enforce the parameter-name for multiple inputs in the create-methods.
v0.6.1 (Feb 21 2022)
Changed
- Updated the ValueTypes to use the Default template values v0.0.1.
v0.6.0 (Jan 31 2022)
Added
- Ping-pong option in the config-method.
- fast_send option in the config-method.
Fixed
- Fix some issues that only happen on first time run.
- Fix a issue where if config was not called, the config-folder was not set to current folder.
- Fix a issue where offline storage, did not allow the program to stop, if there was still data to be send.
- Fix a issue with the way the certificates was created the right way, and is also claimed.
v0.5.5 (Dec 21 2021)
Fixed
- Fix a issue that prevented wappstoiot in creating a new value.
v0.5.4 (Dec 21 2021)
Added
- New Default Value-Types. (CO2, Humidity & Pressure Pascal).
Changed
- The createValue, are now split into 5.
createValue
that uses the predefined ValueType given, and 1 for each base value types, for when a custom is needed. permission
is now required.onControl
,onReport
,getControlData
&getReportData
provides a float if the value was set to be a number.
Fixed
- offline_Storage warnings now fixed.
- A issue where the
type
-value inside value where not set. - A issue where the step was set to a int, not a float.
wappstoiot.onStatus
should not be working correctly.
v0.5.3 (Dec 9, 2021)
Added
- Groove Examples for Raspberry Pi.
- Checks of naming, so it reuses the object based on the name. (Naming are mandatory now.)
wappstoiot.config
have been added to handle all the configs.wappstoiot.createNetwork
have been added to streamline the flow.value.getReportTimestamp()
,value.getControlTimestamp()
have been added to make the timestamp for the last given value accessible.value.getControlData()
have been added to make the control data accessible.
Removed
- Remove the Module ids. (The Names are now the unique identifier.)
- Remove
Rich
dependency.
Changed
- The names & naming convention to fix the other Wappsto Libraries.
- All the connections & general configs are moved from the Network, to wappstoiot.
value.data
have been changed tovalue.getReportData()
Fixed
- Fix the naming to fit the naming convention.
v0.5.2 (Nov 25, 2021)
Added
- HTTP Proxy support. (Pulls #259, #353)
Fixed
- Make WappstoIoT python3.6 compatible.
- Fix a Path issue that make the code not able to find the certificates in ipython.
v0.5.1 (Nov 23, 2021)
Added
- Pip release.
Fixed
- Fix the name to fit the naming convention.
v0.5.0 (September 20, 2021)
Added
- First Release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wappstoiot-0.8.0.tar.gz
.
File metadata
- Download URL: wappstoiot-0.8.0.tar.gz
- Upload date:
- Size: 57.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 602f596f4d2f99b21c56e3c6f8c5693640545e840f0cf1990ed0e75625f77b74 |
|
MD5 | 1b4de1059eece6679ad9e8337110f725 |
|
BLAKE2b-256 | f9d6d3bbd87064baedd79361b3e47242349b16d5f7eb5d37381cde6ec98d20cb |
File details
Details for the file wappstoiot-0.8.0-py3-none-any.whl
.
File metadata
- Download URL: wappstoiot-0.8.0-py3-none-any.whl
- Upload date:
- Size: 54.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6d91dfba1da27d2f233feded23fb3be92f0293e5f48a9bf01168e91e66fbc70 |
|
MD5 | 64eb8416e5594a7eb3ba322217b4df6b |
|
BLAKE2b-256 | 8aead47cb8408c8bb339b12e09448db7267964a8cf46c65f7fba44db508e9261 |