{"id":"JaszS73w061f","url":"https://totaljs.es/docs/iot/1-0/guides/introduction/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Total.js IoT Platform","summary":"What Total.js IoT Platform does, how its two apps work together and what to read next.","markdown":"---\ntitle: Total.js IoT Platform\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/introduction/\nupdated: 2026-11-20T06:56:24.247Z\n---\n\n# Total.js IoT Platform\n\n> What Total.js IoT Platform does, how its two apps work together and what to read next.\n\n> **Note:** Total.js IoT Platform is available only with a [Total.js Enterprise](https://www.totaljs.com/enterprise/) subscription. See the [IoT Platform page](https://www.totaljs.com/iot/) on totaljs.com.\n\n\nTotal.js IoT Platform collects the readings of your sensors, keeps their history and shows them on a map. You draw zones on the map, such as a park, a school or a crossroads, and every zone shows the latest values of the sensors you pick for it.\n\n![The map with two zones and the latest values of their sensors](/files/JaszS63v060f.webp)\n\n## How it works\n\nThe platform is made of two apps that share one PostgreSQL database:\n\n- **Admin** is the app you work in. Here you install drivers, register devices, draw zones, combine sensors into data views and build reports and panels.\n- **Stream** receives the data that your devices send. It runs the drivers, turns each message into sensor values and writes them to the database.\n\nA **driver** is a small script that knows one kind of device: which values it measures, which address it receives data on and how to read its messages. When you create a device, you choose its driver, and the platform creates one **sensor** for each value the driver measures.\n\n## What you can do\n\n- See every sensor with its last value, its online status and its history. See [Sensors](../sensors/).\n- Draw zones on the map and show selected sensors in them. See [Zones](../zones/) and [The map](../map/).\n- Combine several sensors into one value, such as an average temperature. See [Data views](../data-views/).\n- Build reports from SQL queries and download them. See [Reports](../reports/).\n- Show live content on small web pages, for example on a display at an entrance. See [Panels](../panels/).\n- Publish the values of devices, sensors, zones, data views and reports as JSON. See [Open data API](../../reference/open-data-api/).\n- Replay recorded data to test a driver. See [Simulations](../simulations/).\n- Write your own drivers. See [Drivers for developers](../../development/introduction/).\n\n## What to read next\n\n1. [Installation](../installation/) installs both apps and connects them to the database.\n2. [First steps](../first-steps/) takes you from the first sign-in to the first values on the map.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:24.247Z"}
{"id":"JaszS23t060f","url":"https://totaljs.es/docs/iot/1-0/guides/installation/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Installation","summary":"Install the Admin and Stream apps, connect them to PostgreSQL and start them.","markdown":"---\ntitle: Installation\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/installation/\nupdated: 2026-11-20T06:56:23.519Z\n---\n\n# Installation\n\n> Install the Admin and Stream apps, connect them to PostgreSQL and start them.\n\n> **Note:** Total.js IoT Platform is available only with a [Total.js Enterprise](https://www.totaljs.com/enterprise/) subscription. See the [IoT Platform page](https://www.totaljs.com/iot/) on totaljs.com.\n\n\nTotal.js IoT Platform runs on your own server. You receive the source code from Total.js with your Enterprise license. The package has three folders:\n\n- `admin`: the app you work in.\n- `stream`: the app that receives the data of your devices.\n- `drivers`: example drivers that you can install or use as a starting point.\n\n## Requirements\n\n- Node.js 18 or newer.\n- PostgreSQL 15 or newer.\n\n## Create the database\n\nCreate an empty PostgreSQL database for the platform, for example `iot`. Both apps use this one database. Admin creates its tables the first time it starts.\n\n## Install Admin\n\n1. Open a terminal in the `admin` folder and install the dependencies:\n\n```bash\nnpm install\n```\n\n2. Open the `config` file and set the connection to your database and the address where people will open the app:\n\n```text\ndatabase             : postgresql://user:password@127.0.0.1:5432/iot\nurl                  : https://iot.example.com\n```\n\n3. Start the app:\n\n```bash\nnpm start\n```\n\nAdmin listens on port `8000`. Open `http://127.0.0.1:8000/` in your browser and continue with [First steps](../first-steps/).\n\n## Install Stream\n\n1. Open a terminal in the `stream` folder and install the dependencies:\n\n```bash\nnpm install\n```\n\n2. Open the `config` file and set the same database and the public address of the stream. Your devices send their data to this address.\n\n```text\ndatabase           : postgresql://user:password@127.0.0.1:5432/iot\nurl                : https://stream.example.com\n```\n\n3. Open `index.js` and choose a port for the stream, different from the port of Admin. Remove the `//` in front of the `options.port` line and write the number:\n\n```js\noptions.port = 8001;\n```\n\n4. Start the stream:\n\n```bash\nnode index.js\n```\n\nOpen `http://127.0.0.1:8001/` to see the [status page of the stream](../stream/).\n\n## Run in production\n\nStart each app in release mode, which is faster and does not watch the files for changes:\n\n```bash\nnode index.js --release\n```\n\nKeep both apps running with the process manager of your server and put them behind a web server with HTTPS. Devices must be able to reach the address of the stream. Admin only needs to be reachable by the people who use it, and by anyone who reads its [open data](../../reference/open-data-api/).\n\nAll settings of both apps are described in [Configuration files](../../reference/configuration/).\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:23.519Z"}
{"id":"JaszS03r060f","url":"https://totaljs.es/docs/iot/1-0/guides/first-steps/","project":"iot","version":"1-0","section":"guides","language":"en","title":"First steps","summary":"Sign in for the first time and go from an empty platform to the first values on the map.","markdown":"---\ntitle: First steps\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/first-steps/\nupdated: 2026-11-20T06:56:23.519Z\n---\n\n# First steps\n\n> Sign in for the first time and go from an empty platform to the first values on the map.\n\nThis page takes you through the first sign-in and the order in which the parts of the platform depend on each other.\n\n## Sign in for the first time\n\nWhen Admin starts for the first time, it creates an administrator account with a random user name and password. Until somebody signs in, the sign-in page shows this **Default account**.\n\n1. Open the address of Admin in your browser.\n2. Select **Fill in the form** in the **Default account** box, or type the user name and password yourself.\n3. Select **Sign in**.\n\nAfter the first sign-in, the box disappears and the sign-in page shows only the form:\n\n![The sign-in page with User name and Password](/files/JaszRz3q061f.webp)\n\nSign in right after you install the platform, so that nobody else sees the default account. Then choose your own name, user name and password, as described in [Your account](../account/).\n\n## The main menu\n\nThe menu on the left opens every part of the app: **Map**, **Alerts**, **Sensors**, **Data views**, **Devices**, **Panels**, **Reports**, **Simulations**, **Zones**, **Drivers**, **Dictionary**, **Files** and **Settings**. A red number next to **Sensors** counts the sensors that are offline.\n\n## From an empty platform to the map\n\nThe parts of the platform build on each other. Follow this order:\n\n1. **Settings.** Set the name of the app and the place where the map opens. See [Settings](../settings/).\n2. **Drivers.** Install a driver for each kind of device you have. See [Drivers](../drivers/).\n3. **Devices.** Create a device for each piece of hardware and give it its identifier. The platform creates its sensors. See [Devices](../devices/).\n4. **Data.** Your devices send data to the stream, and the values appear in [Sensors](../sensors/). To try it without hardware, use [Simulations](../simulations/).\n5. **Zones.** Draw zones and add the sensors that belong to them. See [Zones](../zones/).\n6. **Map.** Open the [map](../map/) and zoom in to see the values in each zone.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:23.519Z"}
{"id":"JaszQA2N060f","url":"https://totaljs.es/docs/iot/1-0/guides/drivers/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Drivers","summary":"Install, configure, read and remove the drivers that describe your devices.","markdown":"---\ntitle: Drivers\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/drivers/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Drivers\n\n> Install, configure, read and remove the drivers that describe your devices.\n\nA driver describes one kind of device: its name and manufacturer, the values it measures, the settings each device needs and the address where the stream receives its data. You need a driver before you can create a device of that kind.\n\n![The Drivers screen with drivers and extensions](/files/JaszQ02I061f.webp)\n\nThe **Drivers** screen groups the installed drivers in two lists:\n\n- **Drivers** describe devices. You choose one of them when you create a device.\n- **Extensions** run once for the whole platform. An extension usually receives data for many devices at one address and passes each reading to the right device.\n\n## Install a driver\n\nA driver is a single file. The `drivers` folder of the installation package contains examples, and the developers of your devices or your own team can write new ones (see [Drivers for developers](../../development/introduction/)).\n\n1. Open **Drivers** and select **Create**. An editor opens with a template.\n2. Replace the whole template with the content of the driver file.\n3. Select **SUBMIT**.\n\n![The editor with the source code of a driver](/files/JaszQ42J060f.webp)\n\nThe driver appears in the list. If the code has an error, the editor shows it and keeps the driver unsaved.\n\nThe stream starts to use a new or changed driver within three minutes.\n\n## The driver menu\n\nSelect **...** on a driver to open its menu:\n\n![The menu of a driver with Settings, Read me, Edit source-code and Remove](/files/JaszQ52K061f.webp)\n\n- **Settings** opens the options of the driver, for example a token that devices must send. The options apply to every device of this driver.\n- **Read me** shows the description that the author wrote, usually with the format of the data the driver accepts.\n- **Edit source-code** opens the editor. When you save a new version, the platform keeps the values you set in **Settings**.\n- **Remove** deletes the driver.\n\n![The Read me of a driver](/files/JaszQ72L060f.webp)\n\n## Set the options of a driver\n\n1. Select **...** on the driver and then **Settings**.\n2. Fill in the options.\n3. Select **APPLY**.\n\n![The settings of a driver with a Token field](/files/JaszQ92M061f.webp)\n\nThe stream uses the new values within three minutes.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszPu2D060f","url":"https://totaljs.es/docs/iot/1-0/guides/devices/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Devices","summary":"Create devices, give them their identifiers, configure them and send them commands.","markdown":"---\ntitle: Devices\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/devices/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Devices\n\n> Create devices, give them their identifiers, configure them and send them commands.\n\nA device is one piece of hardware, such as a weather station in a park. Each device uses one driver, and the platform creates one sensor for every value the driver measures.\n\n![The Devices screen with two weather stations](/files/JaszPg26061f.webp)\n\nThe **Devices** screen lists all devices with their driver, name, serial number, reference, locality, position and online status. Use the **Filter** row under the column names to search.\n\n## Create a device\n\n1. Open **Devices** and select **Create**.\n2. Select the driver of the device. The platform creates the device right away and opens its form.\n\n![Select a driver: the list of installed drivers](/files/JaszPi27060f.webp)\n\n3. Fill in the form and select **SUBMIT**.\n\n![The device form with Name, Device identifier and the locality](/files/JaszPl28061f.webp)\n\nThe most important field is **Device identifier**. It is the serial number or another code that the device sends with its data, and the driver uses it to find the device that a reading belongs to. Write it exactly as the device sends it.\n\nThe other fields:\n\n- **Name**: the name people see everywhere in the app.\n- **Temporarily disabled**: the stream ignores the device until you clear the box.\n- **Publish a value to an API endpoint**: makes the device and its sensors available as JSON. See [Open data API](../../reference/open-data-api/).\n- **Note** and **Custom attributes**: your own information. Custom attributes are key and value pairs that also appear in the open data.\n- **Reference**, **Color** and **Icon**: your own reference code and the look of the device.\n- **Place**, **Latitude** and **Longitude**: where the device is. The map uses the position when it shows devices.\n\nThe stream starts to accept data for a new device within three minutes.\n\n## The device detail\n\nSelect a device in the list to open its detail. It shows the basic information, the locality, the driver and the list of sensors with their status, last value and time.\n\n![The detail of a device with three online sensors](/files/JaszPo29060f.webp)\n\nThe buttons at the top:\n\n- **Refresh** reloads the values.\n- **Commands** sends a command to the device. It is available when the driver defines commands.\n- **Options** opens **Readme**, **Edit**, **Configure** and **Remove**.\n\n![The Options menu of a device](/files/JaszPp2A061f.webp)\n\n## Change the sensors of one device\n\nSelect the cog icon of a sensor in the device detail:\n\n- **Rename** gives the sensor another name for this device.\n- **Hide sensor** hides a sensor that the device does not use.\n- **Enable timeline** keeps every received value, not only the statistics. The sensor gets an orange background.\n- **Publish to API endpoint** makes the sensor available as JSON. The address appears under the sensor.\n- **Stats** chooses how often the history is summarised: **Minutely stats**, **Hourly stats** or **Daily stats**. You can also select the stats name next to the value.\n\n## Configure a device\n\nSome drivers have settings for each device, for example a correction for a temperature sensor. Select **Options** and **Configure**, change the values and select **APPLY**.\n\n![The settings of one device with a temperature correction](/files/JaszPr2B060f.webp)\n\nThe stream uses the new configuration within three minutes.\n\n## Send a command\n\nWhen the driver defines commands, for example to change how often the device measures:\n\n1. Open the device and select **Commands**.\n2. Choose the command.\n3. Fill in its form and select **SUBMIT**.\n\n![The form of the Change interval command](/files/JaszPs2C061f.webp)\n\nThe app confirms that the command is sent. The stream picks up new commands every five seconds and passes them to the driver.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszSb4F060f","url":"https://totaljs.es/docs/iot/1-0/guides/sensors/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Sensors","summary":"Follow the last value of every sensor and browse, filter and export its history.","markdown":"---\ntitle: Sensors\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/sensors/\nupdated: 2026-11-20T06:56:27.243Z\n---\n\n# Sensors\n\n> Follow the last value of every sensor and browse, filter and export its history.\n\nThe **Sensors** screen lists every sensor of every device with its driver, device, locality, last value, number of alerts, the time of the last value, the serial number of the device and its online status.\n\n![The Sensors screen with six sensors of two weather stations](/files/JaszSY4D060f.webp)\n\nA sensor is **online** when it received a value within the time its driver allows, for example two hours. When that time passes, the sensor turns **offline**, and the red number next to **Sensors** in the menu counts it. An **API** badge marks a sensor that is published as open data.\n\n## The history of a sensor\n\nSelect a sensor to open its history. Each row shows the date, the value and how long ago it was.\n\n![The history of a temperature sensor, one row a minute](/files/JaszSa4E061f.webp)\n\nBy default the history shows the statistics that the sensor keeps: the last hour for minutely stats, the last 24 hours for hourly stats, the last 7 days for daily stats.\n\n## Filter the history\n\nSelect **Filter** and set:\n\n- **From** and **To**: the period.\n- **Output**: **MIN**, **MAX** or **AVG** of each interval.\n- **Stats**: the interval, from **Minutely** to **Yearly**, **Last data** for the last value, or **Timeline** for every value when the timeline of the sensor is on (see [Devices](../devices/)).\n\n## Export the history\n\nSelect **Export CSV** to save the listed rows as a CSV file with the columns `ts` and `value`.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:27.243Z"}
{"id":"JaszPY20061f","url":"https://totaljs.es/docs/iot/1-0/guides/alerts/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Alerts","summary":"See the warnings and errors that drivers report about your devices.","markdown":"---\ntitle: Alerts\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/alerts/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Alerts\n\n> See the warnings and errors that drivers report about your devices.\n\nThe **Alerts** screen collects the messages that drivers report, such as a low battery, and the errors that happen while a driver processes data. Each alert shows its message, the device, the sensor and its type when the driver gives them, and the date and time.\n\n![An alert about a low battery of a weather station](/files/JaszP81s061f.webp)\n\nNew alerts are unread. Opening the **Alerts** screen marks the listed alerts as read.\n\nTo delete alerts, select them and then **Remove**. Only administrators can remove alerts.\n\nThe alerts come from the drivers, so what a device reports depends on its driver. A developer adds alerts to a driver as described in [Alerts and debugging](../../development/alerts-and-debugging/).\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszSr4Q061f","url":"https://totaljs.es/docs/iot/1-0/guides/stream/","project":"iot","version":"1-0","section":"guides","language":"en","title":"The stream","summary":"What the Stream app does, how devices send data to it and how to read its status page.","markdown":"---\ntitle: The stream\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/stream/\nupdated: 2026-11-20T06:56:28.789Z\n---\n\n# The stream\n\n> What the Stream app does, how devices send data to it and how to read its status page.\n\nThe Stream app receives the data of your devices. It loads the installed drivers and the devices from the database, runs each driver and writes the values to the database, where Admin shows them.\n\n## Where devices send data\n\nEach driver decides the address it listens on. The **Read me** of a driver usually tells you the address and the format, for example `POST /demoweather/` with a JSON body. The full address is the public address of your stream followed by that path:\n\n```text\nhttps://stream.example.com/demoweather/\n```\n\nIf a driver has a token in its **Settings**, the device must send it, usually in a header. The **Read me** of the driver says which one.\n\n## Changes reach the stream within three minutes\n\nThe stream reads the drivers, the devices and their configuration from the database every three minutes. A new device, a changed driver, new driver options and a changed device configuration take effect at the next reload. Restarting the stream applies them at once.\n\n## The status page\n\nOpen the address of the stream in a browser to see its status page:\n\n![The status page of the stream](/files/JaszSp4P060f.webp)\n\nThe first lines show the memory the stream uses and the number of messages it has processed. Then each line shows one running item: its id, its driver and its counters. The ids are the ids of your devices, as shown in the device detail, and the ids of the extensions. Two items are always there: `database`, which writes the values, and `debugger`, which writes the debug messages of the drivers.\n\nWhen a device does not appear on the status page three minutes after you created it, check that it is not **Temporarily disabled** and that its driver is installed.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:28.789Z"}
{"id":"JaszSy4U061f","url":"https://totaljs.es/docs/iot/1-0/guides/zones/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Zones","summary":"Draw zones on the map, sort them into categories and choose the sensors they show.","markdown":"---\ntitle: Zones\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/zones/\nupdated: 2026-11-20T06:56:29.450Z\n---\n\n# Zones\n\n> Draw zones on the map, sort them into categories and choose the sensors they show.\n\nA zone is an area on the map, such as a park, a school or a crossroads. Each zone shows the latest values of the sensors and data views you add to it.\n\n![The Zones screen with a zone in the Parks category](/files/JaszSt4S061f.webp)\n\nThe **Zones** screen groups the zones by category and shows a picture of each zone.\n\n## Create a zone\n\n1. Open **Zones** and select **Create**.\n2. Fill in the **Name** and choose a **Category**.\n3. Select **Draw zone**, draw the area on the map and select **APPLY**.\n4. Select **Add sensor** and add the sensors or data views that belong to the zone.\n5. Select **SUBMIT**.\n\n![The zone form with its sensors, position and picture](/files/JaszSw4T060f.webp)\n\nThe fields of the form:\n\n- **Show on map**: shows the zone on the [map](../map/).\n- **Zone is inactive**: turns the zone off. An inactive zone is not available as open data.\n- **Publish a value to an API endpoint**: makes the zone and its values available as JSON. See [Open data API](../../reference/open-data-api/).\n- **Note** and **Custom attributes**: your own information. Custom attributes also appear in the open data.\n\n## The sensors of a zone\n\nEach sensor in the list shows its last value and these controls:\n\n- The arrows change the order on the map.\n- The eye (**Show on the map**) shows or hides the sensor in the panel of the zone on the map.\n- The funnel sets the statistics of the sensor in this zone: the **Type of stats**, the **Interval** (for example `24` intervals means 24 hours in hourly stats) and the **Operation**, such as **Average value** or **Maximal value**.\n- The bin removes the sensor from the zone.\n\n## Categories\n\nSelect **Categories** to create, change and remove categories. Each category has a **Name**, an **Icon** and a **Color**. The map can show the zones of selected categories only.\n\n## Update or remove a zone\n\nSelect the cog icon of a zone and choose **Update** or **Remove**. A published zone also has **Copy API endpoint**.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:29.450Z"}
{"id":"JaszSC3z060f","url":"https://totaljs.es/docs/iot/1-0/guides/map/","project":"iot","version":"1-0","section":"guides","language":"en","title":"The map","summary":"Read the latest values of each zone on the map and open the history of its sensors.","markdown":"---\ntitle: The map\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/map/\nupdated: 2026-11-20T06:56:24.661Z\n---\n\n# The map\n\n> Read the latest values of each zone on the map and open the history of its sensors.\n\nThe **Map** opens at the position set in [Settings](../settings/) and shows every zone marked **Show on map**.\n\n## Read the values\n\nFrom afar, each zone shows a circle with a number. Zoom in with **+** or the mouse wheel, and each zone shows a panel with its name and the latest values of its sensors.\n\n![The map with the panels of two zones](/files/JaszS63v060f.webp)\n\n## Open the history of a zone\n\nSelect the panel of a zone. A window opens with a chart for each sensor, with its value, the time it was measured and the statistics it shows.\n\n![Charts of temperature and humidity in a zone](/files/JaszSA3y061f.webp)\n\nSelect the statistics next to **Display** to choose the **Type** of value (maximal, minimal, average or sum) and the **Period**, from 60 minutes to 12 months.\n\n## Filter and find\n\n- **Categories** shows only the zones of the categories you choose.\n- **Find** lists the zones and moves the map to the one you select.\n- **Refresh** reloads the zones and their values.\n\n## Show devices instead of zones\n\nWhen **Show devices only** is on in [Settings](../settings/), the map shows your devices at their latitude and longitude instead of the zones.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:24.661Z"}
{"id":"JaszPe24061f","url":"https://totaljs.es/docs/iot/1-0/guides/data-views/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Data views","summary":"Combine several sensors into one value with an operation, a format and decimals.","markdown":"---\ntitle: Data views\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/data-views/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Data views\n\n> Combine several sensors into one value with an operation, a format and decimals.\n\nA data view combines the values of several sensors into one value. Use it for the average temperature of a city, the highest noise level of a district or the total consumption of a building.\n\n![The Data views screen with an average temperature](/files/JaszPa22061f.webp)\n\n## Create a data view\n\n1. Open **Data views** and select **Create**.\n2. Fill in the **Name**.\n3. Choose the **Operation**: **Min**, **Max**, **Avg** or **Sum**.\n4. Set the **Format**, where `{0}` stands for the value, for example `{0} °C`, and the number of **Decimals**.\n5. Choose the default **Stats** for its charts.\n6. Select **Add sensor** and add the sensors to combine.\n7. Select **SUBMIT**.\n\n![The data view form with two temperature sensors](/files/JaszPc23060f.webp)\n\nThe list shows the result next to the name, and the form shows the current value of each sensor.\n\n**Publish a value to an API endpoint** makes the data view available as JSON with its value and the values of its sensors. See [Open data API](../../reference/open-data-api/). **Note** and **Custom attributes** hold your own information.\n\nA data view can be added to a zone like a sensor. See [Zones](../zones/).\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszSV4B060f","url":"https://totaljs.es/docs/iot/1-0/guides/reports/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Reports","summary":"Build tables from SQL queries, preview them, download them and publish them.","markdown":"---\ntitle: Reports\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/reports/\nupdated: 2026-11-20T06:56:26.603Z\n---\n\n# Reports\n\n> Build tables from SQL queries, preview them, download them and publish them.\n\nA report is a table built from an SQL query on the database of the platform. You can preview it, copy it, download it and publish it as JSON.\n\n![The Reports screen with two reports in the Weather category](/files/JaszSN47060f.webp)\n\n## Create a report\n\n1. Open **Reports** and select **Create**.\n2. Fill in the **Name**.\n3. Write the SQL query in the editor. Only queries that read data are accepted.\n4. Select **Preview data from SQL command** to check the result.\n5. In **Map fields**, give the columns readable names, separated by commas: `column=Label, column=Label`.\n6. Set the **Icon**, **Color**, **Category** and **Note** if you like.\n7. Select **SUBMIT**.\n\n![The report form with an SQL query and mapped fields](/files/JaszSP48061f.webp)\n\n- **Convert date and time to local time** shows the dates in the time of the browser. Without it, dates are in UTC.\n- **Publish a value to an API endpoint** makes the report available as JSON. See [Open data API](../../reference/open-data-api/).\n\nA simple query to start with lists the last value of every sensor:\n\n```sql\nSELECT device, sensor, value, dtvalue FROM view_sensor ORDER BY device, sensor\n```\n\n## Open a report\n\nSelect a report to open its data. From there you can copy the data to the clipboard or download it as CSV or XLSX.\n\n![A report with the last value of each sensor](/files/JaszSS49060f.webp)\n\n## The report menu\n\nSelect **...** on a report:\n\n![The report menu](/files/JaszSU4A061f.webp)\n\n- **Preview** opens the data.\n- **Copy API endpoint** copies the address of the published report.\n- **Update** changes the report, **Clone** creates a copy and **Remove** deletes it.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:26.603Z"}
{"id":"JaszSL45060f","url":"https://totaljs.es/docs/iot/1-0/guides/panels/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Panels","summary":"Create small live web pages, for example for a display, and send them new content.","markdown":"---\ntitle: Panels\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/panels/\nupdated: 2026-11-20T06:56:25.582Z\n---\n\n# Panels\n\n> Create small live web pages, for example for a display, and send them new content.\n\nA panel is a small web page with a fixed size, made for a display at an entrance, in a hall or on a wall. Its content is HTML that another program sends to the panel, for example a Flow that formats the latest value of a sensor. Every open panel page updates at once when new content arrives.\n\n![The Panels screen with a panel for a park entrance](/files/JaszSE41060f.webp)\n\n## Create a panel\n\n1. Open **Panels** and select **Create**.\n2. Fill in the **Name** and the **Width** and **Height** in pixels. Design the content for this size.\n3. Optionally choose a **Category**, write the **Location**, a **Note**, an **Icon**, a **Color** and the position.\n4. Select **SUBMIT**.\n\n![The panel form with name, size and location](/files/JaszSG42061f.webp)\n\n**Panel is inactive** stops the panel from accepting new content.\n\n## The panel menu\n\nSelect **...** on a panel:\n\n![The panel menu with the two addresses](/files/JaszSI43060f.webp)\n\n- **Copy panel URL address** copies the address of the page to open on the display.\n- **Copy Flow URL address** copies the address that accepts new content. It contains the access token of the panel, so keep it private.\n- **Update** and **Remove** change or delete the panel.\n\n## Send content to a panel\n\nSend a `POST` request with a JSON body that has an `html` field to the Flow URL address of the panel. From a terminal:\n\n```bash\ncurl -X POST 'https://iot.example.com/panels/<panel id>/?token=<token>' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"html\":\"<div style=\\\"font-size:72px\\\">20.4 &deg;C</div>\"}'\n```\n\nThe answer is `{\"success\":true}`, and every open page of the panel shows the new content:\n\n![A panel showing the temperature of the City park](/files/JaszSJ44061f.webp)\n\nThe platform keeps the last content, so a display that opens the panel later shows it too. See [Show a live value on a panel](../../recipes/live-value-on-a-panel/) for a complete example.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:25.582Z"}
{"id":"JaszSn4N060f","url":"https://totaljs.es/docs/iot/1-0/guides/simulations/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Simulations","summary":"Replay readings from a CSV file to an endpoint to test drivers and devices without hardware.","markdown":"---\ntitle: Simulations\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/simulations/\nupdated: 2026-11-20T06:56:28.339Z\n---\n\n# Simulations\n\n> Replay readings from a CSV file to an endpoint to test drivers and devices without hardware.\n\nA simulation sends the rows of a CSV file to an address, one row at a time, at a frequency you choose. Use it to test a driver, a device or a zone before the hardware is installed.\n\n![The Simulations screen with a running simulation](/files/JaszSh4K061f.webp)\n\n## Add an endpoint\n\nAn endpoint is the address the simulation sends to, usually the address of a driver on your stream.\n\n1. Open **Simulations** and select **Endpoints**.\n2. Select **Add endpoint**.\n3. Fill in the **Name** and the **URL**, for example `https://stream.example.com/demoweather/`.\n4. If the driver expects a token, fill in **Token**. The simulation sends it in the `x-token` header.\n5. Select **SUBMIT**.\n\n![The list of endpoints](/files/JaszSj4L060f.webp)\n\n## Prepare the CSV file\n\nThe first line holds the names of the fields of the JSON that the simulation sends. Put `+` in front of a name to send the value as a number. Each next line is one message.\n\n```text\nsn,+temperature,+humidity,+battery\nWS-0002,16.2,61,60\nWS-0002,16.0,62,60\nWS-0002,15.8,63,59\n```\n\nThe first data line becomes this message:\n\n```json\n{ \"sn\": \"WS-0002\", \"temperature\": 16.2, \"humidity\": 61, \"battery\": 60 }\n```\n\n## Create a simulation\n\n1. Select **Create**.\n2. Select the **File** field and choose the CSV file. The name of the file becomes the name of the simulation.\n3. Choose the **Endpoint**.\n4. Set the **Frequency** in minutes, for example `1` sends one row every minute.\n5. Check **Launch** to start right away. Check **Data circulation** to start again from the first row after the last one.\n6. Select **SUBMIT**.\n\n![The Create simulation form](/files/JaszSl4M061f.webp)\n\nWithout **Data circulation**, the simulation stops after the last row and **Launched** turns off. To run it again, open it, check **Launch** and submit.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:28.339Z"}
{"id":"JaszSf4I061f","url":"https://totaljs.es/docs/iot/1-0/guides/settings/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Settings","summary":"Set the name of the app and where the map and the zone editor open.","markdown":"---\ntitle: Settings\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/settings/\nupdated: 2026-11-20T06:56:27.628Z\n---\n\n# Settings\n\n> Set the name of the app and where the map and the zone editor open.\n\nOpen **Settings** to change the general settings of the platform. Select **SUBMIT** to save them.\n\n![The Settings screen](/files/JaszSe4H060f.webp)\n\n## Configuration\n\n- **App name**: the name in the header of the app and on the sign-in page.\n- **Enable OpenPlatform integration**: connects the platform to Total.js OpenPlatform, so that its users sign in with their OpenPlatform account.\n\n## Map\n\n- **A default map position**: the latitude and longitude where the [map](../map/) opens, for example `48.7378, 19.1492`.\n- **Show devices only**: shows the devices at their position instead of the zones.\n\n## Zones\n\n- **A default zone position**: the latitude and longitude where the map opens when you draw a zone.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:27.628Z"}
{"id":"JaszPy2G061f","url":"https://totaljs.es/docs/iot/1-0/guides/dictionary/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Dictionary","summary":"Rename the names of drivers, sensors and sensor categories in one place.","markdown":"---\ntitle: Dictionary\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/dictionary/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Dictionary\n\n> Rename the names of drivers, sensors and sensor categories in one place.\n\nThe **Dictionary** lists the names that drivers bring into the platform: the names of the drivers, of their sensors and of the sensor categories. Rename them here, for example to translate them for the people who use the platform.\n\n![The Dictionary with categories, sensors and drivers](/files/JaszPx2F060f.webp)\n\n1. Open **Dictionary**.\n2. Select a name in the **Name** column and type the new name.\n3. Select **Save**.\n\nA new name replaces the old name everywhere it is used. To rename a sensor of one device only, use **Rename** in the device detail. See [Devices](../devices/).\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszRx3o061f","url":"https://totaljs.es/docs/iot/1-0/guides/files/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Files","summary":"Upload and manage the images and files that the platform uses.","markdown":"---\ntitle: Files\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/files/\nupdated: 2026-11-20T06:56:23.172Z\n---\n\n# Files\n\n> Upload and manage the images and files that the platform uses.\n\nThe **Files** screen keeps the files that you upload, such as pictures for zones. It lists each file with its name, extension, dimension, size and upload time.\n\n![The Files screen with two pictures](/files/JaszRv3n060f.webp)\n\n- **Upload** adds one or more files from your computer.\n- **Options** on a file renames, shows, downloads or removes it.\n- **Options** in the toolbar removes the selected files or clears all files.\n\nFiles are available at their address without signing in, so do not upload private documents.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:23.172Z"}
{"id":"JaszPW1y061f","url":"https://totaljs.es/docs/iot/1-0/guides/account/","project":"iot","version":"1-0","section":"guides","language":"en","title":"Your account","summary":"Change your name, user name and password, and sign out.","markdown":"---\ntitle: Your account\nproject: IoT Platform\nversion: 1.0\nsection: guides\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/guides/account/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Your account\n\n> Change your name, user name and password, and sign out.\n\nSelect the user icon in the top right corner to open the account menu.\n\n![The account menu with Change credentials and Logout](/files/JaszPV1x060f.webp)\n\n## Change your credentials\n\n1. Select **Change credentials**.\n2. Change the **Name**, the **Login** or both.\n3. To change the password, type the new one in **Password**. Leave it empty to keep the current password.\n4. Select **SUBMIT**.\n\nChanging the credentials signs out every other open session. Your own session stays open.\n\n## Sign out\n\nSelect **Logout**.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszT44c061f","url":"https://totaljs.es/docs/iot/1-0/reference/configuration/","project":"iot","version":"1-0","section":"reference","language":"en","title":"Configuration files","summary":"The keys of the config files of Admin and Stream, and the start options in index.js.","markdown":"---\ntitle: Configuration files\nproject: IoT Platform\nversion: 1.0\nsection: reference\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/reference/configuration/\nupdated: 2026-11-20T06:56:29.450Z\n---\n\n# Configuration files\n\n> The keys of the config files of Admin and Stream, and the start options in index.js.\n\nEach app has a `config` file in its folder. Every line is a key, a colon and a value. Change a value and restart the app.\n\n## Admin\n\n| Key | What it does | Example |\n|---|---|---|\n| `name` | The name of the app until you set **App name** in [Settings](../../guides/settings/). | `IoT Platform` |\n| `database` | The connection to the PostgreSQL database. | `postgresql://user:password@127.0.0.1:5432/iot` |\n| `url` | The public address of Admin. | `https://iot.example.com` |\n\nKeep the other keys of the shipped file as they are.\n\n## Stream\n\n| Key | What it does | Example |\n|---|---|---|\n| `name` | The name of the stream. | `IoT Stream` |\n| `database` | The connection to the same PostgreSQL database as Admin. | `postgresql://user:password@127.0.0.1:5432/iot` |\n| `url` | The public address of the stream, where devices send their data. | `https://stream.example.com` |\n\n## Start options in index.js\n\nBoth apps start from `index.js`. The lines that begin with `//` are switched off. Remove the `//` to use one:\n\n```js\noptions.ip = '127.0.0.1';\noptions.port = 8001;\n```\n\n- `options.ip` limits the app to one network address, for example `127.0.0.1` when a web server on the same machine forwards the requests.\n- `options.port` sets the port. Admin uses `8000` when you start it with `npm start`.\n\nStart an app with `--release` for production:\n\n```bash\nnode index.js --release\n```\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:29.450Z"}
{"id":"JaszT54e061f","url":"https://totaljs.es/docs/iot/1-0/reference/open-data-api/","project":"iot","version":"1-0","section":"reference","language":"en","title":"Open data API","summary":"The public JSON addresses of published devices, sensors, zones, data views and reports, and the panel page.","markdown":"---\ntitle: Open data API\nproject: IoT Platform\nversion: 1.0\nsection: reference\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/reference/open-data-api/\nupdated: 2026-11-20T06:56:29.450Z\n---\n\n# Open data API\n\n> The public JSON addresses of published devices, sensors, zones, data views and reports, and the panel page.\n\nAdmin publishes the data you mark with **Publish a value to an API endpoint** (or **Publish to API endpoint** for a sensor) at public addresses. They need no sign-in and answer with JSON. An item that is not published answers `404`.\n\nAll addresses start with the address of Admin, for example `https://iot.example.com`. Times are in UTC.\n\n## Devices\n\n```text\nGET /opendata/devices/?id=<device id>\n```\n\nThe device id is shown in the device detail. The answer has the device, its driver, its position, its custom attributes and configuration, and `items` with each sensor:\n\n```json\n{\n\t\"id\": \"JasoWV1cL61f\",\n\t\"driverid\": \"demoweather\",\n\t\"driver\": \"Demo weather station\",\n\t\"sn\": \"WS-0001\",\n\t\"lat\": 48.7363,\n\t\"lng\": 19.1462,\n\t\"locality\": \"City park\",\n\t\"attrs\": {},\n\t\"items\": [\n\t\t{ \"id\": \"demoweather_temperature\", \"name\": \"Temperature\", \"format\": \"{0} °C\", \"decimals\": 1, \"value\": 19.9, \"type\": \"number\", \"isonline\": true, \"stats\": \"minutely\", \"dtvalue\": \"2026-11-20T06:10:58.000Z\", \"raw\": \"19.9\" }\n\t]\n}\n```\n\n## Sensors\n\n```text\nGET /opendata/sensors/?id=<device id><sensor id>\n```\n\nThe full address of a published sensor is shown under the sensor in the device detail. The answer has the sensor, its device and driver, its last `value`, the `raw` text of the value, `isonline` and `dtvalue`, the time of the value.\n\n## Zones\n\n```text\nGET /opendata/zones/?id=<zone id>\n```\n\nThe answer has the zone with its `area` (the points of the polygon), its position, picture and custom attributes, and `items` with the sensors of the zone and their last values. Inactive zones are not available.\n\n## Data views\n\n```text\nGET /opendata/dataviews/?id=<data view id>\n```\n\nThe answer has the result in `value`, the `operation`, `format` and `decimals`, and `items` with the value of each sensor:\n\n```json\n{\n\t\"id\": \"JassHN1c261f\",\n\t\"name\": \"Average temperature\",\n\t\"format\": \"{0} °C\",\n\t\"operation\": \"avg\",\n\t\"decimals\": 1,\n\t\"value\": 19.75,\n\t\"items\": [\n\t\t{ \"driverid\": \"demoweather\", \"deviceid\": \"JasoWV1cL61f\", \"sensorid\": \"demoweather_temperature\", \"value\": 19.5, \"dtvalue\": \"2026-11-20T06:10:18.000Z\" }\n\t]\n}\n```\n\n## Reports\n\n```text\nGET /opendata/reports/?id=<report id>\n```\n\nThe answer has the report with its `fields` and the rows of its query in `items`. Copy the address with **Copy API endpoint** in the report menu.\n\n## Panels\n\n```text\nGET /opendata/panels/?id=<panel id>\n```\n\nThis address is the web page of a panel, not JSON. It shows the last content and updates when new content arrives. See [Panels](../../guides/panels/).\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:29.450Z"}
{"id":"JaszT74g061f","url":"https://totaljs.es/docs/iot/1-0/reference/report-data/","project":"iot","version":"1-0","section":"reference","language":"en","title":"Data for reports","summary":"The views and tables to use in the SQL queries of reports.","markdown":"---\ntitle: Data for reports\nproject: IoT Platform\nversion: 1.0\nsection: reference\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/reference/report-data/\nupdated: 2026-11-20T06:56:29.450Z\n---\n\n# Data for reports\n\n> The views and tables to use in the SQL queries of reports.\n\nReports read the PostgreSQL database of the platform. These views and tables hold what you usually need. Times are in UTC.\n\n## view_sensor\n\nOne row for each sensor of each device, with its last value.\n\n| Column | Content |\n|---|---|\n| `device` | The name of the device. |\n| `sensor` | The name of the sensor. |\n| `label` | Locality, device and sensor in one text. |\n| `deviceid`, `sensorid` | The ids of the device and the sensor. |\n| `sn` | The device identifier. |\n| `locality` | The place of the device. |\n| `value` | The last value, as text. |\n| `dtvalue` | The time of the last value. |\n| `format`, `decimals` | How the value is shown. |\n| `isonline` | `true` when the sensor is online. |\n| `stats` | The statistics the sensor keeps. |\n\n## view_device\n\nOne row for each device with `name`, `sn`, `locality`, `lat`, `lng`, `reference`, `driver_name`, `isdisabled` and `isonline`.\n\n## History tables\n\nThe statistics are in one table for each interval: `tbl_data_minutely`, `tbl_data_hourly`, `tbl_data_daily`, `tbl_data_monthly` and `tbl_data_yearly`. Each row is one interval of one sensor:\n\n| Column | Content |\n|---|---|\n| `deviceid`, `sensorid` | The device and the sensor. |\n| `ts` | The start of the interval. |\n| `min`, `max` | The lowest and the highest value in the interval. |\n| `count` | The number of values in the interval. |\n\nSensors with the timeline on also keep every value in `tbl_data_timeline` with `ts`, `deviceid`, `sensorid` and `value`.\n\nJoin the history with `view_sensor` to get readable names:\n\n```sql\nSELECT b.device, b.sensor, a.ts, a.min, a.max, a.count\nFROM tbl_data_hourly a\nINNER JOIN view_sensor b ON b.deviceid = a.deviceid AND b.sensorid = a.sensorid\nORDER BY a.ts DESC\n```\n\n## Driver storage\n\nDrivers can keep their own tables in the `storage` schema. See [Storage](../../development/storage/).\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:29.450Z"}
{"id":"JaszT24a061f","url":"https://totaljs.es/docs/iot/1-0/recipes/test-a-device-without-hardware/","project":"iot","version":"1-0","section":"recipes","language":"en","title":"Test a device without hardware","summary":"Send readings to a new device with a simulation and check them in Sensors and on the map.","markdown":"---\ntitle: Test a device without hardware\nproject: IoT Platform\nversion: 1.0\nsection: recipes\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/recipes/test-a-device-without-hardware/\nupdated: 2026-11-20T06:56:29.450Z\n---\n\n# Test a device without hardware\n\n> Send readings to a new device with a simulation and check them in Sensors and on the map.\n\nBefore a device is installed, you can check the whole chain, from the driver to the map, with readings from a CSV file.\n\n1. Install the driver of the device in **Drivers**. See [Drivers](../../guides/drivers/).\n2. Create the device and fill in its **Device identifier**, for example `WS-0002`. See [Devices](../../guides/devices/).\n3. Wait three minutes, or restart the stream, until the device appears on the [status page of the stream](../../guides/stream/).\n4. Open the **Read me** of the driver and note the address and the fields it expects.\n5. Write a CSV file with those fields. Put `+` in front of the fields that are numbers:\n\n```text\nsn,+temperature,+humidity,+battery\nWS-0002,16.2,61,60\nWS-0002,16.0,62,60\nWS-0002,15.8,63,59\n```\n\n6. In **Simulations**, select **Endpoints** and add the address of the driver on your stream, with its token if it has one.\n7. Select **Create**, choose the CSV file and the endpoint, set **Frequency** to `1`, check **Launch** and select **SUBMIT**.\n8. Open **Sensors**. Every minute one row arrives, and the values of the device change.\n9. Add the sensors to a zone and open the **Map** to see them there.\n\nWhen all rows are sent, the simulation stops. See [Simulations](../../guides/simulations/) for all the options.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:29.450Z"}
{"id":"JaszT14Y061f","url":"https://totaljs.es/docs/iot/1-0/recipes/live-value-on-a-panel/","project":"iot","version":"1-0","section":"recipes","language":"en","title":"Show a live value on a panel","summary":"Read the last value of a published sensor and show it on a panel every minute with a small script.","markdown":"---\ntitle: Show a live value on a panel\nproject: IoT Platform\nversion: 1.0\nsection: recipes\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/recipes/live-value-on-a-panel/\nupdated: 2026-11-20T06:56:29.450Z\n---\n\n# Show a live value on a panel\n\n> Read the last value of a published sensor and show it on a panel every minute with a small script.\n\nThis recipe shows the temperature of a park on a display at its entrance. A small script on any computer reads the published sensor and sends the panel new HTML.\n\n## Prepare the platform\n\n1. Publish the sensor: open the device, select the cog icon of the sensor and **Publish to API endpoint**. Copy the address shown under the sensor.\n2. Create a panel with **Width** `480` and **Height** `240`. See [Panels](../../guides/panels/).\n3. Select **...** on the panel, then **Copy Flow URL address**.\n4. Open the address from **Copy panel URL address** on the display.\n\n## The script\n\nSave this as `panel.sh`, put in the two addresses you copied and run it every minute, for example from cron:\n\n```bash\n#!/bin/sh\nSENSOR='https://iot.example.com/opendata/sensors/?id=<device id><sensor id>'\nPANEL='https://iot.example.com/panels/<panel id>/?token=<token>'\n\nVALUE=$(curl -s \"$SENSOR\" | sed -E 's/.*\"value\":([0-9.-]+).*/\\1/')\n\ncurl -s -X POST \"$PANEL\" -H 'Content-Type: application/json' \\\n  -d \"{\\\"html\\\":\\\"<div style='font-family:Arial;text-align:center;padding:40px'><div style='font-size:20px'>City park</div><div style='font-size:72px;font-weight:bold'>$VALUE &deg;C</div></div>\\\"}\"\n```\n\nEach run answers `{\"success\":true}`, and the display shows the new value at once, without reloading.\n\nA Flow can do the same: read the address of the sensor, build the HTML and post it to the Flow URL address of the panel.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:29.450Z"}
{"id":"JaszSz4W061f","url":"https://totaljs.es/docs/iot/1-0/recipes/keep-raw-readings/","project":"iot","version":"1-0","section":"recipes","language":"en","title":"Keep every reading of a device in a report","summary":"Store each message of a driver in its own table and list it in a report.","markdown":"---\ntitle: Keep every reading of a device in a report\nproject: IoT Platform\nversion: 1.0\nsection: recipes\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/recipes/keep-raw-readings/\nupdated: 2026-11-20T06:56:29.450Z\n---\n\n# Keep every reading of a device in a report\n\n> Store each message of a driver in its own table and list it in a report.\n\nThe statistics of a sensor keep the minimum, maximum and count of each interval. When you need every single reading, for example to check a device, let the driver write it to its own storage table and read the table in a report.\n\n1. Ask the author of the driver to add a storage table and to insert each reading into it, as described in [Storage](../../development/storage/). For example, a table `readings` with the columns `sn` and `temperature`.\n2. Install the new version with **Edit source-code**. The platform creates the table.\n3. Find the name of the table with a report preview. Open **Reports**, select **Create**, write this query and select **Preview data from SQL command**:\n\n```sql\nSELECT table_name FROM information_schema.tables WHERE table_schema = 'storage'\n```\n\n4. Replace the query with one that reads the table, using the name you found:\n\n```sql\nSELECT sn, temperature, dtcreated FROM storage.db1yr6f1treadings ORDER BY dtcreated DESC\n```\n\n5. Set **Map fields** to `sn=Serial number, temperature=Temperature, dtcreated=Received`, give the report a name and select **SUBMIT**.\n\nThe report lists every reading with the time it arrived. Download it as CSV or XLSX from the report.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:29.450Z"}
{"id":"JaszPR1t060f","url":"https://totaljs.es/docs/iot/1-0/faq/devices-and-data/","project":"iot","version":"1-0","section":"faq","language":"en","title":"Devices and data","summary":"Answers about devices that show no data, offline sensors, times and names.","markdown":"---\ntitle: Devices and data\nproject: IoT Platform\nversion: 1.0\nsection: faq\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/faq/devices-and-data/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Devices and data\n\n> Answers about devices that show no data, offline sensors, times and names.\n\n## I created a device, but its values do not change\n\n- Wait three minutes. The stream loads new devices at that interval. Restart the stream to load them at once.\n- Open the [status page of the stream](../../guides/stream/). The id of the device must be there.\n- Check that the **Device identifier** is exactly the one the device sends.\n- Check that the device sends to the address of its driver, with the token if the driver has one. The **Read me** of the driver describes both.\n- Check that the device is not **Temporarily disabled**.\n\n## Why is a sensor offline?\n\nIt received no value within the time its driver allows, for example two hours. It turns online again with the next value.\n\n## In which time zone are the times?\n\nThe database stores times in UTC. The app shows them in the time of your browser. Reports show UTC unless **Convert date and time to local time** is on, and the open data answers in UTC.\n\n## How do I rename a sensor?\n\nFor one device, open the device, select the cog icon of the sensor and **Rename**. For every device of a driver, rename it in the [Dictionary](../../guides/dictionary/).\n\n## Can I keep every value, not only statistics?\n\nYes. Open the device, select the cog icon of the sensor and **Enable timeline**. The history of the sensor can then show **Timeline** in its filter.\n\n## How do I find the id of a device?\n\nOpen the device. The id is shown under its name. The same id is on the status page of the stream.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszPT1v060f","url":"https://totaljs.es/docs/iot/1-0/faq/installation-and-access/","project":"iot","version":"1-0","section":"faq","language":"en","title":"Installation and access","summary":"Answers about ports, the database, the first account and who can open what.","markdown":"---\ntitle: Installation and access\nproject: IoT Platform\nversion: 1.0\nsection: faq\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/faq/installation-and-access/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Installation and access\n\n> Answers about ports, the database, the first account and who can open what.\n\n## Do Admin and Stream need two databases?\n\nNo. Both use the same PostgreSQL database. Admin creates the tables the first time it starts.\n\n## Which ports do the apps use?\n\nAdmin uses `8000` when you start it with `npm start`. Choose another port for the stream in its `index.js`. See [Configuration files](../../reference/configuration/).\n\n## Where do I find the first user name and password?\n\nOn the sign-in page, in the **Default account** box, until somebody signs in for the first time. See [First steps](../../guides/first-steps/).\n\n## What can people see without signing in?\n\nThe sign-in page, the open data you publish, the pages of panels and the uploaded files. Everything else needs an account. See [Open data API](../../reference/open-data-api/).\n\n## Must the stream be public?\n\nYour devices must reach it. Put it behind HTTPS and give each driver a token when your devices can send one.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszRZ3d060f","url":"https://totaljs.es/docs/iot/1-0/development/introduction/","project":"iot","version":"1-0","section":"development","language":"en","title":"Drivers for developers","summary":"What a driver is, where it runs and how a reading travels from a device to a sensor.","markdown":"---\ntitle: Drivers for developers\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/introduction/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Drivers for developers\n\n> What a driver is, where it runs and how a reading travels from a device to a sensor.\n\nA driver connects one kind of device to Total.js IoT Platform. It is a single file that you install in **Drivers** (see [Drivers](../../guides/drivers/)). This section explains how to write one.\n\n## What a driver does\n\n- It describes the device: name, manufacturer, icon and the values it measures. Each value is an **output**, and every device of the driver gets one sensor for each output.\n- It receives data. Usually it creates an HTTP address on the stream where the devices post their readings.\n- It processes each message and sends the values to its outputs. The platform stores them, keeps the statistics and shows them in the app.\n- Optionally it has settings for each device, options for the whole driver, commands, its own database tables and alerts.\n\n## Where a driver runs\n\nAdmin stores the driver in the database. The Stream app loads every driver and every device from the database and runs them in a FlowStream: each driver is a component, and each device is an instance of that component. The stream reloads drivers and devices every three minutes, so a new or changed driver works within three minutes of saving it, without a restart.\n\n## The path of a reading\n\n1. A device posts JSON to the address of its driver on the stream, for example `POST /demoweather/`.\n2. The route of the driver checks the data and finds the instance of the device by its identifier.\n3. The route passes the data to `instance.message` of that device.\n4. `instance.message` sends each value to an output with `instance.newmessage(value).send('temperature')`.\n5. The stream writes the last value and the statistics to the database. The value appears in **Sensors** and on the map.\n\n## What to read next\n\n- [Your first driver](../first-driver/) builds and tests a complete driver.\n- [The driver file](../driver-file/) explains the parts of the file.\n- [Driver reference](../driver-api/) and [Instance reference](../instance-api/) list every property and function.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszR939060f","url":"https://totaljs.es/docs/iot/1-0/development/first-driver/","project":"iot","version":"1-0","section":"development","language":"en","title":"Your first driver","summary":"Write a driver for a weather station, install it, create a device and send it test data.","markdown":"---\ntitle: Your first driver\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/first-driver/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Your first driver\n\n> Write a driver for a weather station, install it, create a device and send it test data.\n\nThis page builds a driver for a weather station that measures temperature, humidity and battery level. The station posts JSON like this to the stream:\n\n```json\n{ \"sn\": \"WS-0001\", \"temperature\": 21.4, \"humidity\": 48, \"battery\": 87 }\n```\n\n## The driver\n\nSave this as `demoweather.html`:\n\n```html\n<script total>\n\n\texports.id = 'demoweather';\n\texports.name = 'Demo weather station';\n\texports.manufacturer = 'Example Ltd.';\n\texports.icon = 'ti ti-temperature';\n\texports.color = '#3B82F6';\n\texports.author = 'Jane Doe';\n\texports.version = '1';\n\texports.config = { offset: 0 };\n\texports.inputs = [{ id: 'input', name: 'Input' }, { id: 'interval', name: 'Change interval', html: '<ui-component name=\"input\" path=\"?.minutes\" config=\"type:number;required:1\">Minutes between readings</ui-component>' }];\n\texports.outputs = [\n\t\t{ id: 'temperature', type: 'number', name: 'Temperature', format: '{0} °C', decimals: 1, stats: 'hourly' },\n\t\t{ id: 'humidity', type: 'number', name: 'Humidity', format: '{0} %', decimals: 0, stats: 'hourly' },\n\t\t{ id: 'battery', type: 'number', name: 'Battery', format: '{0} %', decimals: 0, stats: 'daily' }\n\t];\n\texports.offline = '2 hours';\n\texports.options = [{ id: 'token', type: 'string', name: 'Token', value: '' }];\n\texports.storage = [{ id: 'readings', name: 'Readings', columns: [{ id: 'sn', name: 'Serial number', type: 'string' }, { id: 'temperature', name: 'Temperature', type: 'number' }] }];\n\n\texports.install = function(com) {\n\n\t\tcom.schema = '*sn:String,temperature:Number,humidity:Number,battery:Number'.toJSONSchema();\n\n\t\tcom.route = ROUTE('POST /demoweather/', function($) {\n\n\t\t\tif (com.options.token && com.options.token !== $.headers['x-token']) {\n\t\t\t\t$.invalid(401);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar data = com.schema.transform($.body);\n\t\t\tif (data.error) {\n\t\t\t\t$.invalid(data.error);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar payload = data.response;\n\t\t\tvar flow = com.main.meta.flow;\n\t\t\tvar count = 0;\n\n\t\t\tfor (var key in flow) {\n\t\t\t\tvar instance = flow[key];\n\t\t\t\tif (instance.component === com.id && instance.meta.sn === payload.sn) {\n\t\t\t\t\tinstance.message(instance.newmessage(payload));\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$.json({ count: count });\n\t\t});\n\t};\n\n\texports.uninstall = function(com) {\n\t\tcom.route && com.route.remove();\n\t};\n\n\texports.make = function(instance, config) {\n\n\t\tinstance.message = function($) {\n\n\t\t\tif ($.input === 'interval') {\n\t\t\t\tinstance.debug('Interval changed to', $.data.minutes, 'minutes');\n\t\t\t\t$.destroy();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar data = $.data;\n\n\t\t\tif (data.temperature != null) {\n\t\t\t\tvar temperature = data.temperature + (config.offset || 0);\n\t\t\t\tinstance.newmessage(temperature).send('temperature');\n\t\t\t\tinstance.storage.insert('readings', { sn: data.sn, temperature: temperature });\n\t\t\t}\n\n\t\t\tif (data.humidity != null)\n\t\t\t\tinstance.newmessage(data.humidity).send('humidity');\n\n\t\t\tif (data.battery != null) {\n\t\t\t\tinstance.newmessage(data.battery).send('battery');\n\t\t\t\tif (data.battery < 10)\n\t\t\t\t\tinstance.throw('Battery low: ' + data.battery + ' %');\n\t\t\t}\n\n\t\t\t$.destroy();\n\t\t};\n\n\t\t// JSON posted to the stream address /notify/stream-<device id>/\n\t\tinstance.notify = function(req) {\n\t\t\tif (req.method === 'POST')\n\t\t\t\tinstance.message(instance.newmessage(req.body));\n\t\t};\n\n\t};\n\n</script>\n\n<settings>\n\t<div class=\"padding\">\n\t\t<div class=\"grid-4\">\n\t\t\t<div class=\"m\">\n\t\t\t\t<ui-component name=\"input\" path=\"?.offset\" config=\"type:number\">Temperature correction (°C)</ui-component>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</settings>\n\n<readme>\nDemo weather station. Send readings to `POST /demoweather/` on the stream. When the driver has a token, send it in the `x-token` header.\n\n```json\n{ \"sn\": \"WS-0001\", \"temperature\": 21.4, \"humidity\": 48, \"battery\": 87 }\n```\n</readme>\n```\n\nThe parts in short:\n\n- `exports.id`, `name`, `manufacturer`, `icon`, `color`, `author` and `version` describe the driver in the app.\n- `exports.outputs` creates three sensors for every device: temperature, humidity and battery.\n- `exports.config` and the `<settings>` form give each device a temperature correction. See [Settings and options](../settings-and-options/).\n- `exports.options` gives the driver a token, set in **Drivers > ... > Settings**.\n- `exports.install` creates the route `POST /demoweather/` on the stream. It checks the token and the data, finds the device by its serial number and passes the data on. See [Receiving data](../receiving-data/).\n- `exports.make` sends each value to its output, keeps every temperature in a storage table, reports a low battery as an alert and handles a command.\n\n## Install it\n\n1. In Admin, open **Drivers** and select **Create**.\n2. Replace the template with the content of the file and select **SUBMIT**.\n\n## Create a device\n\n1. Open **Devices** and select **Create**.\n2. Select **Demo weather station**.\n3. Fill in **Name** and set **Device identifier** to `WS-0001`. Select **SUBMIT**.\n4. Wait three minutes, or restart the stream, until the id of the device appears on the status page of the stream.\n\n## Send test data\n\nPost a reading from a terminal on a computer that reaches the stream. If you set a token in the driver settings, send it in the `x-token` header:\n\n```bash\ncurl -X POST https://stream.example.com/demoweather/ \\\n  -H 'Content-Type: application/json' \\\n  -H 'x-token: your-token' \\\n  -d '{\"sn\":\"WS-0001\",\"temperature\":21.4,\"humidity\":48,\"battery\":87}'\n```\n\nThe stream answers with the number of devices that received the reading:\n\n```json\n{\"count\":1}\n```\n\nAn answer of `{\"count\":0}` means that no device has this serial number, or that the stream has not loaded the device yet. A wrong token answers `401`, and invalid data answers with the error of the field:\n\n```json\n[{\"name\":\"sn\",\"error\":\"The field \\\"sn\\\" is invalid\",\"path\":\"sn\"}]\n```\n\n## Check the result\n\nOpen **Sensors** or the device detail. The three sensors are online and show `21.4 °C`, `48 %` and `87 %`. Send a few more readings with other values and open the history of a sensor.\n\nTo send many readings without typing them, use [Simulations](../../guides/simulations/).\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszR837060f","url":"https://totaljs.es/docs/iot/1-0/development/driver-file/","project":"iot","version":"1-0","section":"development","language":"en","title":"The driver file","summary":"The parts of a driver file: the server script, the settings form and the read me.","markdown":"---\ntitle: The driver file\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/driver-file/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# The driver file\n\n> The parts of a driver file: the server script, the settings form and the read me.\n\nA driver is one HTML-like file with up to three parts. Only the first one is required.\n\n```html\n<script total>\n\t// The server script: exports.id, exports.outputs, exports.make, ...\n</script>\n\n<settings>\n\t<!-- The form for the configuration of one device -->\n</settings>\n\n<readme>\nThe description shown in Read me, in Markdown.\n</readme>\n```\n\n## The server script\n\nThe code in `<script total>` runs on the stream. It sets properties and functions on `exports`. When you select **SUBMIT** in the editor, Admin runs the script once to read these properties. A syntax error stops the save and shows the error, for example `SyntaxError: Unexpected token ';'`.\n\n`exports.id` identifies the driver. Use only lower-case letters and digits, for example `demoweather`. When you save a file with an id that already exists, it replaces that driver. Every property is listed in [Driver reference](../driver-api/).\n\n## The settings form\n\nThe `<settings>` part is the form that opens with **Options > Configure** in the device detail. Each field writes to one key of the configuration of the device, with `?.` in front of the key:\n\n```html\n<settings>\n\t<div class=\"padding\">\n\t\t<div class=\"grid-4\">\n\t\t\t<div class=\"m\">\n\t\t\t\t<ui-component name=\"input\" path=\"?.offset\" config=\"type:number\">Temperature correction (°C)</ui-component>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</settings>\n```\n\nSee [Settings and options](../settings-and-options/).\n\n## The read me\n\nThe `<readme>` part is Markdown. People read it with **Read me** in **Drivers** and in the device detail. Describe the address the driver listens on, the data it expects and whether it needs a token.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszRc3h060f","url":"https://totaljs.es/docs/iot/1-0/development/receiving-data/","project":"iot","version":"1-0","section":"development","language":"en","title":"Receiving data","summary":"Create an address on the stream, find the device a reading belongs to, use a token, and use extensions and the notify address.","markdown":"---\ntitle: Receiving data\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/receiving-data/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Receiving data\n\n> Create an address on the stream, find the device a reading belongs to, use a token, and use extensions and the notify address.\n\nA driver decides how data reaches it. The usual way is an HTTP route that the driver creates on the stream when it is installed.\n\n## Create a route\n\nCreate the route in `exports.install` and remove it in `exports.uninstall`. `com` is the driver as a component of the stream:\n\n```js\nexports.install = function(com) {\n\n\tcom.schema = '*sn:String,temperature:Number'.toJSONSchema();\n\n\tcom.route = ROUTE('POST /demoweather/', function($) {\n\n\t\tvar data = com.schema.transform($.body);\n\t\tif (data.error) {\n\t\t\t$.invalid(data.error);\n\t\t\treturn;\n\t\t}\n\n\t\tvar payload = data.response;\n\t\tvar flow = com.main.meta.flow;\n\t\tvar count = 0;\n\n\t\tfor (var key in flow) {\n\t\t\tvar instance = flow[key];\n\t\t\tif (instance.component === com.id && instance.meta.sn === payload.sn) {\n\t\t\t\tinstance.message(instance.newmessage(payload));\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\n\t\t$.json({ count: count });\n\t});\n};\n\nexports.uninstall = function(com) {\n\tcom.route && com.route.remove();\n};\n```\n\n- `com.main.meta.flow` holds every running instance of the stream. The instances of your devices have `component` equal to the id of the driver.\n- `instance.meta.sn` is the **Device identifier** of the device. `instance.meta` also has `name`, `locality`, `lat`, `lng` and `reference`.\n- `instance.newmessage(data)` creates a message, and `instance.message(msg)` hands it to the device.\n\nThe path of the route is shared by the whole stream, so give each driver its own path.\n\n## Check a token\n\nAdd an option to the driver and compare it with a header. The option is set in **Drivers > ... > Settings** and is available in `com.options`:\n\n```js\nexports.options = [{ id: 'token', type: 'string', name: 'Token', value: '' }];\n\nexports.install = function(com) {\n\tcom.route = ROUTE('POST /demoweather/', function($) {\n\n\t\tif (com.options.token && com.options.token !== $.headers['x-token']) {\n\t\t\t$.invalid(401);\n\t\t\treturn;\n\t\t}\n\n\t\t// ...\n\t});\n};\n```\n\nWhen somebody changes the token, the stream applies it at its next reload, within three minutes. [Simulations](../../guides/simulations/) send the token of an endpoint in the `x-token` header, so this check works with them too.\n\n## One address for many drivers: extensions\n\nAn extension is a driver with `exports.extension = true`. It runs once for the whole stream, not once for each device, and it is not offered when people create a device. Use it when a gateway sends the readings of different devices to one address. This extension passes each reading of a batch to the device with the same serial number, whatever its driver:\n\n```html\n<script total>\n\n\texports.id = 'demohub';\n\texports.name = 'Demo gateway';\n\texports.manufacturer = 'Example Ltd.';\n\texports.icon = 'ti ti-router';\n\texports.color = '#8B5CF6';\n\texports.author = 'Jane Doe';\n\texports.version = '1';\n\texports.extension = true;\n\n\texports.install = function(com) {\n\n\t\tcom.route = ROUTE('POST /demohub/', function($) {\n\n\t\t\t// The gateway sends a batch: [{ sn: 'WS-0001', temperature: 21.4 }, ...]\n\t\t\tvar items = $.body instanceof Array ? $.body : [$.body];\n\t\t\tvar flow = com.main.meta.flow;\n\t\t\tvar count = 0;\n\n\t\t\tfor (var item of items) {\n\t\t\t\tfor (var key in flow) {\n\t\t\t\t\tvar instance = flow[key];\n\t\t\t\t\tif (instance.meta && instance.meta.sn === item.sn) {\n\t\t\t\t\t\tinstance.message(instance.newmessage(item));\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$.json({ count: count });\n\t\t});\n\t};\n\n\texports.uninstall = function(com) {\n\t\tcom.route && com.route.remove();\n\t};\n\n\texports.make = function(instance) {\n\t\tinstance.message = function($) {\n\t\t\t$.destroy();\n\t\t};\n\t};\n\n</script>\n\n<readme>\nReceives batches of readings on `POST /demohub/` and passes each reading to the device with the same serial number.\n</readme>\n```\n\n```bash\ncurl -X POST https://stream.example.com/demohub/ \\\n  -H 'Content-Type: application/json' \\\n  -d '[{\"sn\":\"WS-0001\",\"temperature\":20.8},{\"sn\":\"WS-0002\",\"humidity\":57}]'\n```\n\nThe answer is `{\"count\":2}`. Each device processes its reading in its own `instance.message`. The **Extensions** list in **Drivers** shows the installed extensions.\n\n## The notify address\n\nWithout a route of its own, a driver can receive data at the notify address of the stream, one address for each device:\n\n```text\nPOST https://stream.example.com/notify/stream-<device id>/\n```\n\nThe stream calls `instance.notify` of that device with the request:\n\n```js\ninstance.notify = function(req) {\n\tif (req.method === 'POST')\n\t\tinstance.message(instance.newmessage(req.body));\n};\n```\n\nThe stream answers `{\"success\":true}`. The address has no token check of its own: check `req.headers` in `instance.notify` when the data must come from a known sender.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszRb3f060f","url":"https://totaljs.es/docs/iot/1-0/development/outputs-and-history/","project":"iot","version":"1-0","section":"development","language":"en","title":"Outputs and history","summary":"Define the values a device measures, how they are shown and how their history is kept.","markdown":"---\ntitle: Outputs and history\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/outputs-and-history/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Outputs and history\n\n> Define the values a device measures, how they are shown and how their history is kept.\n\nEach item of `exports.outputs` becomes a sensor of every device of the driver:\n\n```js\nexports.outputs = [\n\t{ id: 'temperature', type: 'number', name: 'Temperature', format: '{0} °C', decimals: 1, stats: 'hourly' },\n\t{ id: 'humidity', type: 'number', name: 'Humidity', format: '{0} %', decimals: 0, stats: 'hourly' },\n\t{ id: 'battery', type: 'number', name: 'Battery', format: '{0} %', decimals: 0, stats: 'daily' }\n];\n\nexports.offline = '2 hours';\n```\n\n## The properties of an output\n\n- `id`: identifies the output in the driver. Send values to it by this id.\n- `name`: the name of the sensor. People can rename it in the [Dictionary](../../guides/dictionary/) or for one device.\n- `type`: `number`, `string`, `boolean` or `date`.\n- `format`: how the value is shown. `{0}` is the value. A key of the device configuration in braces, such as `{unit}`, is replaced by its value.\n- `decimals`: the number of decimals shown for numbers.\n- `stats`: how the history is summarised: `none`, `minutely`, `hourly`, `daily`, `monthly` or `yearly`.\n- `offline`: how long the sensor stays online without a new value, for example `'2 hours'`. Without it, the output uses `exports.offline`.\n- `category`: the category of the sensor. Without it, the category is the id of the output. Categories appear in the [Dictionary](../../guides/dictionary/).\n\n## Statistics\n\nFor every value, the stream keeps the minimum, the maximum and the number of values of the interval in `stats` and of every longer interval. An output with `stats: 'minutely'` fills the minutely, hourly, daily, monthly and yearly history; `hourly` starts at hours. The interval can be changed for each device in the device detail.\n\nWhen the timeline of a sensor is on, the stream also keeps every single value.\n\n## Send a value\n\n```js\ninstance.newmessage(21.4).send('temperature');\n```\n\n## Write a value without statistics\n\n`instance.lastvalue(output, value)` sets the last value of a sensor without adding it to the statistics:\n\n```js\ninstance.lastvalue('battery', 85);\n```\n\n## Read the last value\n\n`instance.readvalue(output)` returns a promise with the last stored value of a sensor of this device, its previous value and the time:\n\n```js\ninstance.message = async function($) {\n\tvar last = await instance.readvalue('counter');\n\t// last = { value: 5, prev: null, ts: Date } or undefined\n\tvar difference = last ? $.data.counter - last.value : 0;\n\tinstance.newmessage($.data.counter).send('counter');\n\t$.destroy();\n};\n```\n\nNumbers come back as numbers and booleans as booleans.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszRe3j060f","url":"https://totaljs.es/docs/iot/1-0/development/settings-and-options/","project":"iot","version":"1-0","section":"development","language":"en","title":"Settings and options","summary":"Give each device its own configuration and the whole driver its own options.","markdown":"---\ntitle: Settings and options\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/settings-and-options/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Settings and options\n\n> Give each device its own configuration and the whole driver its own options.\n\nA driver has two kinds of settings:\n\n- The **configuration** belongs to one device. People change it with **Options > Configure** in the device detail.\n- The **options** belong to the driver and apply to all its devices. People change them with **Drivers > ... > Settings**.\n\n## Configuration of a device\n\nSet the default values in `exports.config` and add a `<settings>` form with a field for each key:\n\n```html\n<script total>\n\texports.config = { offset: 0 };\n\n\texports.make = function(instance, config) {\n\t\tinstance.message = function($) {\n\t\t\tvar data = $.data;\n\t\t\tif (data.temperature != null)\n\t\t\t\tinstance.newmessage(data.temperature + (config.offset || 0)).send('temperature');\n\t\t\t$.destroy();\n\t\t};\n\t};\n</script>\n\n<settings>\n\t<div class=\"padding\">\n\t\t<ui-component name=\"input\" path=\"?.offset\" config=\"type:number\">Temperature correction (°C)</ui-component>\n\t</div>\n</settings>\n```\n\nA new device starts with a copy of `exports.config`. The `config` argument of `exports.make` holds the configuration of the device, and the stream applies a changed configuration within three minutes. `config.sn` holds the **Device identifier** too.\n\nWithout a `<settings>` part, the device menu has no **Configure** item.\n\n## Options of the driver\n\n`exports.options` lists the options with their default values:\n\n```js\nexports.options = [{ id: 'token', type: 'string', name: 'Token', value: '' }];\n```\n\nThe **Settings** dialog of the driver shows one field for each option. In the code, the values are in `com.options` in `exports.install`, and in `instance.module.options` in `exports.make`:\n\n```js\nexports.make = function(instance, config) {\n\tinstance.message = function($) {\n\t\tvar token = instance.module.options.token;\n\t\t// ...\n\t};\n};\n```\n\nSaving a new version of the driver keeps the values people set. The stream applies changed options within three minutes.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszQb2V060f","url":"https://totaljs.es/docs/iot/1-0/development/commands/","project":"iot","version":"1-0","section":"development","language":"en","title":"Commands","summary":"Let people send commands to a device from its detail and handle them in the driver.","markdown":"---\ntitle: Commands\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/commands/\nupdated: 2026-11-20T06:56:13.114Z\n---\n\n# Commands\n\n> Let people send commands to a device from its detail and handle them in the driver.\n\nA command is an input of the driver with a small form. People send it with **Commands** in the device detail, and the driver receives it in `instance.message`.\n\n## Define a command\n\nAdd an input with an `html` property. The HTML is the form of the command, and each field writes to one key of the payload:\n\n```js\nexports.inputs = [\n\t{ id: 'input', name: 'Input' },\n\t{ id: 'interval', name: 'Change interval', html: '<ui-component name=\"input\" path=\"?.minutes\" config=\"type:number;required:1\">Minutes between readings</ui-component>' }\n];\n```\n\nInputs without `html` are not commands. The **Commands** button is available only when the driver has at least one command.\n\n## Handle a command\n\n`$.input` is the id of the input, and `$.data` is the payload of the form:\n\n```js\ninstance.message = function($) {\n\n\tif ($.input === 'interval') {\n\t\tinstance.debug('Interval changed to', $.data.minutes, 'minutes');\n\t\t// Send the new interval to the device here\n\t\t$.destroy();\n\t\treturn;\n\t}\n\n\t// ... readings\n\t$.destroy();\n};\n```\n\nThe stream checks for new commands every five seconds and delivers each command once. How the command reaches the device, for example through an API of the device, is up to the driver.\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:13.114Z"}
{"id":"JaszRg3l060f","url":"https://totaljs.es/docs/iot/1-0/development/storage/","project":"iot","version":"1-0","section":"development","language":"en","title":"Storage","summary":"Keep your own data of a driver in database tables and read it in reports.","markdown":"---\ntitle: Storage\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/storage/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Storage\n\n> Keep your own data of a driver in database tables and read it in reports.\n\nA driver can keep its own tables in the PostgreSQL database, for example every raw reading or the state of a parking lot. Declare the tables in `exports.storage`, and the platform creates them when you save the driver.\n\n## Declare a table\n\n```js\nexports.storage = [{\n\tid: 'readings',\n\tname: 'Readings',\n\tcolumns: [\n\t\t{ id: 'sn', name: 'Serial number', type: 'string' },\n\t\t{ id: 'temperature', name: 'Temperature', type: 'number' }\n\t]\n}];\n```\n\nThe column types are `string`, `number`, `boolean`, `date` (date and time), `date2` (date only), `smallint` and `integer`. Every table also gets an `id` and a `dtcreated` column with the time of the insert.\n\nWhen you change the columns and save the driver again, the platform adds, changes and removes the columns. Removing a table from `exports.storage`, or removing the driver, deletes the table and its data.\n\n## Insert a row\n\n```js\ninstance.storage.insert('readings', { sn: data.sn, temperature: temperature });\n```\n\nOnly the declared columns are written. The `id` and `dtcreated` are filled in automatically.\n\n## Read the data\n\nThe tables are in the `storage` schema. Their names start with `db`, followed by a code made from the id of the driver and the id of the table. List them with this query in a report preview:\n\n```sql\nSELECT table_name FROM information_schema.tables WHERE table_schema = 'storage'\n```\n\nThen read a table in a report:\n\n```sql\nSELECT sn, temperature, dtcreated FROM storage.db1yr6f1treadings ORDER BY dtcreated DESC\n```\n\nSee [Keep every reading of a device in a report](../../recipes/keep-raw-readings/).\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
{"id":"JaszQZ2T060f","url":"https://totaljs.es/docs/iot/1-0/development/alerts-and-debugging/","project":"iot","version":"1-0","section":"development","language":"en","title":"Alerts and debugging","summary":"Report problems of a device as alerts and write debug messages to the log of the stream.","markdown":"---\ntitle: Alerts and debugging\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/alerts-and-debugging/\nupdated: 2026-11-20T06:56:13.114Z\n---\n\n# Alerts and debugging\n\n> Report problems of a device as alerts and write debug messages to the log of the stream.\n\n## Report an alert\n\n`instance.throw(message)` creates an alert for the device. It appears on the **Alerts** screen with the name of the device:\n\n```js\nif (data.battery < 10)\n\tinstance.throw('Battery low: ' + data.battery + ' %');\n```\n\n![An alert about a low battery](/files/JaszP81s061f.webp)\n\nReport what the people who look after the devices must act on. See [Alerts](../../guides/alerts/).\n\n## Write debug messages\n\n`instance.debug()` writes a line to `logs/debugger.log` in the folder of the stream. It takes up to four values:\n\n```js\ninstance.debug('Interval changed to', $.data.minutes, 'minutes');\n```\n\nThe stream writes the collected lines once a minute. Each line has the time in UTC, the name of the driver and the id of the device:\n\n```text\n2026-11-20 05:49:44 Demo weather station (JasoWV1cL61f) Interval changed to 15 minutes\n```\n\n## Check what the stream runs\n\nThe [status page of the stream](../../guides/stream/) lists every device and extension with its counters. When a device is missing, the stream has not loaded it yet or the device is disabled.\n\n## Test with real data\n\nReplay recorded readings with [Simulations](../../guides/simulations/), or post them with `curl` as in [Your first driver](../first-driver/).\n","entries":[],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:13.114Z"}
{"id":"JaszQc2X060f","url":"https://totaljs.es/docs/iot/1-0/development/driver-api/","project":"iot","version":"1-0","section":"development","language":"en","title":"Driver reference","summary":"Every property and function a driver sets on exports.","markdown":"---\ntitle: Driver reference\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/driver-api/\nupdated: 2026-11-20T06:56:13.114Z\n---\n\n# Driver reference\n\n> Every property and function a driver sets on exports.\n\nA driver sets these properties and functions on `exports` in its `<script total>` part. Entries of type **property** are values you set, entries of type **event** are functions you define and the stream calls.\n\n## API\n\n### exports.id = 'demoweather';\n\nType: `property`\n\nThe identifier of the driver.\n\nLower-case letters and digits only. A driver saved with an existing id replaces that driver. The id is also the start of the sensor ids, such as `demoweather_temperature`.\n\n### exports.name = 'Demo weather station';\n\nType: `property`\n\nThe name of the driver, shown in Drivers and when people create a device.\n\nA new device gets this name until people change it.\n\n### exports.manufacturer = 'Example Ltd.';\n\nType: `property`\n\nThe maker of the device.\n\n### exports.icon = 'ti ti-temperature';\n\nType: `property`\n\nThe icon of the driver, a Tabler icon class.\n\n### exports.color = '#3B82F6';\n\nType: `property`\n\nThe color of the driver in the app.\n\n### exports.author = 'Jane Doe';\n\nType: `property`\n\nThe author, shown in the device detail.\n\n### exports.version = '1';\n\nType: `property`\n\nThe version of the driver, shown when people choose a driver.\n\n### exports.extension = true;\n\nType: `property`\n\nMakes the driver an extension that runs once for the whole stream.\n\nExtensions are listed under **Extensions** and are not offered when people create a device. See [Receiving data](../receiving-data/).\n\n### exports.outputs = [{ id, name, type, format, decimals, stats, offline, category }];\n\nType: `property`\n\nThe values the device measures. Each output becomes a sensor of every device.\n\nSee [Outputs and history](../outputs-and-history/) for the properties.\n\nExample: Temperature in degrees\n```js\nexports.outputs = [{ id: 'temperature', type: 'number', name: 'Temperature', format: '{0} °C', decimals: 1, stats: 'hourly' }];\n```\n\n### exports.offline = '2 hours';\n\nType: `property`\n\nHow long a sensor stays online without a new value.\n\nThe default for outputs without their own `offline`.\n\n### exports.inputs = [{ id, name, html }];\n\nType: `property`\n\nThe inputs of the driver. Inputs with `html` are commands.\n\nSee [Commands](../commands/).\n\nExample: A command with one field\n```js\nexports.inputs = [{ id: 'input', name: 'Input' }, { id: 'interval', name: 'Change interval', html: '<ui-component name=\"input\" path=\"?.minutes\" config=\"type:number\">Minutes</ui-component>' }];\n```\n\n### exports.config = { offset: 0 };\n\nType: `property`\n\nThe default configuration of a new device.\n\nPeople change it with **Configure** when the driver has a `<settings>` part. See [Settings and options](../settings-and-options/).\n\n### exports.options = [{ id, type, name, value }];\n\nType: `property`\n\nThe options of the whole driver, with their default values.\n\nPeople set them with **Drivers > ... > Settings**. Read them in `com.options` or `instance.module.options`.\n\nExample: A token\n```js\nexports.options = [{ id: 'token', type: 'string', name: 'Token', value: '' }];\n```\n\n### exports.storage = [{ id, name, columns: [{ id, name, type }] }];\n\nType: `property`\n\nThe database tables of the driver.\n\nSee [Storage](../storage/).\n\n### exports.install = function(com) {}\n\nType: `event`\n\nRuns when the stream loads the driver and when a changed driver is loaded again.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `com` | `Object` | yes |  | The driver in the stream. `com.id` is its id, `com.options` its options and `com.main.meta.flow` all running instances. |\n\nCreate routes here and keep them on `com` so that `exports.uninstall` can remove them.\n\nExample: Create a route\n```js\nexports.install = function(com) {\n\tcom.route = ROUTE('POST /demoweather/', function($) {\n\t\t$.success();\n\t});\n};\n```\n\n### exports.uninstall = function(com) {}\n\nType: `event`\n\nRuns before a changed driver is loaded again and when the driver is removed.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `com` | `Object` | yes |  | The driver in the stream. |\n\nRemove what `exports.install` created.\n\nExample: Remove the route\n```js\nexports.uninstall = function(com) {\n\tcom.route && com.route.remove();\n};\n```\n\n### exports.make = function(instance, config) {}\n\nType: `event`\n\nRuns for each device of the driver and defines how it processes data.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `instance` | `Object` | yes |  | The device in the stream. |\n| `config` | `Object` | yes |  | The configuration of the device, including `sn`. |\n\nFor an extension it runs once. Define `instance.message` here. See [Instance reference](../instance-api/).\n","entries":[{"type":"property","name":"exports.id","signature":"exports.id = 'demoweather';","since":"","deprecated":false},{"type":"property","name":"exports.name","signature":"exports.name = 'Demo weather station';","since":"","deprecated":false},{"type":"property","name":"exports.manufacturer","signature":"exports.manufacturer = 'Example Ltd.';","since":"","deprecated":false},{"type":"property","name":"exports.icon","signature":"exports.icon = 'ti ti-temperature';","since":"","deprecated":false},{"type":"property","name":"exports.color","signature":"exports.color = '#3B82F6';","since":"","deprecated":false},{"type":"property","name":"exports.author","signature":"exports.author = 'Jane Doe';","since":"","deprecated":false},{"type":"property","name":"exports.version","signature":"exports.version = '1';","since":"","deprecated":false},{"type":"property","name":"exports.extension","signature":"exports.extension = true;","since":"","deprecated":false},{"type":"property","name":"exports.outputs","signature":"exports.outputs = [{ id, name, type, format, decimals, stats, offline, category }];","since":"","deprecated":false},{"type":"property","name":"exports.offline","signature":"exports.offline = '2 hours';","since":"","deprecated":false},{"type":"property","name":"exports.inputs","signature":"exports.inputs = [{ id, name, html }];","since":"","deprecated":false},{"type":"property","name":"exports.config","signature":"exports.config = { offset: 0 };","since":"","deprecated":false},{"type":"property","name":"exports.options","signature":"exports.options = [{ id, type, name, value }];","since":"","deprecated":false},{"type":"property","name":"exports.storage","signature":"exports.storage = [{ id, name, columns: [{ id, name, type }] }];","since":"","deprecated":false},{"type":"event","name":"exports.install","signature":"exports.install = function(com) {}","since":"","deprecated":false},{"type":"event","name":"exports.uninstall","signature":"exports.uninstall = function(com) {}","since":"","deprecated":false},{"type":"event","name":"exports.make","signature":"exports.make = function(instance, config) {}","since":"","deprecated":false}],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:13.114Z"}
{"id":"JaszRB3B060f","url":"https://totaljs.es/docs/iot/1-0/development/instance-api/","project":"iot","version":"1-0","section":"development","language":"en","title":"Instance reference","summary":"The handlers, functions and properties of a device in exports.make.","markdown":"---\ntitle: Instance reference\nproject: IoT Platform\nversion: 1.0\nsection: development\nlanguage: en\nlicense: Total.js Enterprise\nurl: https://totaljs.es/docs/iot/1-0/development/instance-api/\nupdated: 2026-11-20T06:56:18.114Z\n---\n\n# Instance reference\n\n> The handlers, functions and properties of a device in exports.make.\n\nThe instance is one device of the driver. `exports.make` receives it, and you define its handlers there:\n\n```js\nexports.make = function(instance, config) {\n\n\tinstance.message = function($) {\n\t\t$.destroy();\n\t};\n\n};\n```\n\nEntries of type **event** are functions that you define and the stream calls. Entries of type **method** are functions that the stream provides.\n\n## API\n\n### instance.message = function($) {}\n\nType: `event`\n\nReceives the data and the commands of the device.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `$` | `Object` | yes |  | The message. |\n\n`$.data` is the data, `$.input` the id of the input. End every message with `$.destroy()`.\n\nExample: Send a value to an output\n```js\ninstance.message = function($) {\n\tif ($.data.temperature != null)\n\t\tinstance.newmessage($.data.temperature).send('temperature');\n\t$.destroy();\n};\n```\n\n### instance.notify = function(req) {}\n\nType: `event`\n\nReceives the requests sent to the notify address of the device.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `req` | `Object` | yes |  | The request with `method`, `body`, `query`, `headers`, `ip` and `url`. |\n\nThe address is `/notify/stream-<device id>/` on the stream. See [Receiving data](../receiving-data/).\n\nExample: Pass posted data on\n```js\ninstance.notify = function(req) {\n\tif (req.method === 'POST')\n\t\tinstance.message(instance.newmessage(req.body));\n};\n```\n\n### instance.newmessage(data)\n\nType: `method`\n\nCreates a message.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `data` | `Object` | yes |  | The data of the message. |\n\nReturns: `Object` The message.\n\nSend it to an output with `.send(output)`, or hand it to the device with `instance.message(msg)`.\n\nExample: Send a value\n```js\ninstance.newmessage(21.4).send('temperature');\n```\n\n### instance.lastvalue(output, value)\n\nType: `method`\n\nSets the last value of a sensor without adding it to the statistics.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `output` | `String` | yes |  | The id of the output. |\n| `value` | `Object` | yes |  | The value. |\n\nExample: Set the battery level\n```js\ninstance.lastvalue('battery', 85);\n```\n\n### await instance.readvalue(output)\n\nType: `method`\n\nReads the last stored value of a sensor of this device.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `output` | `String` | yes |  | The id of the output. |\n\nReturns: `Promise` An object `{ value, prev, ts }`, or `undefined` when the sensor has no value yet.\n\nNumbers, booleans and dates come back in their type.\n\nExample: Compare with the last value\n```js\nvar last = await instance.readvalue('counter');\nvar difference = last ? $.data.counter - last.value : 0;\n```\n\n### instance.throw(message)\n\nType: `method`\n\nCreates an alert for the device.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `message` | `String` | yes |  | The text of the alert. |\n\nThe alert appears on the **Alerts** screen. See [Alerts and debugging](../alerts-and-debugging/).\n\nExample: A low battery\n```js\ninstance.throw('Battery low: ' + data.battery + ' %');\n```\n\n### instance.debug(a, [b], [c], [d])\n\nType: `method`\n\nWrites a line to logs/debugger.log of the stream.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `a` | `Object` | yes |  | The first value. |\n| `b` | `Object` | no |  | More values. |\n\nThe stream writes the collected lines once a minute.\n\nExample: Log a command\n```js\ninstance.debug('Interval changed to', $.data.minutes, 'minutes');\n```\n\n### instance.storage.insert(table, data)\n\nType: `property`\n\nInserts a row into a storage table of the driver.\n\nSee [Storage](../storage/).\n\nExample: Keep a reading\n```js\ninstance.storage.insert('readings', { sn: data.sn, temperature: 21.4 });\n```\n\n### instance.id\n\nType: `property`\n\nThe id of the device.\n\nThe id shown in the device detail and on the status page of the stream.\n\n### instance.component\n\nType: `property`\n\nThe id of the driver of the device.\n\n### instance.meta\n\nType: `property`\n\nThe device: `sn`, `name`, `locality`, `lat`, `lng` and `reference`.\n\n`instance.meta.sn` is the **Device identifier**.\n\n### instance.config\n\nType: `property`\n\nThe configuration of the device, the same object as `config` in `exports.make`.\n\n### instance.module\n\nType: `property`\n\nThe driver. `instance.module.options` holds its options.\n","entries":[{"type":"event","name":"instance.message","signature":"instance.message = function($) {}","since":"","deprecated":false},{"type":"event","name":"instance.notify","signature":"instance.notify = function(req) {}","since":"","deprecated":false},{"type":"method","name":"instance.newmessage","signature":"instance.newmessage(data)","since":"","deprecated":false},{"type":"method","name":"instance.lastvalue","signature":"instance.lastvalue(output, value)","since":"","deprecated":false},{"type":"method","name":"instance.readvalue","signature":"await instance.readvalue(output)","since":"","deprecated":false},{"type":"method","name":"instance.throw","signature":"instance.throw(message)","since":"","deprecated":false},{"type":"method","name":"instance.debug","signature":"instance.debug(a, [b], [c], [d])","since":"","deprecated":false},{"type":"property","name":"instance.storage","signature":"instance.storage.insert(table, data)","since":"","deprecated":false},{"type":"property","name":"instance.id","signature":"instance.id","since":"","deprecated":false},{"type":"property","name":"instance.component","signature":"instance.component","since":"","deprecated":false},{"type":"property","name":"instance.meta","signature":"instance.meta","since":"","deprecated":false},{"type":"property","name":"instance.config","signature":"instance.config","since":"","deprecated":false},{"type":"property","name":"instance.module","signature":"instance.module","since":"","deprecated":false}],"license":"Total.js Enterprise","updated":"2026-11-20T06:56:18.114Z"}
