Introduction
Evok is the primary API for accessing I/Os of NEURON, PATRON, GATE and Unipi 1.1 devices including Extension modules by Unipi technology. Evok is a translation layer between its provided APIs and Modbus, which Unipi PLCs use, you can look at their reference. You can also checkout Evok API documentation.
It provides multiple ways to easily access the I/Os of the devices, including:
- RESTful WebForms API
- RESTful JSON API
- Bulk request JSON API
- WebSocket API
- JSON-RPC API
Besides that, Evok also supports sending notifications via webhook.
evok-web is a simple demo web application using Evok demonstrating its usage and allowing easy control of the devices configured in Evok.
First steps
Quickly start using Evok:
- In order to use Evok, you need any Unipi controller.
- Obtain an OS for controller of your choice, either Base OS or Node-RED OS.
- Use service mode to flash Patron or Gate, for Neuron, flash an SD card.
- Install Evok, you can skip this step if you do not need Evok-web on Node-RED OS:
- Connect to the unit via ssh
- Run
apt update
command, then install Evok byapt install -y evok
, if you want also the demo web inteface, executeapt install -y evok-web
, for detailed walktrough see the detailed article.
- You can try to use the API using bash or Node-RED, (more information about API):
Following commands will work only via SSH, executed on the unit itself. If you wish to open the API from elsewhere, edit configuration of Evok.
- Returning the state of digital input DI 1_01
curl --request GET --url http://127.0.0.1:8080/json/di/1_01 --header 'Accept: text/html, application/json'
- Switch on the DO 1_01:
curl --request POST --url http://127.0.0.1:8080/json/do/1_01 --header 'Accept: application/json' --header 'Content-Type: application/json' --data '{"value": 1}'
- Switch off the DO 1_01:
curl --request POST --url http://127.0.0.1:8080/json/do/1_01 --header 'Accept: application/json' --header 'Content-Type: application/json' --data '{"value": 0}'
Open http://<unit-IP-adrress>/
and toggle some outputs:
Open http://<unit-IP-adrress>:1880/ui
and try the default Node-RED project:
If you wish to alter it, navigate to http://<unit-IP-adrress>:1880/
: