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

@smartheit/openhab-tools

v0.0.2

Published

Tools for JavaScript Scripting by smartheit

Readme

openHAB JavaScript Tools by smartheit

This library provides utilities for the openHAB JavaScript Scripting Add-on, being used for projects at smartheit GmbH.

Compatibility

  • This library is developed for the openHAB 4.3.x series.
  • It depends on openhab == 5.9.0, requiring manual installation on the openHAB 4.3.x series. Run npm i [email protected] inside $OPENHAB_CONF/automation/js to install it.
  • Parts of the library require additional code that can't be shipped with the library, but this will be clearly noted below.

Additional Dependencies

  • The setLedColor method of the revpi namespace requires:
    • the revpi_leds.sh script to be placed in $OPENHAB_CONF/script.
    • write-access to /sys/devices/platform/leds/leds/*/brightness for the user running openHAB (usually that will be smartheit). This can be achieved through an udev rule. Create a file /etc/udev/rules.d/99-leds.rules with the following content:
      SUBSYSTEM=="leds", KERNEL=="*", ATTR{brightness}=="*", MODE="0644", RUN+="/bin/chown root:smartheit /sys/class/leds/%k/brightness", RUN+="/bin/chmod 0664 /sys/class/leds/%k/brightness"

Development

Dev Environment

You need Node.js, version as stated in .nvmrc, and npm installed. It is required to use this version as well in your development environment, otherwise you could cause trouble.

Maintainers therefore recommend to use a Node.js version manager, e.g. nvm-sh/nvm. After you've installed it, run nvm use to use the correct Node.js version.

openhab-js has several (development) dependencies which are required.

Run npm install to install those dependencies.

Code Style

js-semistandard-style

eslint is being used with the JavaScript semistandard style and some overrides for code linting and formatting.

Run the linter with:

npm run lint

Automatically fix issues with:

npm run lint:fix

TypeScript

Although TypeScript is not used for writing the source code, it is still used for emitting declarations and thereby enabling great IntelliSense when using the library.

Generate the types with:

npm run types

Test the generated definitions for problems:

npm run types:test

Testing

Jest is being used for unit tests, which are placed in the test folder and have the extension .spec.js. Have a look at the Jest Documentation and the existing tests to get an idea how Jest works.

Development TL:DR;

To run the linter, generate & test type definitions, run unit tests, generate JSDoc and build the bundled file, run:

npm run build

Deployment

To deploy this library to the $OPENHAB_CONF/etc/automation/js/node_modules folder of the openHAB server, you have two options.

Deploy as Tarball

Pack the library as tarball:

npm pack

Copy the tarball to the $OPENHAB_CONF/etc/automation/js folder and run npm install smartheit-openhab-tools-x.y.z.tgz.

Deploy as Bundle

Copy the openhab-tools.js file from the dist/@smartheit folder into $OPENHAB_CONF/etc/automation/js/node_modules/@smartheit.