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 🙏

© 2024 – Pkg Stats / Ryan Hefner

homebridge-bluetooth-puck-button

v0.0.1

Published

Homebridge plugin that uses a puck.js to control a stateful switch

Downloads

1

Readme

homebridge-bluetooth-puck-button

This homebridge-plugin emulates a stateful programmable switch since the Home app does not yet support this type of accessory natively. It provides accessories with 2 services, a StatelessProgrammableSwitch and a Switch. The StatelessProgrammableSwitch is used to allow the switch to control Scenes in the Home app. The Switch is used to track the current state of the switch. In order for the switch to stay in sync with Scene activation it should be added as part of the Scene's accessories.

This plugin provides a program that can be uploaded to a puck.js which will turn it into a bluetooth counting button. Each time the button is pressed the count is incremented and is placed in the BLE advertisement. We use the advertisement to relay the state since this is the most power efficient of the options for the puck.js devices. Since the button code is simple it should be pretty easy to make other such devices work with this plugin.

The homebridge plugin will listen for this advertisement and will record the initial count. When the count changes, the homebridge plugin will register this as a request to change the switch state and toggle the state of the Switch. This will be relayed as a single press for "off" and a double press for "on" for the StatelessProgrammableSwitch events.

The plugin can cache the state of the Switch so that it will not be lost when homebridge is restarted. This is done by providing a "statePath" to the configuration.

Installation

npm install -g homebridge-bluetooth-puck-button

Configuration

A sample configuration is provided below.

    "accessories": [
	{
	    "accessory": "Puck Button",
	    "name": "Office Light Switch",
	    "address": "d1:10:1b:xx:xx:xx",
	    "statePath": "/var/lib/homebridge/persist/office-light-switch-state.json"
	}
    ]

TODO

  • Split the switch functionallity from the button press sensing so other button sensing strategies could be used but the stateful switch emulation could be reused. I don't have any need for this at the moment but it shouldn't be too difficult.