After days of trying to get my PS4 to wake or sleep from my Home app via Homebridge, I finally made it happen! To some it may have been a simple process but for others, like myself, it was definitely a challenge. Sometimes it was a minor config.json issue or sometimes it was a plugin pegging my CPU at 100%. Whatever it was, it surely did not get solved by a simple Google search or in one day for that matter. Alright, enough of my chatter, let's get to it.

1) Install ps4-waker:

sudo -E -n npm i ps4-waker -g

After installation completes, start ps4-waker by running the following command:

ps4-waker

Follow the steps displayed on-screen (as shown in the screenshot below)

Ensure you can sleep and wake your PS4 via the ps4-waker CLI

2) Install homebridge-ps4-waker-platform:

sudo -E -n npm i ps4-waker -g homebridge-ps4-waker-platform 
I personally did not install this through CLI, I installed it through the Homebridge Web UI. Search for 'ps4' under Plugins and install homebridge-ps4-waker-platform

3) Edit your config.json and add the following code. Make sure you replace the serial and model.

{
    "platform": "PS4WakerPlatform",
    "name": "PS4Waker",
    "accessories": [
      {
            "serial": "XXXXXXXXXXX",
            "model": "FOH-420BZ"
        }
    ]
}

That's it! It should work now. No need for CmdSwitch2, which was the culprit behind my CPU pegging at 100%.

If you already have Homebridge added to the Home app then you should be able to see your PS4 as an accessory. If not, scan that code, add it, and get ready to hear the Playstation boot chime.


Extras:

How to turn off TV with PlayStation + Apple TV:

When you have PlayStation's HDMI Device Link enabled (Settings > System> HDMI Device Link) with a TV that supports HDMI-CEC, life gets a bit easier. You are able to turn on your PS4, turn on your TV, and switch to the input of your PS4 all by just turning on the PS4 itself. Unfortunately, I was not able to do the opposite with success. When I turn off the PS4, only it turns off but my TV remains on.

Solutions:
1) Apple Shortcuts App
If you have an Apple TV and a TV w/HDMI CEC then you can technically turn off the TV along with your PS4. You can accomplish this with the Shortcuts app. Here is the shortcut I am using, go ahead and add it to try it out. In the shortcut I start by controlling a Home device, then I make Siri forcefully tell me the console is off because sometimes the PS4 takes long to boot up and then Siri says the device is not responding.

2) Just turn off your TV. Your PS4 might not be able to turn your TV off but your TV sure can turn off the PS4! Strange but yes, it works one way but not the other. Wish their was more granular control over HDMI-CEC.