homebridge-ssh icon indicating copy to clipboard operation
homebridge-ssh copied to clipboard

can this be used to turn on/off a ps4?

Open mreassassin opened this issue 6 years ago • 1 comments

I'm having no luck with ps4-waker. hoping to find another option.

thanks in advance!

mreassassin avatar Aug 19 '18 19:08 mreassassin

You can use the cmd4 Homebridge Plugin with the following Configuration for ps4-waker. Maybe this will work 😃 Please update your path to your Credentials-File in the bottom script

Cmd4-Plugin-Accessory

{
  "polling": true,
  "interval": 10,
  "state_cmd": "bash /var/lib/homebridge/ps4/State.sh",
  "name": "PS4",
  "timeout": 3000,
  "type": "Switch"
}

Script on given start_cmd-Path you can choose

#!/bin/bash
#echo $1 $2 $3 $4
if [ "$1" = "Get" ]; then
   # $2 would be the name 'PS4'
   # $3 would be the charactersistic 'On'
   state=$(ps4-waker search -t 2000 | grep -c '200 Ok')
   echo "$state"
   exit 0
fi

if [ "$1" = "Set" ]; then
   # $2 would be the name 'PS4'
   # $3 would be the the charactersistic 'On'
   # $4 would be '0' for 'Off', '1' for 'On'

   if [ $4 = true ]; then
      ps4-waker -c /root/.homebridge/ps4/cred-ps4
      exit $?
   elif [ $4 = false ]; then
      ps4-waker -c /root/.homebridge/ps4/cred-ps4 standby
      exit $?
   fi
fi

exit -1

MrDrache333 avatar May 03 '20 14:05 MrDrache333