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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vitrea-client

v0.0.8

Published

Vitrea Smart Home API Client

Downloads

33

Readme

Vitrea Client

Vitrea Smart Home API Client


Requirements

NodeJS version "^18.17.0 || >=20.5.0" is required to install this package.

Installation

npm install vitrea-client

Configurations

The section below outlines the different configuration values available and their corresponding default settings.

| Config | Description | Default | | ------------------------------- | --------------------------------------------------------- | -------------------- | | VBoxConfigs.host | Host address to connect to the vBox | 192.168.1.23 | | VBoxConfigs.port | Port used to connect to the vBox | 11501 | | VBoxConfigs.username | Username used to connect to the vBox | null | | VBoxConfigs.password | Password used to connect to the vBox | null | | VBoxConfigs.version | Protocol version of vBox | ProtocolVersion.V2 | | SocketConfigs.log | Logger to print values | null | | SocketConfigs.ignoreAckLogs | Ignore Acknowledgement and GenericUnusedResponse logs | false | | SocketConfigs.requestBuffer | Buffer time between requests | 250 | | SocketConfigs.requestTimeout | Max timeout for requests | 1000 | | SocketConfigs.shouldReconnect | Automatically reconnect on lost connection | true | | SocketConfigs.socketSupplier | Provide a prebuilt Net.Socket object | null |

Environment Variables

If you prefer not to provide the configuration values directly, you can use environment variables instead.

All VBoxConfigs configuration values can be represented as environment variables by converting the config key to uppercase and prefixing it with VITREA_VBOX_. For instance, the key username would be represented as VITREA_VBOX_USERNAME and requestTimeout as VITREA_VBOX_REQUEST_TIMEOUT.

Usage

import {
    ProtocolVersion,
    Requests,
    VitreaClient
} from 'vitrea-client'


const client = VitreaClient.create({
    host:     '192.168.1.111',
    port:     1234,
    username: 'admin',
    password: 'secret',
    version:  ProtocolVersion.V1
})

await client.connect()

const count = await client.send(new Requests.RoomCount())

Logging

By default, all logs are sent to the NullLogger, which discards them. To log messages, you can use our ConsoleLogger (which wraps the native console object), set below:

import { ConsoleLogger, VitreaClient } from 'vitrea-client'

const client = VitreaClient.create(
    { /* ... */ },
    {
        log: new ConsoleLogger()
    }
)

If you already have a logger that implements the interface below, you can integrate it as follows:

import { getLogger }    from '@/core/logger'
import { VitreaClient } from 'vitrea-client'

const client = VitreaClient.create(
    { /* ... */ },
    {
        log: getLogger('vBox')
    }
)
interface LoggerContract<T = any, R = void> {
    log(message: string, level: string): R
    error(message: string, ...args: T[]): R
    warn(message: string, ...args: T[]): R
    info(message: string, ...args: T[]): R
    debug(message: string, ...args: T[]): R
}

Status Updates

Vitrea's vBox sends updates to the client whenever a key is pressed. You can supply a custom callback listener to manage these updates as they happen.

import { VitreaClient, Responses } from 'vitrea-client'

const client = VitreaClient.create(...)

const listener = (status: Responses.KeyStatus) => {
    console.log(status.nodeID)
    console.log(status.keyID)
    console.log(status.isOff)
    console.log(status.isOn)
}

client.onKeyStatus(listener)