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

homebridge-dummy-switch-flag

v1.0.0

Published

Dummy switch for use as 'flags'. Flags can be used as conditions in HomeKit automations.

Readme

Homebridge Dummy Switch Flags

Switches that basically do nothing, but can be used in automations.

Example

You have presence sensor and a physical wireless button.

You want to turn off the lights WHEN someone presses the button AND everybody leaves the room.

There is no way to do it in vanilla HomeKit. BUT you can make a workaround like this:

Prerequisites

Suppose you have a switch that does nothing. It will be our dummy switch. We will use this just to "remember" that someone pressed the button.

Automation no 1: Button press

When someone presses the button, you turn dummy switch ON.

Automation no 2: Presence sensor

When there is no presence (everyone left the room), you run a Shortcut.

In this shortcut you add an IF: check if dummy switch is ON. If it's ON, then you turn off the light.

Then you turn dummy switch OFF to reset it.

Why is this IF needed?

If there was no dummy switch then the light would always turn off when the room is empty. Which is not what we wanted.

The button basically acts as an automation activator. But because HomeKit does not support enabling/disabling automations, the dummy switch acts as a hack for that.

Configuration

To configure the switch, you can use Homebridge UI or JSON. The JSON looks like this:

{
    "platforms": [
        {
            "switches": [
                {
                    "name": "ready_for_sleep",
                    "type": "simple"
                },
                {
                    "name": "turn_off_lights",
                    "type": "auto_reset",
                    "auto_reset": {
                        "delay": 10000,
                        "target_state": true
                    }
                },
                {
                    "name": "clicker",
                    "type": "button",
                    "with_counter": true,
                    "counter_trigger": 20
                }
            ],
            "platform": "DummySwitchFlagHomebridgePlugin"
        }
    ]
}

The property platform **needs to be set to "DummySwitchFlagHomebridgePlugin"!

Remember that names need to be unique.

You can configure as many switches as you want. There are three types of switches:

Simple switch

{
    "name": "your_name_here",
    "type": "simple"
}

This switch just exists. When you turn it on, it stays on. When you turn it off, it stays off.

Timed switch (auto-reset)

{
    "name": "your_name_here_2",
    "type": "auto_reset",
    "auto_reset": {
        "delay": 10000,
        "target_state": false
    }
}

This switch automatically "resets" after given delay.

For example, when you turn the above switch on, it will turn itself off after 10000ms (10 seconds).

If you set target_state to true, then it will work in an opposite way. That is, if you turn if OFF then it will turn itself ON after 10s.

Button

{
    "name": "your_name_here_3",
    "type": "button"
}

This switch does not want to stay ON. It will turn itself OFF immediately.

Counting activations

The plugin also lets you count dummy switch activations and make automation based on that.

When you add the following property to a button, it will start counting switch activations (ON):

  "with_counter": true,
  "counter_trigger": 20

count_trigger is a property that will trigger an event after you activate the button a number of times.

In the above example, the event will be triggered when you turn the switch ON 20 times.

What do I mean by an event?

"with_counter": true adds another dummy switch that will turn ON when the condition is met.

That is, you get another dummy button that turns ON automatically when you reach given activation count.