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

@uboness/homebridge-virtual

v0.2.1

Published

Homebridge Virtual Plugin

Downloads

12

Readme

Homebridge Virtual Plugin

Enables defining virtual accessories/devices.

!! Experimental !!

Settings

Light Switch Button Garage Door Lock Outlet Smoke Sensor Contact Sensor Motion Sensor Leak Sensor CO Sensor CO2 Sensor

Light

A virtual light.

| Parameters | type | required | Description | |------------|---------------------|----------|:----------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | light | required | Must be set to light | | name | string | optional | Will determine the name of the device | | dimmer | boolean | optional | Determines whether this light can be dimmed | | variant | rgb or warm-cold | optional | Determines the type of light. An RGB light or a light with varying color temperatures |

Example:

{
  "id": "test",
  "name": "Test Light",
  "type": "light",
  "dimmer": true,
  "variant": "rgb"
}

Switch

A virtual switch. Can be configured to auto-close after a specific timeout.

| Parameters | type | required | Description | |----------------|----------|----------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | switch | required | Must be set to switch | | name | string | optional | Will determine the name of the device | | turnOffAfter | number | optional | When set, the switch will automatically turn off after this number of seconds |

Example:

{
    "id": "switch",
    "name": "Test Switch",
    "type": "switch",
    "turnOffAfter": 5000
}

Button

A virtual button accessory. Next to the main StatelessProgrammableSwitch button. This accessory will also create 3 additional swtiches:

  • singlePress - will trigger a singlePress event for the button
  • doublePress - will trigger a doublePress event for the button
  • longPress - will trigger a longPress event for the button

| Parameters | type | required | Description | |---------------|----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | button | required | Must be set to button | | name | string | optional | Will determine the name of the device | | singlePress | string | optional | Determines the name of the single press switch that will be created. Can be left empty to avoid creating this button | | doublePress | string | optional | Determines the name of the double press switch that will be created. Can be left empty to avoid creating this button | | longPress | string | optional | Determines the name of the long press switch that will be created. Can be left empty to avoid creating this button |

Example:

Here, two momentary switches will be created:

  • Turn On switch that will trigger the single press event of the button
  • Turn Off switch that will trigger the double press event of the button

No switch will be created for the long press event.

{
    "id": "button",
    "type": "button",
    "name": "Test Button",
    "singlePress": "Turn On",
    "doublePress": "Turn Off"
}

Garage Door

A virtual garage door accessory.

| Parameters | type | required | Description | |---------------|--------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | garage-door| required | Must be set to garage-door | | name | string | optional | Will determine the name of the device | | openingTime | number | optional | Simulates the time it takes to open the door (in seconds). Defaults to 10 seconds. | | closingTime | number | optional | Simulates the time it takes to close the door (in seconds). Defaults to openingTime or 10 seconds |

Example:

{
  "id": "garage",
  "name": "Garage",
  "type": "garage-door",
  "openingTime": 10,
  "closingTime": 5
}

Lock

A virtual Lock accessory.

| Parameters | type | required | Description | |----------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | lock | required | Must be set to lock | | name | string | optional | Will determine the name of the device |

Example:

{
    "id": "test-lock",
    "type": "lock",
    "name": "Test Button"
}

Outlet

A virtual outlet accessory.

| Parameters | type | required | Description | |----------------|----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | outlet | required | Must be set to outlet | | name | string | optional | Will determine the name of the device | | turnOffAfter | number | optional | When set, the outlet will automatically turn off after this number of seconds | Example:

{
    "id": "test-outlet",
    "type": "outlet",
    "name": "Test Outlet"
}

Smoke Sensor

A virtual smoke sensor accessory. The sensor will have a switch to control the smoke alert - when the switch is turned on the smoke alert will be triggered.

| Parameters | type | required | Description | |---------------|----------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | smoke-sensor | required | Must be set to smoke-sensor | | name | string | optional | Will determine the name of the device | | hasBattery | boolean | optional | When true a battery alert simulation switch will be added (when turned on, the battery alert of the sensor will be triggered) | | hasFault | boolean | optional | When true a fault status alert simulation switch will be added (when turned on, the fault status alert of the sensor will be triggered) | | hasTampered | boolean | optional | When true a tampered status alert simulation switch will be added (when turned on, the tampered status alert of the sensor will be triggered) |

Example:

{
    "id": "test-smoke-sensor",
    "type": "smoke-sensor",
    "name": "Test Smoke Sensor",
    "hasBattery": true
}

Contact Sensor

A virtual contact sensor accessory. The sensor will have a switch to control the contact alert - when the switch is turned on the contact alert will be triggered.

