Skip to content

A homebridge switch which changes state only if the shell command is successful.

License

Notifications You must be signed in to change notification settings

drheck/homebridge-shell-switch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

homebridge-shell-switch

A homebridge switch which changes state only if the shell command is successful. Shows pending state while command is being run.

But why?

Suppose you to run a bash script on your homebridge host system, but it isn't guaranteed to work. You want to retry that command in a little while until it works.

  • This switch won't change state until the script returns a successful exit code (zero).
  • If anything else happens, the switch will remain in its previous state.
  • We'll show the "pending" switch state while the command is running.

The switch will maintain state between homebridge reboots, using node-persist.

Many thanks to hans-1 for providing a lovely base for this plugin to grow on.

Installation

Example config.json:

    "accessories": [
        {
            "accessory": "ShellSwitch",
            "name": "TV Power",
            "onCmd": "/home/homebridge/control/tv_on.sh",
            "offCmd": "/home/homebridge/control/tv_off.sh"
        }
    ]

About

A homebridge switch which changes state only if the shell command is successful.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%