A Homebridge plugin that allows you to create momentary switches executing custom command line commands with configurable delays.
- Executes a command line command when the switch is triggered.
- Stateless: the switch automatically reverts to its original "off" state, mimicking button behavior.
- Configurable delays before command execution and switch reset.
- Easy configuration via Homebridge UI.
sudo npm install -g homebridge-dummy-cmd-switchThe plugin can be configured via the Homebridge UI or by editing the config.json file directly.
Switch can be used to reboot Homebridge as one of the use cases:
{
"accessories": [
{
"accessory": "DummyCmdSwitch",
"name": "Server Reboot Switch",
"commandOn": "pkill -15 homebridge",
"delayOn": 1000,
"delayOff": 4000
}
]
}accessory(string): Must be set to"DummyCmdSwitch".name(string): The name of the switch accessory.commandOn(string): The shell command to execute when the switch is turned on.delayOn(number, optional): Delay in milliseconds before executing thecommandOnafter the switch is turned on. Default is1000ms.delayOff(number, optional): Delay in milliseconds before resetting the switch to off after executing thecommandOn. Default is1000ms.
When the switch is turned on:
- The plugin waits for the specified
delayOnperiod. - Executes the
commandOnshell command. - Waits for the specified
delayOffperiod. - Resets the switch to the "off" state.
This sequence allows for precise control over the timing of command execution and switch reset.
Contributions are welcome! Please fork the repository and submit a pull request with your improvements or bug fixes.