Coder Social home page Coder Social logo

iobroker.ws's Introduction

Logo

ioBroker.ws

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.

It is almost the same as ioBroker.socketio, but does not use socket.io library and only simulates it.

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.

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.

  • If ack=false, it means some other adapter wants to control (write) this variable, so that command will be executed (e.g., light will be switched on).
  • If ack=true, it means that the device informs about new value. (e.g., light was switched on manually or motion was detected)

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

  • Lamp can be switched on manually with physical switch or via Wi-Fi with the help of HAA.
  • If vis wants to switch the lamp on via Wi-Fi, it should set the new value with {value: true, ack: false}.
  • When the lamp is switched on it is normally informing HAA about new state and the value should be immediately overwritten with {value: true, ack: true}.
  • If the lamp is switched off manually via physical switch it informs HAA about new state with {value: false, ack: true}.

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.

Changelog

2.6.2 (2024-06-26)

  • (bluefox) Corrected call of getObjectView with null parameter

2.6.1 (2024-04-22)

  • (foxriver76) fixed require of webserver

2.6.0 (2024-04-21)

  • (foxriver76) use @iobroker/webserver

2.5.11 (2024-02-22)

  • (bluefox) Some packages were updated

2.5.10 (2023-12-17)

  • (foxriver76) updated ws-server to increase the file limit to 500 MB

2.5.9 (2023-12-14)

  • (joltcoke) Corrected the crash if authentication is enabled

2.5.8 (2023-10-11)

  • (bluefox) Corrected adapter termination if the alias has no target

2.5.7 (2023-10-07)

  • (foxriver76) upgraded socket-classes to fix vis problems

2.5.6 (2023-09-28)

  • (bluefox) upgraded socket-classes to correct the error by unsubscribing on client disconnect

2.5.5 (2023-09-14)

  • (foxriver76) upgraded socket-classes to fix crash cases

2.5.4 (2023-09-05)

  • (mcm1957) added missing node16 requirement

2.5.3 (2023-08-01)

  • (bluefox) Added the subscribing on the specific instance messages

2.4.0 (2023-07-07)

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

2.3.6 (2023-03-03)

  • (bluefox) Allowed deletion of fullcalendar objects

2.3.5 (2023-01-29)

  • (bluefox) added publishFileAll method (for future use)

2.3.4 (2022-12-27)

  • (bluefox) corrected connection string

2.3.3 (2022-12-22)

  • (bluefox) used new socket-classes

2.3.1 (2022-11-27)

  • (bluefox) Added fileChange event

License

The MIT License (MIT)

Copyright (c) 2014-2024 bluefox [email protected]

iobroker.ws's People

Contributors

apollon77 avatar dependabot[bot] avatar foxriver76 avatar germanbluefox avatar joltcoke avatar mcm1957 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

iobroker.ws's Issues

No connect with Pixel Watch

Habe die APK über ADB installiert.
Den Websocket Adapter auf Port 8084 eingestellt.

Grüner Haken in der Watch App wechselt ständig vom roten X zum grünen Haken.
Protokoll des ioBrokers läuft voll. (s. Screenshot)

Aktuelle ioBroker Installation auf VM.
Hatte jemand diesen Fehler schonmal?

LG

2023-02-04 20_05_54-logs - ioBrokerVM

Update stable version in repo from 2.5.8 to 2.5.10

Think about update stable version to 2.5.10

Version: stable=2.5.8 (82 days old) => latest=2.5.10 (15 days old)
Installs: stable=23089 (71.42%), latest=2684 (8.3%), total=32328

Click to use developer portal
Click to edit

Note: This is an automatically generated message and not personally authored by bluefox!

Update stable version in repo from 2.5.10 to 2.5.11

Think about update stable version to 2.5.11

Version: stable=2.5.10 (82 days old) => latest=2.5.11 (15 days old)
Installs: stable=21005 (61.44%), latest=2392 (7%), total=34186

Click to use developer portal
Click to edit

Note: This is an automatically generated message and not personally authored by bluefox!
Do not close this issue manually as a new issue will be created if condition for update still exists
@mcm1957 for evidence

Please fix issues reported by adapter checker

❗ [E510] "/admin/i18n/uk/translations.json" or "admin/i18n/uk.json" not found, but admin support is declared
👀 [W171] "common.title" is deprecated in io-package.json
👀 [W105] "common.titleLang" should be translated into all supported languages (en, de, ru, pt, nl, fr, it, es, pl, uk, zh-cn)
👀 [W109] "common.desc" should be translated into all supported languages (en, de, ru, pt, nl, fr, it, es, pl, uk, zh-cn)
👀 [W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package

Socket.IO Java/Android

Hello,

for my project (https://github.com/Schnup89/ioBroker_WearV2) I've used the iobroker socket.io adapter and I want to migrate it to the websocket adapter.

I've used socket.io java client (v1.0.1) for android to get the data from socket.io (v2.x) iobroker server.
https://socketio.github.io/socket.io-client-java/installation.html

This adapter is installed and running on port 8085, but with the socket.io client v1.0.1 or v2.0.1 I always get "parse error".
Should it be possible with socket.io library out of the box or is there any modification necessary?

[email protected] Cannot create webserver: TypeError: WebServer is not a constructor

Adapter Version 2.6.0
`host.rockpro64
2024-04-22 08:10:11.362 info Do not restart adapter system.adapter.ws.0 because desired by instance
host.rockpro64
2024-04-22 08:10:11.361 info instance system.adapter.ws.0 terminated by request of the instance itself and will not be restarted, before user restarts it.

ws.0
2024-04-22 08:10:11.091 info terminating http server on port 8084

ws.0
2024-04-22 08:10:10.432 info Terminated (ADAPTER_REQUESTED_TERMINATION): Without reason

ws.0
2024-04-22 08:10:10.428 error Cannot create webserver: TypeError: WebServer is not a constructor

ws.0
2024-04-22 08:10:10.378 info starting. Version 2.6.0 in /opt/iobroker/node_modules/iobroker.ws, node: v20.12.2, js-controller: 5.0.19
host.rockpro64
2024-04-22 08:10:06.337 info instance system.adapter.ws.0 started with pid 683055`

WS Socket und Vis App

Wenn ein WSSocket in der Web Instanz eingetragen ist, funktioniert die Vis App nicht mehr. Es werden keine Projekte ermittelt und somit funktioniert die App auch nicht.

Please fix issued reported by adapter checker

❗ [E116] No SPDX license found. Please use one of listed here: https://spdx.org/licenses/
❗ [E117] Licenses in package.json and in io-package.json are different
❗ [E510] "/admin/i18n/uk/translations.json" or "admin/i18n/uk.json" not found, but admin support is declared
👀 [W171] "common.title" is deprecated in io-package.json. Please remove from io-package.json.
👀 [W105] "common.titleLang" should be translated into all supported languages (en, de, ru, pt, nl, fr, it, es, pl, uk, zh-cn)
👀 [W109] "common.desc" should be translated into all supported languages (en, de, ru, pt, nl, fr, it, es, pl, uk, zh-cn)
👀 [W114] "common.license" in io-package.json is deprecated. Please define object "common.licenseInformation"
👀 [W173] "@iobroker/adapter-core" (^3.0.4) should be 3.0.6 or newer - please update
👀 [W028] Minimum node.js version 18 recommended. Please adapt "{'engines' : { 'node' >= '16' } }" at package.json.
👀 [W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.