Skip to content

Using cmdswitch2 for configuring pyswitcherv2 to work with homebridge (thanks to neta540)

sagilo edited this page Dec 9, 2018 · 1 revision

To configure homebridge with pyswitcherv2, assuming it is installed in /opt/pyswitcherv2, you will need to:

Install homebridge-cmdswitch2 node module. Add cmdswitch2 platform into homebridge config.json, with corresponding switcherv2 configuration. Restart homebridge.

sudo npm install -g homebridge-cmdswitch2

Configure config.json

{
  "platform": "cmdSwitch2",
  "name": "CMD Switch 2",
  "switches": [
    {
      "name": "Switcher v2",
      "on_cmd": "python /opt/pyswitcherv2/pyswitcherv2/switcher.py -m on",
      "off_cmd": "python /opt/pyswitcherv2/pyswitcherv2/switcher.py -m off",
      "state_cmd": "python /opt/pyswitcherv2/pyswitcherv2/switcher.py -m get_state | grep -i 'Device is: on'"
    }
  ]
}