Skip to main content

Daemon for managing integrations with the FATNM DEVLPR

Project description

devlprd

Python application

Overview

The FANTM DEVLPR daemon for managing and publishing data streams. It serves as a middleware between the hardware itself, and whatever integration you want to make. It exists to both abstract away data processing from the end application, and to allow for language agnostic integrations. Right now there is only a python endpoint, but there are plans for JS and more in the near future. In effect, first an Arduino is flashed with the provided firmware, then the daemon is launched, and then the application that you're using the data with.

Getting Started

The first thing that needs to be done is formatting the Arduino. In the arduino_firmware folder there are scripts that format the data in such a way that the daemon can package, process, and send it out easily. So flash an arduino with one of those scripts and make sure it is connected to the computer you will be running the daemon from.

This project uses Poetry for dependency management, and while it's not required to get started it's a useful tool. All of the dependencies are in pyproject.toml, so just run poetry install. Then just run poetry run python src/main.py and the daemon should start.

Development

Adding a data transformer

To add support for a new data transformer, edit the self.callbacks: Dict[str, Callable[[int], Union[int, bool]]] dictionary in the __init__ function of DaemonState (in DaemonState.py). You will need to add a new entry with a data topic, using one of the supported topics defined in protocol.py and a function. The function is a callback that takes a single int as an arguement representing the pin the data is coming from on the Arduino. The function should be inside of DaemonState, but it can be wrapper for a function living in another file (filtering.py is usually a good choice).

Now whenever a client subscribes to your topic, the callback will be called and you'll see your data stream.

Adding a new data topic

Add a new line to the DataTopic class in protocol.py with an ALL_CAPS_NAME and a unique two letter identifier. Then go to the protocol.py in the pydevlpr repository and add it there as well so others can use the topic.

Adding support for different types of messages

Add a new line in the PacketType class in protocol.py with an ALL_CAPS_NAME and a unique one letter identifier. Then go to daemon.py and add an elif command == PacketType.ALL_CAPS_NAME with the handler for your custom packet type to the receive(...) function.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for devlprd, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size devlprd-0.3.1-py3-none-any.whl (10.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size devlprd-0.3.1.tar.gz (9.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page