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

@digital-alchemy/hass

v25.11.27

Published

Typescript APIs for Home Assistant. Includes rest & websocket bindings

Readme

codecov version stars


Digital Alchemy Digital Alchemy

Install

Add as a dependency, and add to your imports. Nice and easy

yarn add @digital-alchemy/hass
yarn add -D @digital-alchemy/type-writer

Introduction

@digital-alchemy/hass builds off the Digital Alchemy core framework to introduce API bindings for Home Assistant, exposing functionality for event subscriptions, websocket & rest api interactions, and more!

The library is able to be customized with the type-writer script in order to customize the editor experience for your individual Home Assistant instance. All services with their parameter inputs are available to call, as well as tools to create long term type safe entity references.

Configuration

Connection Details

If you are running the code within a Home Assistant addon (ex: Code Server or Code Runner), the library will automatically configure from environment variables.

All other environments should define credentials in a .env file or provide them via environment variables -

HASS_BASE_URL=http://localhost:8123
HASS_TOKEN=<long lived access token>

Customizing Types

The type-writer script utilizes hass under the hood, and will load configuration from the same sources. In order to run the script, execute this command from repository root

npx type-writer

This will create / update the src/hass folder inside your project with the latest type definitions for your project. These have NO EFFECT on the way your app performs at runtime, and can be updated as frequently as you like.

Usage

Load

Once credentials are set and you have your type definitions generated, you can add the library to your existing project

import { LIB_HASS } from "@digital-alchemy/hass";

// application
const MY_APP = CreateApplication({
  libraries: [LIB_HASS],
  name: "home_automation",
});

// library
export const MY_LIBRARY = CreateLibrary({
  depends: [LIB_HASS],
  name: "special_logic",
});

Build logic

The hass property will be available via TServiceParams in your code

import { TServiceParams } from "@digital-alchemy/core";

// now available here            vvvv
export function ExampleService({ hass, logger }: TServiceParams) {
  const mySwitch = hass.refBy.id("switch.my_switch");

  // utilize event patterns to trigger logic
  hass.refBy.id("binary_sensor.recent_activity_detected").onUpdate((new_state, old_state) => {

    // quickly make logic tests
    if (new_state.state === "on" && mySwitch.state === "off") {

      // execute service calls via entities
      mySwitch.turn_on();

    } else {
      // get type safe access to the full list of services available on your instance
      hass.call.switch.turn_off({ area: "living_room" });

    }
  });
}

Questions / Issues?

discord