BETA
My accountGet started
Oct 222025
Total.js Platform
4 min read

New universal drivers for IoT Platform

Meet the new universal drivers for the Total.js IoT Platform — built for flexibility and easy customization. From electrometers to switches, these ready-to-use drivers simplify IoT data processing and integration.

New universal drivers for IoT Platform

In some of the previous blogs, I wrote a lot about the IoT platform from Total.js. Like what it is, why it can be useful, how to install individual parts to get it working, and how to set it up and start using it. But there is still one part of the platform that has to be created or modified especially for your case. And those are drivers.

We published some of the custom drivers we used before, but now we have added universal drivers. These drivers are ready to use. We created universal drivers for the electrometer, weather, meteo data, and switch. In this blog, I will introduce them to you. You can use them as they are, create new drivers based on principles used in these drivers, or modify them for your case. Also, I will show you how to add a sensor to one of them, so you will be able to adjust them correctly for your case.

The difference I want to point out first is that we changed devEUI in the received JSON to id. If you are new here, just take it as best practice. If you used one of the drivers with an older JSON schema, be careful now, the old one was because of a custom implementation.

What are universal drivers

Each of these drivers is for a different device. We created them based on specifications so they can fit easily into any device of their own type. If you need to do some modifications, it is very easy with little knowledge about drivers, which you can get in the Total.js documentation, and some basic programming skills.

Each driver has its own properties that can be processed, and there is a possibility of setting a Token. This token is for security reasons. If you set some value there, each received message has to include the same value in the received headers in the property x-token. This will be validated, and if the received header value is different, the driver will not process any data from that request. If you do not set any value to this token, validation will be skipped, and every request will be processed.

Setting a value for Token

This functionality is the same for every driver.

Electrometer

The electrometer driver is for electrometer devices. It can receive and process various data that are sent to /electrometer/ endpoint.

Data structure for this driver:

As you can see, there are a lot of different measured values like voltage for 3 phases, current for 3 phases and more. The only property that is not a measured value but is used for pairing a real device with a device in the platform is the id property.

Air quality

Air quality is a driver for indoor air quality monitoring. It can receive and process various data that are sent to /airquality/ endpoint.

Data structure for this driver:

It can process received data for temperature, humidity, CO2, and tvoc. Same as before, the only property that is not for measured values but for pairing a real device with a device in the platform is the id property.

Meteo

Meteo is a driver for outdoor weather conditions monitoring. It can receive and process various data that are sent to /meteo/ endpoint.

Data structure for this driver:

It can process received data for temperature, humidity, pressure, windspeed, ilumination, and uv. Same as before, the only property that is not for measured values but for pairing a real device with a device in the platform is the id property.

Switch

Switch is a driver created for any kind of switch device with two possible values: true or false. So it is not for receiving values of the type of number, but a boolean. It can receive and process data that is sent to /switch/ endpoint.

Data structure for this driver:

It can process received data as a value property, and same as before, the only property which is not for measured values but for pairing a real device with a device in the platform is the id property.

How to use the driver?

Usage of IoT drivers is very easy, you have to only copy code from the driver you want, click on the Create button in the Drivers section, paste the code there, and click save. Then the new driver will appear in the listing, and you can also see it in the process of creating a new device.

Creating a new driver

How to modify the driver?

For this example, we will use the Switch driver. Right now, we have only one property for processing data, which is value. I want to have a switch with two values, so the first will stay the same as it is now, and the second will be value2.

When we open the source code of the driver, first we have to go to exports.outputs, and add our new output.

Object with id value is our original output, and value2 is the new one. value2 will also be a name of a property, from which will driver pair a value from received data.

Then we have to find com.jsonschema where we need to add also value2 for validation purposes.

As you can see, it will be the same data type as the original output, which is Boolean.

And the last addition we have to do is add this to the instance.message function, where we process received data.

This code will set the received value from property value2 (payload.value2) to our output with id value2, under the condition that the received value is not null.

The last thing we should do is update our readme, so every user of our application can see that this driver was modified and now it can process more data.

Now I will create a device based on this driver, and we can try it.

Sending data to the modified driver

Conclusion

So that is all for this blog about IoT platform drivers. We learned about a new universal driver, and now we know how to modify it for new sensors.

I hope you like this blog, and I will happily share with you more knowledge about Total.js in future blogs.

Video: