ioBroker / ioBroker.socketio

This adapter allows to communicate different web applications with ioBroker.
MIT License
25 stars 13 forks source link
iobroker remote-control smarthome web

Logo

ioBroker socket.io

Number of Installations Number of Installations NPM version Downloads

NPM

This adapter is used by WEB applications and adapters to communicate with ioBroker using websockets and the socket.io protocol.

Important Note: Since v4.0 of this adapter pure Websockets are used exclusively! Socket.io is no longer implemented by the socket.io library, but simulated via pure WebSockets!

Users can use this adapter to connect their products to ioBroker via web sockets. Actually, this adapter could be used by echarts, vis and many other adapters to extract data from ioBroker.

If possible, please use iobroker.ws instead of this adapter.

You can find in the example directory simple application that uses this interface to show some data.

By using of socket.io interface user should understand the basics and concept of the system.

It is useful to read about the structure of the objects too.

This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers. For more details and for information how to disable the error reporting see Sentry-Plugin Documentation! Sentry reporting is used starting with js-controller 3.0.

Brief description of concept

Object

Object is description of data point or group. The group could content other data points in this case it called channel. If a group consists of other channels, in this case it is called device.

Object is meta information that describes data point and could content: max/min value, unit, name, default value, type of value, information for adapter for communication (e.g., ip address) and so on.

State

State is the actual value of the data point and presented by javascript object:

{
    val: VALUE, 
    ack: ACKNOWLEDGED, 
    ts: TIMESTAMP, // could be converted into time with "new Date(state.ts)" (In older version of js-controller - "new Date(state.ts * 1000)")
    lc: TIMESTAMP of last change, 
    from: ADAPTER_NAME, 
    q: QUALITY
}

States change itself very frequently in compare to the objects. (Normally objects should be changed once by creation and that's all)

Acknowledgment

Every state has the attribute ack. It shows the direction of command.

Example: we have some home automation adapter (HAA) that has one lamp connected under address haa.0.lamp1.

Quality

Every data point has an attribute q - quality.

Usage

You can find the description of every supported method here.

It is suggested to use socket class for communication.

Tuning Web-Sockets

On some web-sockets clients, there is a performance problem with communication. Sometimes this issue is due to the fallback of socket.io communication on long polling mechanism. You can set the option Force Web-Sockets to force using only web-sockets transport.

Changelog

6.7.1 (2024-06-26)

6.7.0 (2024-04-27)

6.6.1 (2024-02-22)

6.6.0 (2023-10-13)

6.5.7 (2023-10-08)

6.5.6 (2023-09-28)

6.5.5 (2023-09-14)

6.5.3 (2023-09-05)

6.5.2 (2023-08-01)

6.4.0 (2023-07-07)

(bluefox) extended the getObjects function with the possibility to read the list of IDs

6.3.5 (2023-03-17)

6.3.4 (2023-03-03)

6.3.3 (2022-12-22)

6.3.1 (2022-11-27)

6.2.0 (2022-11-08)

6.1.10 (2022-08-24)

6.1.8 (2022-07-08)

License

The MIT License (MIT)

Copyright (c) 2014-2024 bluefox dogafox@gmail.com