The Python code of this respository is for a Raspberry Pi. It enables the Raspberry Pi to connect to the Datapool web application.
It connects to the web application via the data pool processor SourcePot\Datapool\Processing\RemoteClient
and can be used within any data app.
'PI view' receives requests from multiple Raspberry Pis containing data and/or files. The web application's answer to a request contains the return data for the corresponding Raspberry Pi.
To setup the Raspberry Pi client you need to create a folder on your PI and copy the following three python files into this folder:
- __init__.py,
- datapoolclient.py and
- sentinel.py
You will need to adjust the url in datapoolclient.py to the web address of your Datapool web application:
When you run sentinel.py for the first time datapoolclient.py will create a set of sub-directories. You need to adjust the client.json file in the newly created settings sub-directory. This file contains the access details, such as the Datapool web application url, the client_id and client_secret. These details must match the client registration within the Datapool web application.
You need to register the new client with one of the user accounts of your web application. To do this go to 'Admin' → 'Account' ankd expand 'App credentials' (Lock symbol).
Remember the registered client will have the same privileges as the user of this account but limited to the selected scope. The scope for the PIclient must be class SourcePot\Datapool\Processing\RemoteClient
. The following screenshot shows the registration of the client in row 0001:
The RemoteClient processor provides a user interface which is defined by the remote client. Within sentinel.py
the python dictionary entry
, key Content||Settings||...
defines the control elements and key Content||Status||...
the status display.