npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bobaos.ws

v2.0.1

Published

WebSocket interface for bobaos.pub

Downloads

4

Readme

bobaos.ws

Hello, friend.

Bobaos.ws is a service adding WebSocket support to bobaos datapoint sdk.

Installation

First, make sure that bobaos.pub is installed.

Then, installation is performed via npm:

sudo npm install -g bobaos.ws

You can run it:

pi@pi:~$ bobaos-ws
Starting bobaos.ws
bobaos sdk: ready

Try to send from any websocket client following request on port 49190

{"request_id": 42, "method": "ping", "payload": null}

If everything is ok, create service file `/etc/systemd/system/bobaos_ws.service:

[Unit]
Description=WebSocket server for bobaos.pub
After=bobaos_pub.service

[Service]
User=pi
ExecStart=/usr/bin/env bobaos-ws
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Reload systemd, start and enable daemon:

sudo systemctl daemon-reload
sudo systemctl start bobaos_ws.service
sudo systemctl enable bobaos_ws.service

After that, to configure bobaos.ws edit /usr/lib/node_modules/bobaos.ws/config.json file.

Protocol

Overview

Published messages to websocket are serialized JSON objects, containing required fields request_id, method, payload. For broadcasted messages request_id field is not used.

For outgoing requests:

  • request_id is used to receive response exactly to this request. If it is not defined then you will not receive response from server.
  • method is an API method.
  • payload depends on method. It may be datapoint id, array of ids, value, or null.

Request:

{
  "request_id": 420,
  "method": "get parameter byte",
  "payload": [1,2,3,4]
}

Response:

{
  "response_id":420,
  "method":"success",
  "payload":[1,3,5,7]
}

API methods

  • Method: ping. Payload: null.

    Returns true/false depending on running state of bobaos.pub service.

  • Method: get sdk state. Payload: null.

    Check if connected to BAOS.

  • Method: reset.

    Restart SDK. Reload datapoints/server items.

  • Method: get description. Payload: null/id/[id1, .. idN].

    Get description for datapoints with given ids. If payload is null then description for all datapoints will be returned.

  • Method: get value. Payload: id/[id1, .. idN].

    Get value for datapoints with given ids.

  • Method: get stored value. Payload: id/[id1, .. idN].

    Get value stored in bobaos.pub service. Do not send any data via UART.

  • Method: set value. Payload: {id: i, value: v}/[{id: i1, value: v1}, .. {id: iN, value: vN}]

    Set datapoints value and send to bus. Keep in mind that after successful request, new datapoint value will be broadcasted to all websocket clients, including sender.

  • Method: read value. Payload: id/[id1, .. idN].

    Send read requests to KNX bus. Keep in mind that datapoint object should have active Update flag. If reading was successful then datapoint value will be broadcasted.

  • Method: get server item. Payload: null/id/[id1, .. idN].

    Get server items with given id/name/names. To get all server items use null as a payload.

  • Method: set programming mode. Payload: 1/0/true/false.

    Send to BAOS request to go into programming mode.

  • Method: get programming mode. Payload: null.

    Return current value of ProgrammingMode sever item.

  • Method: get parameter byte. Payload: id/[id1, .. idN].

    Get parameter byte values for given ids.

Communication example

{"request_id": 42, "method": "ping", "payload": null}
{"response_id":42,"method":"success","payload":true}
{"request_id": 42, "method": "get sdk state", "payload": null}
{"response_id":42,"method":"success","payload":"ready"}
{"request_id": 42, "method": "reset", "payload": null}
{"method":"sdk state","payload":"stop"}
{"method":"sdk state","payload":"ready"}
{"response_id":42,"method":"success","payload":null}
{"method":"datapoint value","payload":{"id":1,"value":26.1,"raw":[13,25]}}
{"request_id": 42, "method": "get description", "payload": 1}
{"response_id":42,"method":"success","payload":{"id":1,"length":2,"flags":{"priority":"low","communication":true,"read":false,"write":true,"readOnInit":false,"transmit":true,"update":true},"dpt":"dpt9"}}
{"method":"datapoint value","payload":{"id":1,"value":26,"raw":[13,20]}}
{"request_id": 42, "method": "get value", "payload": 1}
{"response_id":42,"method":"success","payload":{"id":1,"value":26,"raw":[13,20]}}
{"request_id": 42, "method": "get value", "payload": [1, 107]}
{"response_id":42,"method":"success","payload":[{"id":1,"value":26,"raw":[13,20]},{"id":107,"value":true,"raw":[1]}]}
{"request_id": 42, "method": "get stored value", "payload": [1, 107]}
{"response_id":42,"method":"success","payload":[{"id":1,"value":26,"raw":[13,20]},{"id":107,"value":true,"raw":[1]}]}
{"method":"datapoint value","payload":{"id":1,"value":26.1,"raw":[13,25]}}
{"method":"datapoint value","payload":{"id":1,"value":26.1,"raw":[13,25]}}
{"request_id": 42, "method": "set value", "payload": {"id": 101, "value": true}}
{"response_id":42,"method":"success","payload":{"id":101,"value":true,"raw":[1]}}
{"method":"datapoint value","payload":{"id":101,"value":true,"raw":[1]}}
{"method":"datapoint value","payload":{"id":43,"value":true,"raw":[1]}}
{"method":"datapoint value","payload":{"id":1,"value":26.1,"raw":[13,25]}}
{"request_id": 42, "method": "set value", "payload": [{"id": 101, "value": false}, {"id": 102, "value": 1}]}
{"method":"datapoint value","payload":{"id":43,"value":false,"raw":[0]}}
{"method":"datapoint value","payload":{"id":105,"value":false,"raw":[0]}}
{"method":"datapoint value","payload":{"id":106,"value":true,"raw":[1]}}
{"response_id":42,"method":"success","payload":[{"id":101,"value":false,"raw":[0]},{"id":102,"value":true,"raw":[1]}]}
{"method":"datapoint value","payload":[{"id":101,"value":false,"raw":[0]},{"id":102,"value":true,"raw":[1]}]}
{"method":"datapoint value","payload":{"id":1,"value":26.1,"raw":[13,25]}}
{"request_id": 42, "method": "set value", "payload": [{"id": 101, "value": 1}, {"id": 102, "value": 0}]}
{"method":"datapoint value","payload":{"id":43,"value":true,"raw":[1]}}
{"method":"datapoint value","payload":{"id":105,"value":true,"raw":[1]}}
{"method":"datapoint value","payload":{"id":106,"value":false,"raw":[0]}}
{"response_id":42,"method":"success","payload":[{"id":101,"value":true,"raw":[1]},{"id":102,"value":false,"raw":[0]}]}
{"method":"datapoint value","payload":[{"id":101,"value":true,"raw":[1]},{"id":102,"value":false,"raw":[0]}]}
{"method":"datapoint value","payload":{"id":1,"value":26.2,"raw":[13,30]}}
{"request_id": 42, "method": "read value", "payload": [1, 101, 107]}
{"response_id":42,"method":"success","payload":null}
{"method":"datapoint value","payload":{"id":1,"value":26.1,"raw":[13,25]}}
{"method":"datapoint value","payload":{"id":43,"value":true,"raw":[1]}}
{"method":"datapoint value","payload":{"id":101,"value":true,"raw":[1]}}
{"method":"datapoint value","payload":{"id":107,"value":true,"raw":[1]}}
{"request_id": 42, "method": "read value", "payload": [1, 102, 107]}
{"response_id":42,"method":"success","payload":null}
{"method":"datapoint value","payload":{"id":1,"value":26.1,"raw":[13,25]}}
{"method":"datapoint value","payload":{"id":102,"value":false,"raw":[0]}}
{"method":"datapoint value","payload":{"id":107,"value":true,"raw":[1]}}
{"method":"datapoint value","payload":{"id":1,"value":26.1,"raw":[13,25]}}
{"method":"datapoint value","payload":{"id":1,"value":26.1,"raw":[13,25]}}
{"request_id": 42, "method": "get server item", "payload": "SerialNumber"}
{"response_id":42,"method":"success","payload":{"id":8,"name":"SerialNumber","value":[0,197,1,1,142,183]}}
{"method":"datapoint value","payload":{"id":1,"value":26,"raw":[13,20]}}
{"request_id": 42, "method": "set programming mode", "payload": 1}
{"response_id":42,"method":"success","payload":{"id":15,"name":"ProgrammingMode","value":true}}
{"request_id": 42, "method": "get programming mode", "payload": null}
{"response_id":42,"method":"success","payload":true}
{"request_id": 42, "method": "set programming mode", "payload": false}
{"response_id":42,"method":"success","payload":{"id":15,"name":"ProgrammingMode","value":false}}
{"method":"datapoint value","payload":{"id":1,"value":25.9,"raw":[13,15]}}
{"request_id": 42, "method": "get programming mode", "payload": null}
{"response_id":42,"method":"success","payload":false}
{"request_id": 42, "method": "get parameter byte", "payload": [1, 2, 3, 4, 5]}
{"response_id":42,"method":"success","payload":[1,3,5,7,9]}
{"method":"datapoint value","payload":{"id":1,"value":25.9,"raw":[13,15]}}