Playstation 4/PS4 custom component

Tags: #<Tag:0x00007f47f5939100>


@yrune good catch. Thanks, I missed a step somewhere!


Hey, I have an issue with this component since ages. From one day to the other the media player stopped showing the image of the current game. It’s quite weird and I’ve tried everything to solve this issue. The media player looks like this:


The state of the media player lists an entity picture with a local path:

and when I open this path in my browser the image of the current game is shown in the browser:

So the path works but the component doesn’t load it into the media player. As I said it worked perfectly and I haven’t changed any config. Config is set to local storage as shown in the instructions. Any fix for that?


One thing I’ve never been clear on, are we supposed to be supplying these images (as in go and find an image for every game we have and put it in a folder), or is the add on supposed to be grabbing them itself online?


If you use local option you have to get these images for yourself and place them in a folder in www.


How do you name the images?


Images need the game’s ID in name. See:



i still only get small icon. its not showing in frontend.

this is my setup:

- platform: ps4
  host: http:/XXXXXX:3031
  ps4_ip: XXXXXXX
  name: PlayStation 4
  local_store: games


Is there another option other than local?


You haven’t read the manual. Default option is without local storage. Instead it uses an online database. Just leave out the local_store part in your config.


@hmn can you help out with the image preview issue?


Yeah I don’t have local config in my setup but I still don’t get any images. Not sure it’s ever worked to be honest but wasn’t sure if it was just me.


To me it’s the other way round. I have always used the local option. Sorry, I didn’t know that the online mapping didn’t work either. @7even I also only get the small icon.


I just got the component working . YEAY!
BUT… I do not use local for game images but I only get images on some of the games. The games that do work I get both small and large images, for the ones that don’t I don’t get any images. Looking into it now thou, I think I saw something about this before


I can’t get root , i tried with new instalatión but nothing, when you make the authorized_keys with puttygen you save as .ppk extensión? Ayer this delete the comment import frontera USB, put the key in the ssh addon like authorized_keys, reboot and nothing i can access with port 22 but no 22222 access refused


After I reinstalled hassbian on my Pi I can not get this component to work anymore. I can control the ps4 but the mediaplayer.ps4 does not show up. In my previous installation everything worked. I am using the latetst version of the file.

When I boot up homeassistant I get the following error:

2018-11-25 22:43:33 ERROR (Thread-14) [homeassistant.util.package] Unable to install package Command "/srv/homeassistant/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-7g96tekd/pycryptodomex/';f=getattr(tokenize, 'open', open)(__file__);'\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-c99nklns-record/install-record.txt --single-version-externally-managed --compile --install-headers /srv/homeassistant/include/site/python3.5/pycryptodomex" failed with error code 1 in /tmp/pip-build-7g96tekd/pycryptodomex/
2018-11-25 22:43:33 ERROR (MainThread) [homeassistant.requirements] Not initializing media_player.ps4 because could not install requirement
2018-11-25 22:43:33 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform media_player.ps4: Could not install all requirements.

Any suggestions to get this component working??


Last edit: this seems to be my issue.

My problem is that when I SSH into the RPi and run ps4-waker, everything works fine. When I try to go to http://HA_IP_ADDRESS:3031/ps4/PS4_IP_ADDRESS/info, I’m getting a json {“status”:“Could not detect any matching PS4 device”}.

It seems like a network issue, but I confirmed that both my RPi and my PS4 are on the same network so I don’t think using --bind would help.

Any thoughts?


solved the issue of no caption / media_image displayed by modifying the
this should do it :slight_smile:

basically, what I did is telling that entity_picture = media_image_url :wink:

you should edit your in /custom_components/media_player/

here’s my file :


Does anybody know if it’s possible to get a push update (instead of polling) when the PS4 is turned on?

I’m not a big fan of polling because it takes several seconds for a change to be noticed, but of course I realize that push updates are often not available.


I’ve managed to make it all work with updated component, but have problem with images not loading from PS Store. So I tried using older version of component, images do load without problem, but it doesn’t seem to connect to ps4-waker. Can I have both? Maybe there is some other version or someone has solution? Thanks

I managed to find that this piece of code in is missing in new version, so it doesn’t even try to download cover art, which is weird decision by author to omit this function. I’m not able to edit this component myself as I’m not a python coder, maybe someone else could do that. Here’s the code in older version that fetched the cover art:

    def ps_store_cover_art(self):
    """Store coverart from PS store in games map."""
    import requests
    import urllib

    cover_art = None
        url = ''
        url += '/valkyrie-api/en/US/19/faceted-search/'
        url += urllib.parse.quote(self._media_title.encode('utf-8'))
        url += '?query='
        url += urllib.parse.quote(self._media_title.encode('utf-8'))
        url += '&platform=ps4'
        headers = {
                'Mozilla/5.0 '
                '(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 '
                '(KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36'
        req = requests.get(url, headers=headers)
    except requests.exceptions.HTTPError as error:
        _LOGGER.error("PS cover art HTTP error, %s", error)

    except requests.exceptions.RequestException as error:
        _LOGGER.error("PS cover art request failed, %s", error)

    for item in req.json()['included']:
        if 'attributes' in item:
            game = item['attributes']
            if 'game-content-type' in game and \
               game['game-content-type'] in \
               ['App', 'Game', 'Full Game', 'PSN Game']:
                if 'thumbnail-url-base' in game:
                    _LOGGER.debug("Found cover art for %s, %s %s",
                    cover_art = game['thumbnail-url-base']
                    cover_art += '?w=512&h=512'
                    self._gamesmap[self._media_content_id] = cover_art


hey @YuriGlushko , take a look to my post, it’s 2 replies above :blush:

feel free to edit it and add your ps_store_cover_art script :wink: