dhleong / playactor

play around with your playstation devices
146 stars 12 forks source link

[Question][Idea] HomeBridge Platform? #15

Closed SSutherland94 closed 3 years ago

SSutherland94 commented 3 years ago

I know this is still a work-in-progress and all, but I was wondering if you had considered creating a native HomeBridge Platform for this tool once complete. I'd love to be able to power on/off my incoming PS5 via HomeKit/Siri one of these days like I currently do for my PS4!

dhleong commented 3 years ago

Hey @SSutherland94 it's a great idea but I don't use HomeBridge myself, so I don't think it would be a good idea for me to try to maintain it. At some point when I've gotten a PS5 and tested that nothing here explodes I'll publish it on NPM, though, and anyone will be free to build the HomeBridge plugin based on it!

NikDevx commented 3 years ago

For homebridge integration you can use homebridge-cmdswitch2

        {
            "name": "homebridge-cmdswitch2",
            "switches": [
                {
                    "name": "PlayStation 5",
                    "on_cmd": "playactor wake",
                    "off_cmd": "playactor standby",
                    "state_cmd": "playactor check | grep -i '200 Ok'",
                    "polling": true,
                    "interval": 900,
                    "timeout": 2000,
                    "manufacturer": "Sony",
                    "model": "PS5"
                }
            ],
            "platform": "cmdSwitch2"
        },
NikDevx commented 3 years ago

For homebridge integration you can use homebridge-cmdswitch2

        {
            "name": "homebridge-cmdswitch2",
            "switches": [
                {
                    "name": "PlayStation 5",
                    "on_cmd": "playactor wake",
                    "off_cmd": "playactor standby",
                    "state_cmd": "playactor check | grep -i '200 Ok'",
                    "polling": true,
                    "interval": 900,
                    "timeout": 2000,
                    "manufacturer": "Sony",
                    "model": "PS5"
                }
            ],
            "platform": "cmdSwitch2"
        },

@dhleong can you pin this one?

SSutherland94 commented 3 years ago

That's awesome, thanks! I'm gonna try this out tonight

SSutherland94 commented 3 years ago

Worked like a charm! Thanks for the interesting collab and creative use of a very old plugin!

NikDevx commented 3 years ago

Worked like a charm! Thanks for the interesting collab and creative use of a very old plugin!

You are welcome! :)

mreassassin commented 3 years ago

this didn't work for me. it looks like my playactor is looking for my ps4 rather than my ps5. how do i get it to look for me ps5?

NikDevx commented 3 years ago

this didn't work for me. it looks like my playactor is looking for my ps4 rather than my ps5. how do i get it to look for me ps5?

This is the topic for homebridge integration, not other questions. You need to open a new issue and ask!

And read this one https://github.com/dhleong/playactor/issues/25#issuecomment-820190888

LordZork commented 3 years ago

@mreassassin:

I realize @NikDevx has suggested you cannot connect both consoles at the same time with playactor. Respectfully, it seems to me there should be a configuration that would allow this, but I'm no expert and haven't tried.

I do have a PS4 and a PS5, though, so I may play around with this at some point.

Maybe @dhleong can weigh in on this (if he hasn't already)?

That said, I do know – since you have multiple PlayStations on your network – that you will need to identify and use the appropriate commands for the specific PlayStation you are looking to register, control, etc.

Subcommands & finding your device(s)

  1. Run playactor or playactor -h for list of "subcommands."

  2. Run playactor browse subcommand to find your device(s).

  3. look for your PS5 (looks like this: "type": "PS5").

  4. More specifically, look for your PS5's name (looks like this: "name": "PS5-XXX"). Alternatively, you can look for your PS5's id (looks like this: "id": "XXXXXXXXXXXX").

Registration

If you haven't already registered (connected) your PS5, follow these steps...

  1. Run playactor login -h for login "options"...

  2. Run either playactor login --host-name PS5-XXX or playactor login --host-id XXXXXXXXXXXX. (replace X's with your PS5's numbers/letters).

  3. Follow prompts/instructions.

Device-specific commands

You can add -h after any subcommand to get a list of options, including device-specific options, for that command.

Example: playactor wake -h

Basically, you will need to add --host-name <name> or --host-id <name> after any PlayStation-targeted command, in order to target a specific PlayStation. Otherwise, I think it defaults to the PS4 or the first PlayStation found.

Examples

--host-name

--host-id

Replace X's – for name or id – with your device's numbers/letters.

dhleong commented 3 years ago

Going to go ahead and lock this since we're getting off-topic—let's keep questions like "this didn't work for me" to the Discussion board, please!

That said @mreassassin, @LordZork is exactly right—if you have multiple devices on your network, you should use the --host-id or --host-name flag to specify which one you want to talk to. Otherwise, playactor just talks to the first one it sees. I may add a --ps4 and --ps5 flag to simplify this for people who have one of each, but for now --host-id or --host-name are the way to go.