| Parameters | type | required | Description | |---------------|------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | contact-sensor | required | Must be set to contact-sensor | | name | string | optional | Will determine the name of the device | | hasBattery | boolean | optional | When true a battery alert simulation switch will be added (when turned on, the battery alert of the sensor will be triggered) | | hasFault | boolean | optional | When true a fault status alert simulation switch will be added (when turned on, the fault status alert of the sensor will be triggered) | | hasTampered | boolean | optional | When true a tampered status alert simulation switch will be added (when turned on, the tampered status alert of the sensor will be triggered) |

Example:

{
    "id": "test-contact-sensor",
    "type": "contact-sensor",
    "name": "Test Contact Sensor",
    "hasBattery": true
}

Motion Sensor

A virtual motion sensor accessory. The sensor will have a button to trigger a motion alert - The timeout parameter determines how long the sensor maintains its "detected" state, after which it will reset to "not detected". If a motion is triggered while the sensor is in a "detected" state, the timeout will reset - meaning, the motion state will be set to "not detected" after the timeout has passed since the last motion trigger.

| Parameters | type | required | Description | |-----------------|-----------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | motion-sensor | required | Must be set to motion-sensor | | name | string | optional | Determine the name of the device | | motionTimeout | number | optional | When set, the trigger switch acts as a motion signal button which when pressed will put the sensor in a "detected" state for the duration of the timeout (in seconds).Every press (motion signal) resets any existing timeout. | | asOccupancy | boolean | optional | when true this sensor will show up as an occupancy sensor (default: false) | | hasBattery | boolean | optional | When true a battery alert simulation switch will be added (when turned on, the battery alert of the sensor will be triggered) | | hasFault | boolean | optional | When true a fault status alert simulation switch will be added (when turned on, the fault status alert of the sensor will be triggered) | | hasTampered | boolean | optional | When true a tampered status alert simulation switch will be added (when turned on, the tampered status alert of the sensor will be triggered) |

Example:

{
    "id": "test-motion-sensor",
    "type": "motion-sensor",
    "name": "Test Motion Sensor",
    "timeout": 30,
    "hasBattery": true
}

Leak Sensor

A virtual leak sensor accessory. The sensor will have a switch to control the leak alert - when the switch is turned on the leak alert will be triggered.

| Parameters | type | required | Description | |---------------|---------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | leak-sensor | required | Must be set to leak-sensor | | name | string | optional | Will determine the name of the device | | hasBattery | boolean | optional | When true a battery alert simulation switch will be added (when turned on, the battery alert of the sensor will be triggered) | | hasFault | boolean | optional | When true a fault status alert simulation switch will be added (when turned on, the fault status alert of the sensor will be triggered) | | hasTampered | boolean | optional | When true a tampered status alert simulation switch will be added (when turned on, the tampered status alert of the sensor will be triggered) |

Example:

{
    "id": "test-leak-sensor",
    "type": "leak-sensor",
    "name": "Test Leak Sensor",
    "hasBattery": true
}

CO Sensor

A virtual CO sensor accessory. The sensor will have a switch to control the CO alert - when the switch is turned on the CO alert will be triggered.

| Parameters | type | required | Description | |---------------|-------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | co-sensor | required | Must be set to co-sensor | | name | string | optional | Will determine the name of the device | | hasBattery | boolean | optional | When true a battery alert simulation switch will be added (when turned on, the battery alert of the sensor will be triggered) | | hasFault | boolean | optional | When true a fault status alert simulation switch will be added (when turned on, the fault status alert of the sensor will be triggered) | | hasTampered | boolean | optional | When true a tampered status alert simulation switch will be added (when turned on, the tampered status alert of the sensor will be triggered) |

Example:

{
    "id": "test-co-sensor",
    "type": "co-sensor",
    "name": "Test CO Sensor",
    "hasBattery": true
}

CO2 Sensor

A virtual CO2 sensor accessory. The sensor will have a switch to control the CO2 alert - when the switch is turned on the CO2 alert will be triggered.

| Parameters | type | required | Description | |---------------|--------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | required | Must be unique among all configured devices. Changing the id will remove previously added devices which also means all related automations will be removed | | type | co2-sensor | required | Must be set to co2-sensor | | name | string | optional | Will determine the name of the device | | hasBattery | boolean | optional | When true a battery alert simulation switch will be added (when turned on, the battery alert of the sensor will be triggered) | | hasFault | boolean | optional | When true a fault status alert simulation switch will be added (when turned on, the fault status alert of the sensor will be triggered) | | hasTampered | boolean | optional | When true a tampered status alert simulation switch will be added (when turned on, the tampered status alert of the sensor will be triggered) |

Example:

{
    "id": "test-co2-sensor",
    "type": "co2-sensor",
    "name": "Test CO2 Sensor",
    "hasBattery": true
}

Development

If not installed yet, install Homebridge

sudo npm install -g --unsafe-perm homebridge homebridge-config-ui-x

and

npm link

Build:

pn build

Run homebridge:

homebridge -D -I -U .homebridge