Package: wappstoiot
Wappsto IoTThe wappstoiot module provide a simple python interface towappsto.comfor easy prototyping.PrerequisitesAwappsto.comAccount, that the unit can connect to.The wappsto module requires a set of certificates for authentication. The certificates can be downloaded fromwappsto.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, gohere.The BasicsTo understand how to use Wappsto IoT, there is some terms that need to be known.ControlChange request value.ReportThe current value.RefreshValue Update request.Deleteinform that a delete have happened.network -> device -> value...Getting StartedInstallation using pipThe wappsto module can be installed using PIP (Python Package Index) as follows:$pipinstall-UwappstoiotWorking examples of usage can be found in theexample folder.The needed certificates can be downloaded withIoT Certificate Manager.
Where path is the path to the config-folder, given in the following code example.Echo exampleThe following explains the example code found inecho.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=lambdaobj,new_value:obj.report(new_value))value.onRefresh(callback=lambdaobj:obj.report(f"{obj.data}Refreshed!"))try:whileTrue:time.sleep(0.5)exceptKeyboardInterrupt:passfinally:wappstoiot.close()LicenseThis project is licensed under the Apache License 2.0 - see theLICENSE.mdfile for details.v0.8.0 (Nov 17 2023)AddedPeriod and Delta functionality.Can now send log data. Log data are not shown as a new value update.Option inconfigto set rpc_timeout.Addedmax_reconnect_retry_countin config, when reach it will raise a ConnectionError.DevicescreateValuenow takeperiod&deltasettings.FixedFixed an issue that resulted in refresh did not work.Fix a issue there the Value type was not properly changed on value type change.Changedwait_for_offline_storagenow had a retry option, where it make a socket reconnect on timeout util the retry count reached.v0.7.1 (Sep 26 2023)AddedAdded 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 astorage_sizemethod.Functionsconnect,disconnect&reconnectis now implemented.FixedIssue where it could not resend offline data after migration to Pydantic 2.v0.7.0 (Sep 22 2023)ChangedBreaking Change! - If the server do not reply on any messages, it will now cast aTimeoutErrorexception.v0.6.10 (Sep 15 2023)Addedremove_illegal_charactersfunction to help remove the illegal characters.ChangedExtended the legal characters list for name.Migrated to Pydantic 2.v0.6.9 (Aug 18 2023)RemovedThe CLI interface to create certificates. Usehttps://wappsto.com/store/application/iot_certificate_managerinstead.Remove theTracer(Package flow tracing).ChangedPydantic version to be between 1.0.0 & 2.0.0 for better compatibility.v0.6.8 (Aug 04 2023)Addedreportnow take aLogValueor a list ofLogValues.ChangedIt will now bulk report data, if a list afLogValues is given.Bulk report data will now be sorted.FixedHandle a rare error case from the server.v0.6.7 (Jul 07 2023)AddedScandinavian special letters to the legal listChangedUpdated thewappstoiot.ValueTemplateto version v0.0.5Set Pydantic version to bev1.10.11until migration tov2is done.v0.6.6 (Jun 22 2023)AddedCode Stub.ChangedNow inform which characters are illegal in the given name.FixedThegetReportTimestamp&getControlTimestampnow ensures the return isNoneor of type datetime.v0.6.5 (Feb 28 2023)FixedReport & Control now generate a timestamp in UTC time.v0.6.4 (Feb 27 2023)AddedonControlCancelonReportCancelFixedCheck 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.ChangedUpdated thewappstoiot.ValueTemplateto version 0.0.3v0.6.3 (May 5 2022)FixedFixed a issue with the control method, there it broke if it got out of sink with the report.getReportDatanow 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)FixedNowpathlib.Pathcan 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.ChangedNaming 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)ChangedUpdated the ValueTypes to use the Default template values v0.0.1.v0.6.0 (Jan 31 2022)AddedPing-pong option in the config-method.fast_send option in the config-method.FixedFix 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)FixedFix a issue that prevented wappstoiot in creating a new value.v0.5.4 (Dec 21 2021)AddedNew Default Value-Types. (CO2, Humidity & Pressure Pascal).ChangedThe createValue, are now split into 5.createValuethat uses the predefined ValueType given, and 1 for each base value types, for when a custom is needed.permissionis now required.onControl,onReport,getControlData&getReportDataprovides a float if the value was set to be a number.Fixedoffline_Storage warnings now fixed.A issue where thetype-value inside value where not set.A issue where the step was set to a int, not a float.wappstoiot.onStatusshould not be working correctly.v0.5.3 (Dec 9, 2021)AddedGroove Examples for Raspberry Pi.Checks of naming, so it reuses the object based on the name. (Naming are mandatory now.)wappstoiot.confighave been added to handle all the configs.wappstoiot.createNetworkhave 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.RemovedRemove the Module ids. (The Names are now the unique identifier.)RemoveRichdependency.ChangedThe names & naming convention to fix the other Wappsto Libraries.All the connections & general configs are moved from the Network, to wappstoiot.value.datahave been changed tovalue.getReportData()FixedFix the naming to fit the naming convention.v0.5.2 (Nov 25, 2021)AddedHTTP Proxy support. (Pulls #259, #353)FixedMake 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)AddedPip release.FixedFix the name to fit the naming convention.v0.5.0 (September 20, 2021)AddedFirst Release.