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 🙏

© 2026 – Pkg Stats / Ryan Hefner

grenton-ts

v1.1.5

Published

TypeScript API library providing type-safe wrappers for Grenton smart home hardware modules

Readme

grenton-ts

Biblioteka API w TypeScript dla modułów sprzętowych inteligentnego domu Grenton. Dostarcza typowane wrappery dla niskopoziomowych interfejsów sprzętowych Grenton, ułatwiając interakcję z urządzeniami Grenton w projektach TypeScript.

Przegląd

Urządzenia Grenton udostępniają surowe API oparte na Lua. Ta biblioteka opakowuje te surowe interfejsy typowanymi klasami TypeScript, dając:

  • Typowane właściwości z getterami/setterami
  • Typowane zdarzenia z rejestracją callbacków
  • Typowane metody do wykonywania komend urządzeń
  • Warianty zdalne (Remote) do komunikacji między bramami (CLU-to-CLU)

Każdy katalog modułu sprzętowego zawiera podkatalogi oznaczone wersją firmware (np. fv03_02), dzięki czemu wiele wersji firmware tego samego modułu może współistnieć.

Architektura

Każdy moduł podąża za tym samym trójwarstwowym wzorcem:

1. Interfejs surowy (*Raw)

declare class odzwierciedlająca niskopoziomowe API sprzętowe:

declare class RollerShutterRaw {
    add_event(event: EventType, callback: () => void): void;
    get(property: PropertyType): any;
    set(property: PropertyType, value: any): void;
    execute(method: MethodType, ...args: any[]): any;
}

2. Klasa wrappera

Klasa wysokopoziomowa, która przyjmuje surowy interfejs w konstruktorze i udostępnia typowane metody, właściwości oraz rejestrację zdarzeń:

import { RollerShutter, RollerShutterRaw } from './roller-shutter-din-3/fv03_02/roller-shutter';

const shutter = new RollerShutter(rawRollerShutter);

// Zdarzenia
shutter.addOnPositionChange(() => {
    logInfo('Pozycja:', shutter.position);
});

// Metody
shutter.moveUp(5000);     // ruch w górę przez 5 sekund
shutter.setPosition(50);  // ustawienie na 50% otwarcia

// Właściwości
logInfo(shutter.state);    // wartość enuma StateType
logInfo(shutter.position); // liczba (0–100)
shutter.maxTime = 30000;       // właściwość do odczytu i zapisu

3. Wariant zdalny (*Remote)

Do sterowania urządzeniami znajdującymi się na innym CLU za pomocą RemoteGate. Wykorzystuje rawExecutionBuilderFactory do budowania ciągów komend wysyłanych przez bramę. Zdarzenia zdalne nie są obsługiwane.

import { RollerShutterRemote } from './roller-shutter-din-3/fv03_02/roller-shutter';
import { RemoteGate } from './core/remote-gate';

const gate = new RemoteGate(rawRemoteGate);
const shutter = new RollerShutterRemote('ROLLER_SHUTTER_1', gate);

shutter.moveUp(5000);
shutter.setPosition(75);

Pierwsze kroki

Jeśli chcesz rozpocząć własny projekt Grenton w TypeScript, zacznij od repozytorium szablonu:

git clone https://github.com/rpaczkow/grenton-ts-template

Ten szablon jest już skonfigurowany tak, aby odwoływać się do opublikowanego pakietu zbudowanego z tego repozytorium:

  • https://github.com/rpaczkow/grenton-ts

Budowanie

npm run build   # kompilacja TypeScript → dist/
npm run watch   # tryb watch

Wymaga Node.js z TypeScript 5.x (devDependency). Skompilowany kod trafia do dist/.

Licencja

MIT