ComDeX Installation Guide
This guide will walk you through the steps to set up and run the ComDeX prototype on your local system. ComDeX is implemented in Python, but can easily be adapted to other languages.
- Python environment
- MQTT broker that supports message persistence and MQTT bridges creation
For the Action Handler, you’ll need the following Python libraries:
These dependencies are listed in the
requirements.txt file for convenience.
- Install the required Python libraries using pip:
pip install -r requirements.txt
- Once the installation is complete, you can view the available command-line arguments and their usage by executing:
python3 action_handler.py -h
After setting up your environment, it’s a good idea to run a quick sanity check.
Here’s an example of how to do it:
In the same folder as “actionhandler.py”, create an entity example file, “entity_example.ngsild”, and a subscription file, “subscription_example.ngsild”. The contents for these files are provided in the repo.
Then, create an entity and a subscription. You can do this in any order (either publish the entity before or after the subscription). Replace localhost and 1026 with the appropriate address and port of your MQTT broker:
sudo python3 actionhandler.py -c POST/Subscriptions -f subscription_example.ngsild -b localhost -p 1026 sudo python3 actionhandler.py -c POST/entities -f entity_example.ngsild -b localhost -p 1026
You should be able to see the subscribed attributes printed/returned at your terminal.
Finally, you can also try “getting” the published entity, using the following command:
sudo python3 actionhandler.py -c GET/entities/?id=urn:ngsi-ld:GtfsAgency:Malaga_EMT -b localhost -p 1026