0.3.0 • Published 5 years ago

homebridge-commander v0.3.0

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

homebridge-commander npm version

CLI plug-in for HomeBridge

By default homebridge-commander will execute the command listed in config.json with default arguments. The default arguments are the name of the command (given name from config.json), the type of command (powerstate, brightness, etc.) the action (get or set), and the value (only with set command).

See ExampleScript.sh in the example directory. This script can be used for all commands configurated. It is possible to have a seperate script for each command.

Command call:

 cmd command_name command_type action value
 
 example: 
 ExampleScript.sh SwitchName powerstate set true

The arguments can be turned off by setting the no_arg value to true

Supported types (More will be added soon)

  • Switch
  • Lightbulb
  • Outlet
  • Speaker
  • Window Cover
  • Temperature Sensor
  • Humidity Sensor

Config.json settings

Platform config settings. See config.json in the example directory.

"platforms": [
         {
            "platform": "commander",
            "name": "PlatformName",
            "commands": [{
                "name" : "command_name",
                "type" : one of the following:
                         "switch"
                         "lightbulb"
                         "outlet"
                         "speaker"
                "cmd" : "path to command or command"
                "no_arg" : false
                "updaterate" : 5000
                }]
         }]
SettingDescriptionRequired
"platform"Should be set to "commander"yes
"name"Platform name changeable for useryes
"commandsList of commandsyes
"name"User given name of the commandyes
"type"Which type the command needs to appear in HomeKityes
"cmd"Executed command (can be bash script)yes
"no_arg"Let the plugin execute the command without arguments. Default false when not listedno
"updaterate"Update rate to get status in miliseconds (default 5000)no

Switch

Switch has no additional settings.

Switch has the following command_types config:

command_typesgetsetdescription
powerstateXXtrue for on

Example of a switch command:

"commands": [{
    "name": "SwitchName",
    "type": "switch",
    "cmd" : "~/ExampleScript.sh"
    }

Lightbulb

Set the listed settings to true to have them active in Homekit

Lightbulb supports hue and saturation or colortemperture. When hue or saturation is set to true colortemperature will be disabled.

Use the Hue and Saturation for color settings and Color Temperature for ambient settings.

"brightness" : true,
"hue" : true,
"saturation" : true,

or

"brightness" : true,
"colortemperature" : true,

Lightbulb has the following command_types :

command_typesgetsetdescription
powerstateXXtrue for on
brightnessXXbrightness in 0-100%
hueXXhue in 0-360 arcdegrees
saturationXXsaturation in 0-100%
colortemperatureXXcolor temperature 50-400 MK

Example of a lightbulb command config (without Color Temperature):

"commands": [{
    "name": "LightBulbName",
    "type": "lightbulb",
    "cmd" : "~/ExampleScript.sh"
    "brightness" : true,
    "hue" : true,
    "saturation" : true,
    }

Outlet

Outlet has no additional settings.

Outlet has the following command_types :

command_typesgetsetdescription
powerstateXXtrue for on
outletinuseX-true for in use

Example of a switch command config:

"commands": [{
    "name": "OutletName",
    "type": "outlet",
    "cmd" : "~/ExampleScript.sh"
    }

Speaker

Set the listed settings to true to have them active in Homekit

"volume" : true,

Speaker has the following command_types :

command_typesgetsetdescription
muteXXtrue for mute
volumeXXvolume in 0-100

Example of a speaker command config:

"commands": [{
    "name": "SpeakerName",
    "type": "speaker",
    "cmd" : "~/ExampleScript.sh"
    "volume" : true,
    }

Window Cover

Set the listed settings to true to have them active in Homekit

"holdposition" : true,
"targethorizontaltiltangle" : true,
"targetverticaltiltangle" : true,
"currenthorizontaltiltangle" : true,
"currentverticaltiltangle" : true,
"obstructiondetected" : true

Window Cover has the following command_types :

command_typesgetsetdescription
currentpositionX-position in 0-100%
targetpositionXXposition in 0-100%
positionstateX-0 = to min, 1 = to max, 2 = stopped
holdposition-Xtrue to hold
targethorizontaltiltangleXXangle in -90-90 arcdegrees
targetverticaltiltangleXXangle in -90-90 arcdegrees
currenthorizontaltiltangleX-angle in -90-90 arcdegrees
currentverticaltiltangleX-angle in -90-90 arcdegrees
obstructiondetectedX-true on detection

Example of a window cover command config:

"commands": [{
    "name": "WindowCoveringName",
    "type": "windowcovering",
    "cmd" : "~/ExampleScript.sh",
    "holdposition" : true,
    "targethorizontaltiltangle" : true,
    "targetverticaltiltangle" : true,
    "currenthorizontaltiltangle" : true,
    "currentverticaltiltangle" : true,
    "obstructiondetected" : true
    }

Temperature Sensor

Set the listed settings to true to have them active in Homekit

"statusactive" : true,
"statusfault" : true,
"statuslowbattery" : true,
"statustampered" : true

Temperature sensor has the following command_types :

command_typesgetsetdescription
currenttemperatureX-temperature in 0-100 in degrees Celsius
statusactiveX-true for active
statusfaultX-0 = no fault, 1 = general fault
statuslowbatteryX-0 = normal, 1 = low battery
statustamperedX-0 = not tampered, 1 = tampered

Example of a temperature sensor command config:

"commands": [{
    "name": "TemperatureSensor",
    "type": "temperaturesensor",
    "cmd" : "~/ExampleScript.sh",
    "statusactive" : true,
    "statusfault" : true,
    "statuslowbattery" : true,
    "statustampered" : true,
    }

Humidity Sensor

Set the listed settings to true to have them active in Homekit

"statusactive" : true,
"statusfault" : true,
"statuslowbattery" : true,
"statustampered" : true

Humidity sensor has the following command_types :

command_typesgetsetdescription
currentrelativehumidityX-current relative humidity in 0-100%
statusactiveX-true for active
statusfaultX-0 = no fault, 1 = general fault
statuslowbatteryX-0 = normal, 1 = low battery
statustamperedX-0 = not tampered, 1 = tampered

Example of a humidity sensor command config:

"commands": [{
    "name": "HumiditySensor",
    "type": "humiditysensor",
    "cmd" : "~/ExampleScript.sh",
    "statusactive" : true,
    "statusfault" : true,
    "statuslowbattery" : true,
    "statustampered" : true,
    }

Custom Service

Adding the option "custom" to a command extra settings can be added. Only settings which are not already standard for the selected type can be added. The used arguments etc. are based on the arguments where this extra setting is supported.

With the custom option, services could be created which are not supported by HomeKit!

See the config.json and Examplescript for a starting point to add custom options.

Example where a standard speaker has a powerstate setting:

"commands": [{
    "name": "SpeakerCustomName",
    "type": "speaker",
    "custom": true,
    "volume": true,
    "powerstate": true,
    "cmd" : "~/ExampleScript.sh"
    }
0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago