core: PS4 does not turn on with lovelace media card power button

Home Assistant release with the issue:

102.0.dev.0

Last working Home Assistant release (if known): 101.3

Operating environment (Hass.io/Docker/Windows/etc.):

Debian Buster

Integration:

https://www.home-assistant.io/integrations/ps4

Description of problem:

  • Changes made by me from #28261 (Changing STATE_OFF to STATE_STANDBY) causes a bug with the Lovelace media player card where if the state is STATE_STANDBY, then pressing the power button calls the media_player.turn_off service instead if the intended turn_on service.

The frontend conflict is here: https://github.com/home-assistant/home-assistant-polymer/blob/6ecc60423f6bafddef7d6a8d342525c36855d983/src/util/hass-media-player-model.js#L179

  togglePower() {
    if (this.isOff) {
      this.turnOn();
    } else {
      this.turnOff();
    }
  }

  turnOff() {
    this.callService("turn_off");
  }

  turnOn() {
    this.callService("turn_on");
  }

State must = ‘off’ for service turn_on to be called.

  get isOff() {
    return this.stateObj.state === "off";
  }

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

Traceback (if applicable):

2019-11-19 23:54:23 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.281470748259104] Received {'type': 'call_service', 'domain': 'media_player', 'service': 'turn_off', 'service_data': {'entity_id': 'media_player.playstation_4'}, 'id': 21}
2019-11-19 23:54:24 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=media_player, service=turn_off, service_data=entity_id=media_player.playstation_4>
2019-11-19 23:54:24 INFO (MainThread) [pyps4_2ndscreen.ps4] Standby Failed: TCP Protocol does not exist

Additional information: Roku integration may also be affected #28148

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 47 (16 by maintainers)

Most upvoted comments

I couldn’t find any patch either. Unfortunately it has been quite impossible to get any traction on this issue, a real solution still seems far away.

At least for all users of HACS, I am now providing a custom dirty fix. Just add fleXible/ha-ps4-custom with category Integration to your Custom Repositories and install PlayStation 4 Custom.

@ThomasPrior The Media Control Card widget, should then work normally.

Whilst not going to be open an issue for a similar issue but this also extends to the universal media player component.

I have my Living Room entertainment setup in the following order, with precedence towards the top. However, with PS4 reporting a state as “Standby”, when everything else is off and watching live TV directly via the Television, the current programme is not reported as active.

  • Plex (Apple TV)
  • Apple TV
  • PlayStation 4
  • Television

@MartinHjelmare I think the best references are the details of the current implementation:

Those 2 files provide the basis for all common functions for media_player implementations. Anything not in there, but only found in a specific implementation is prone to break things somewhere else.

As an example take androidtv, which uses the state STATE_STANDBY that can not be reproduced by the underlying media_player implementation, because there it’s missing.

I have the feeling, there is a mismatch between architectural consent and actual implementation reality, which leads to funny surprises all over the place.