Given the existence of https://doc.tiki.org/API, we began exploring their potential for integration with the physical world. This led to early experiments documented here: https://doc.tiki.org/Internet+of+Things+usage
Over time, these explorations grew into a dedicated feature designed specifically for IoT use cases, now available starting from Tiki 28: https://gitlab.com/tikiwiki/tiki/-/merge_requests/4178.
What is involved in this new feature
- Trackers for IoT data : use Tiki Trackers to store physical object–related data and event logs.
- Visual interface for event handling : decide what happens when new data is created in a tracker through an interactive drawing canvas.
- Realtime dashboard : monitor your physical device in real time with dashboards that display changes as they occur. The dashboard is designed by you, drag in widget as you wish and build the dashboard in the way you want it to look
If you are familiar with Arduino you can quickly follow the steps explained in this snippet to build a remote temperature monitor tool : https://gitlab.com/-/snippets/3759981
How to get started
First of all you need to install latest version of Tiki or upgrade to Tiki 28 or later.
Then you need to enable the feature in the admin panel. From the admin panel you can search "feature_internet_of_things" in the preferences or visit "/tiki-admin.php?page=features#contentadmin_features-programmer" then activate the feature. If prompted to activated the Realtime please go ahead, it is required for the IoT feature to work.
The last thing is to enable the API access feature, please follow this link on how to do it https://doc.tiki.org/API
If all above is done, you can start by opening /tiki-iot_dashboard.php. Note that you need to have 'tiki_p_manage_iot_apps' permission which you configure in the admin panel (by default all admins have this permission)
Create a Tracker to hold your IoT devices data and define the fields depending on your requirements : This is crucial, think of the tracker your database (and it is a powerful no-code database built-in Tiki, not familiar with it? check https://doc.tiki.org/Trackers).
When your tracker is ready, go back to /tiki-iot_dashboard.php and from there you can create a new IoT app and tie it to the tracker you just created.
Building the IoT app
The flow design
Once the app is created and linked with a Tracker, you can now decide what the app actually does. By flow design we give you ability to configure (without writing code) what happen when new entries are created or updated inside the tracker.
Nodes encapsulate logic that happen when data arrives. Current nodes :
- Email Send : It takes text as input, use it as email body, send the email using your existing instance settings then pass the same input text to the next node as is (if any)
- Hardware I/O State : More related to physical devices. You configure the pin number (can be virtual) and decide to change it state when the node is executed. We will take later about the endpoint you can use to read this I/O state.
- File logger : This takes input as text, logs it into a file located at lib/iot_tiki/logs/ then pass the input as is to the next node
- Math Comparison : Get input, pass it to the condition and if condition passes, the flow will continue, if not the flow will stop. The syntax written here follows the calculation syntax https://doc.tiki.org/Calculations and $input represent the input within your formula. The output of your formula SHOULD evaluate to true or false at the end otherwise some unexpected behavior may happen
- String Template : This node is used to rewrite string from input and output whatever is supplied in the config of the node with every occurrence of ==input== being replaced by the input value.
- Sensor Input : This is where we can get data that was inserted into the Tracker. It output the value exactly as supplied
- Webhook Send : Get input and send it as request body via a POST request to the webhook URL is configured
A sample flow :
- Use the IoT event canvas to configure actions when new data arrives.
- Set up your realtime dashboard to visualize incoming data.
- Connect your IoT devices or services to Tiki using the Tiki APIs
- Test & Next steps