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

@paddybyers/heatmiser-neohub.js

v1.0.0

Published

A javascript CLI and client library for the Heatmiser NeoHub v2

Downloads

1

Readme

heatmiser-neohub.js

Overview

This is an embryonic client library and CLI for the Heatmiser NeoHub v2. This work really is at a very early stage, so expect bugs. Issues and PRs are welcome.

At present this library is based on the legacy (TCP-based) protocol. I will extend it to support the websocket protocol as soon as support is added to the Android app to support key generation for API access. Therefore, in order to use this library, you must enable legacy API access for your hub via the app, and then establish a connection to ensure that the API remains accessible for a usable period of time.

Connection and discovery

This library uses the UDP broadcast-based discovery mechanism, and therefore in order to run it you need to be on the same local network as the Hub.

The library will save discovered Hub details in ~/.neo. Once discovered the Hub IP will remain cached until there is a failure to connect to that address, after which the cache is purged and re-discovery will take place.

Installation

npm install --save heatmiser-neohub.js

CLI

The CLI currently supports read-only access to the hub, so the hub, devices/zones and profiles can be inspected. Modification of device/zone settings is also possible via the protocol, so update/delete operations may be added in the future. PRs are welcome.

The CLI is based on the Vorpal.js framework, so operates in two modes:

  • a conventional CLI with arguments given on the command line. For example ./neo.js hub status will show the status of the local hub;

  • interactive mode, entered by launching the CLI with no arguments, via ./neo.js. This enters an interactive command interpreter in which the various CLI commands can be entered directly, eg with hub status.

Commands

hub show-saved

Displays the cached details of the currently known local hub, if any.

hub delete-saved

Deletes the cached details of the currently known local hub, if any.

hub discover

Initiates a discovery to find a local hub, replacing the cached hub details if there are any. Discovery uses the UDP broadcast-based mechanism.

hub status

Displays details of the hub on the current network if available.

zone list

Lists zones attached to the local hub.

zone show <name>

Displays details of the given zone.

device list

Lists non-zone devices (eg plugs) attached to the local hub.

device show <name>

Displays details of the given device.

profile list

Lists the saved profiles for the local hub.

profile show <name>

Displays details of the given saved profile.

API

To discover, connect and interact with a hub, create an instance of NeoClient.

Client

Create a new client with no arguments to use the default configuration

const { NeoClient } = require('heatmiser-neohub.js');

const client = new NeoClient();

A non-default configuration can be provided as an argument:

const client = new NeoClient({protocolPort:4246});

Default configuration values are set in .env.

Start monitoring the hub

const client = new NeoClient();
const hub = await client.start();

This will connect to the hub and continue to poll status every 10s.

Stop monitoring the hub

await client.stop();

Hub

To interact with a hub once connection is established, methods may be invoked on the NeoHub instance returned from start().

The NeoHub exposes a range of methods corresponding to the majority of commands supported in the protocol.

NeoHub.updateNetwork() performs a full sync of the client with the Hub, performing a GET_LIVE_DATA command and a sync of zones and other devices, and saved profiles.

Limitations

Testing has been limited to a hub with connected wired zone stats. No real-world testing has taken place for timeclocks/plus or wireless stats.

Group operations are not supported.

Multiple hubs on the same network are not supported.

Contributing

This is a work in progress and contributions, issues and PRs are welcome.