History: IoT Dashboard and Workflow
Source of version: 5 (current)
Copy to clipboard
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. {img src="display2222" link="display2222" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} * 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 {img src="display2226" link="display2226" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} 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. {img src="display2223" link="display2223" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} 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 ~~#d0021b:/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) {img src="display2225" link="display2225" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} 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). {img src="display2227" link="display2227" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} Example of a tracker for a ~~#ff0000:Home Air Quality Monitor~~ system 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. {img src="display2228" link="display2228" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} !! 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. {img src="display2237" link="display2237" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} 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 : {img src="display2238" link="display2238" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} {img src="display2239" link="display2239" width="400" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"} * 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