luisiam / homebridge-cmdswitch2

CMD Plugin for HomeBridge (API 2.0): https://github.com/nfarina/homebridge
Apache License 2.0
176 stars 29 forks source link

Feature request: Display arbitrary info #43

Open RobotLimeLtd opened 6 years ago

RobotLimeLtd commented 6 years ago

It would be great if we could display something other that just "Powered On" or "Powered Off" when 3D-pressing the switch, using a shell command. For example, when controlling a PS4, it could show the currently running game, e.g.

{
  "name": "PS4 Pro",
  "manufacturer": "Sony Corporation",
  "on_cmd": "ps4-waker",
  "off_cmd": "ps4-waker standby",
  "state_cmd": "ps4-waker search | grep -i '200 Ok'"
  "info_cmd": "ps4-waker search | grep  'running-app-name' | cut -d':' -f2 | sed -e 's/\"//g;s/,//g'"
},
randyinla commented 4 years ago

Given the plugin only checks for the state of something being true or not via the state_cmd, you could create a separate switch for each game you play, then grep the app name so it appears as "on" (running) or not. Not the best solution, but is "a" solution for now.