Giter Club home page Giter Club logo

Comments (6)

ebaauw avatar ebaauw commented on June 3, 2024

Currently, the websocket only issues events for sensors, see issue #32.

from deconz-rest-plugin.

dghh avatar dghh commented on June 3, 2024

Thank you very much ! Get gray hair in the meantime.
When can we expect to have websockets also for switches / lights ? Do you know this ?

from deconz-rest-plugin.

dghh avatar dghh commented on June 3, 2024

Just forget something. Do you have some example script how to use this websocket (beside that only sensors at the moment available)

from deconz-rest-plugin.

ebaauw avatar ebaauw commented on June 3, 2024

I use a very basic NodeJS script on my MacBook, just to monitor what events are being published:

#!/usr/local/bin/node

'use strict';

const WebSocket = require('ws');
const host = '192.168.xxx.xxx';
const port = 443;

const ws = new WebSocket('ws://' + host + ':' + port);

ws.on('open', function open() {
});

ws.on('message', function message(data, flags) {
  const date = String(new Date()).substring(0, 24);
  console.log(date + ": " + data);
});

NodeJS doesn't seem to come with a native web sockets implementation, so you need to npm install ws in the directory where you place the script. Note that node installs under /usr/bin on the Raspberry Pi, so you might need to change the first line.

To install NodeJS (incl. npm) on macOS, just download and run the installer (I'm using the 6.10.3 LTS version). For the Raspberry Pi, follow these steps (I'm using the 6_x version).

from deconz-rest-plugin.

ebaauw avatar ebaauw commented on June 3, 2024

PS. The script was inspired by the API documentation.

from deconz-rest-plugin.

dghh avatar dghh commented on June 3, 2024

from deconz-rest-plugin.

Related Issues (20)

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.