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

@vandubois/homebridge-virtual-switch

v1.1.0

Published

Creation of virtual switches, triggered independently and by keywords appearing in the Homebridge log file.

Downloads

114

Readme

Homebridge Virtual Switches

verified-by-homebridge

Homebridge v2.0 Information
This plugin is Homebridge v2.0 ready and requires Node.js v20.14.12 or higher.
For information on how to upgrade Node.js, see this guide.


Homebridge-Virtual Switches is a plugin that creates a variety of virtual switches, specifically those triggered by the appearance of keywords in log files. The plugin monitors any log file (defaults to the Homebridge log file) for specific keywords or key phrases. When a keyword is detected, a virtual switch (normally open or normally closed, stateful or not) is triggered. This can be helpful in advanced HomeKit automations.

Example:
If a plugin loses API authentication, a log message alerts you. This log message can be used as a key phrase to trigger a virtual switch, allowing HomeKit automations to send alerts (e.g., Pushover message, warning light, siren, etc.).

The plugin also provides virtual switches that are not triggered by the Homebridge log file. The use of virtual switches is crucial in developing advanced HomeKit automations.


Additional Requirements

The following packages are needed for the plugin to function properly:

  • strip-ansi
  • child_process

Configuration

The plugin allows setting up switches that are triggered by keywords or key phrases appearing in the default Homebridge log. You can also specify a different log file if needed.

  • Platform Name: Must be HomebridgeVirtualSwitches (cannot be changed).
  • Switch Name: Define a unique name for each switch.
    • Normally Closed Switch: Set the switch type: normally open (default) or normally closed.
    • Stateful: Determines the switch behavior after being triggered:
      • Stateful: The switch state does not change after being triggered.
      • Non-stateful: The switch state returns to its normal state after a timer runs out (default).
    • Auto Off Time: Duration before a non-stateful switch returns to its normal state.
    • Monitor Log File: Check this option to trigger the switch by keywords in the log file.
    • Log File Path: Enter the full path to the log file to monitor (multiple switches can monitor different files). The file must be in ASCII format. The default is the Homebridge log file location.
    • Keywords: Enter one keyword or key phrase as it appears in the log file. Keywords and log lines are compared in lowercase and stripped of any ANSI code.
    • Enable Startup Delay: Delay switch activation after Homebridge starts to prevent premature triggers.
    • Startup Delay: Time between Homebridge startup and switch activation.
    • Restart in Last Known State: If enabled, the switch will start in its last known state before Homebridge shut down. This only works for stateful switches not controlled by log file keywords.

Multiple switches can be set up, each with its own configuration.


Operation of Switches Controlled by Log File Keywords

Switches can be stateful or not. If set, the occurrence of one or more keywords/phrases triggers the corresponding switch.

  • Stateful Switches: Once triggered, reoccurrence of the keyword/phrase will not change the switch state until it is manually reset.
  • Non-stateful Switches: The switch will not be retriggered until the timer has expired.

Note: Repeated triggering of a non-stateful switch will not extend nor reset the timer.


Found a Bug?

If you think you've found a bug, please first check the requirements and read through the open issues. If you're confident it's a new bug, create a new GitHub issue with as much information as possible. Please be patient as we review your report.