Package: pyps4-homeassistant
Python Control for PlayStation 4 consoles.|BuildStatus| |PypiVersion| |PyPiPythonVersions|Deprecated**This module is now deprecated and is not longer in development. This module has been renamed to pyps4-2ndscreen. Seehttps://pypi.org/project/pyps4-2ndscreen/**DescriptionA full Python implementation based on the Node.js package, ps4-waker.
This is an unofficial API for the PS4 2nd Screen App.CompatibilityTested on:
Python 3.5/3.6/3.7InstallationTo install run:.. code:: bashpip install pyps4-homeassistantProtocolUDP is used to get status updates and retrieve user credentials. TCP is used to send commands to the PS4 Console.PortsPS4 listens on ports 987 (Priveleged) to fetch user PSN credentials.
Must run command on python path if no access.
This is so you do not need sudo/root priveleges to run although you can run as sudo, but it is not advised.Example:.. code:: bashsudo setcap 'cap_net_bind_service=+ep' /usr/bin/python3.5UsageAPI should be accessed initially like the following examples.Most functions can be accessed from the high-level PS4 object. You will need to pass in th IP address of your PS4 and your PSN credentials.There are several async/asyncio coroutine functions in this module. These functions should be accessed with an Asyncio loop.There are two versions of the Ps4 object/class: Ps4() and Ps4Async().
The difference is that the Ps4() class uses synchronous sockets (socket.socket) while the Ps4Async() class uses asyncio transports and protocols. If using the Async version, a running asyncio event loop is required.class Ps4().. code:: pythonimport pyps4_homeassistant

pyps4_homeassistant.ps4.Ps4("192.168.0.2", "YourCredentials")class Ps4Async().. code:: pythonimport pyps4_homeassistant

pyps4_homeassistant.ps4.Ps4Async("192.168.0.2", "YourCredentials")Getting CredentialsYour PSN Credentials can be generated by running:.. code:: pythoncreds = pyps4_homeassistant.credential.Credentials()

YourCredentials = creds.start()This will start the credential service and will return the credentials for the PSN Account. You will need to get the PS4 Second Screen app for Android or iOS to do this. Once you have logged in with your acccount in the app and started the service, refresh the devices in the app and select the device named 'Home-Assistant'.Cover Art IssuesIf you find that media art cannot be found. Please post an issue with your Region, Country, Title of game, an ID of game.To Do List:Port TCP and UDP functions to Asyncio.Credits:Thanks to hthiery for writing the underlying socket protocol in Python.https://github.com/hthiery/python-ps4References:https://github.com/dsokoloski/ps4-wakehttps://github.com/dhleong/ps4-wakerhttps://github.com/hthiery/python-ps4.. _ps4-waker:https://github.com/dhleong/ps4-waker.. |BuildStatus| image::https://travis-ci.org/ktnrg45/pyps4-homeassistant.png?branch=master:target:https://travis-ci.org/ktnrg45/pyps4-homeassistant.. |PyPiVersion| image::https://badge.fury.io/py/pyps4-homeassistant.svg:target:http://badge.fury.io/py/pyps4-homeassistant.. |PyPiPythonVersions| image::https://img.shields.io/pypi/pyversions/pyps4-homeassistant.svg:alt: Python versions
:target:http://badge.fury.io/py/pyps4-homeassistant