@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 thesingle press
event of the buttonTurn Off
switch that will trigger thedouble 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