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

@vectronic/homebridge-script-switch

v0.2.1

Published

A switch plugin for Homebridge which integrates with shell scripts

Readme

homebridge-script-switch

A switch plugin for Homebridge which integrates with shell scripts

Installation

  1. Install this plugin using the Homebridge Config UI X or via commandline npm install -g @vectronic/homebridge-script-switch
  2. Setup the plugin's configuration

Configuration

| Property | Description | |---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| | name | The name for the accessory instance. | | set_state_on_script | Script to set state ON, optional. If not provided, setting switch On from Home App is not possible. | | set_state_off_script | Script to set state OFF, optional. If not provided, setting switch Off from Home App is not possible. | | get_state_script | Script to get the current switch state. Should output on stdout text signifying "On" which matches on_state_value and anything else ot signify "Off". | | on_state_value | Return value from get_state_script which corresponds to ON state. |

Example config.json entry:

"accessories": [
    {
        "accessory": "ScriptSwitch",
        "name": "mySwitch",
        "set_state_on_script": "/usr/local/bin/setMySwitchOn.sh",
        "set_state_off_script": "/usr/local/bin/setMySwitchOff.sh",
        "get_state_script": "/usr/local/bin/getMySwitchState.sh",
        "on_state_value": "ON"
    }
]

Examples

Switch that stays ON until a task completes

A common use case is to trigger a long-running task and have the switch remain ON for the duration, automatically switching OFF once the task finishes.

The key mechanism is that set_state_on_script blocks until the shell command exits. While the command is running the switch appears ON in the Home app. Once the command exits, Homebridge refreshes the switch state by calling get_state_script; if that returns something other than on_state_value, the switch will be shown as OFF.

"accessories": [
    {
        "accessory": "ScriptSwitch",
        "name": "Run Backup",
        "set_state_on_script": "/usr/local/bin/backup.sh",
        "set_state_off_script": "echo 'OFF'",
        "get_state_script": "echo 'OFF'",
        "on_state_value": "ON"
    }
]

How it works:

  • Turning the switch ON triggers set_state_on_script, which runs backup.sh and blocks until it finishes. The switch appears ON in the Home app for the entire duration.
  • Once backup.sh exits, Homebridge calls get_state_script to refresh the state. Because get_state_script outputs OFF (which does not match on_state_value), the switch automatically returns to OFF.
  • set_state_off_script allows the switch to be turned OFF manually if needed before the task has finished.

Help

If you have a query or problem, raise an issue in GitHub, or better yet submit a PR!