Xbox One RESTful Switch - the damm thing wont stay off

Hi,

A hassio user here. So I created this to add to my fronted to switch on my Xbox. I have the Xbox Addon install to act as the server (i think??).

The problem is that when the rest platform is enabled it switches my Xbox on constantly, like 10 seconds after i switch it off, and it just repeats this behavior.

Any suggestions?

  - platform: rest
    resource: http://192.168.0.XX:5557/device/FD00XXXXXXXXXXXX/poweron
    name: Xbox One Test
    is_on_template: '{{ value_json.success }}'

You don’t show the full config (i.e., what is this platform config under?), but this is (probably) happening because you’re using a RESTful Sensor instead of a RESTful Switch. A sensor periodically polls, which is why it’s continually sending the GET request and turning on the Xbox. You should either use the RESTful Switch, or maybe a RESTful Command, depending on exactly what you’re trying to accomplish.

OK so i changed what i was trying to do - This way turns on and off the xbox but the state of the switch stays “off”. It will turn on for 3 seconds then revert back to off but the xbox stays on.

Any suggestions?

rest_command:
  xbox:
    url: 'http://192.168.0.XX:5557/device/FD00D64XXXXXXXX/{{power}}'
  - platform: ping
    host: 192.168.0.XXX
    name: Xbox One
    scan_interval: 5
  - platform: template
    switches:
      xboxone:
        value_template: "{{ is_state('binary_sensor.xbox_one', 'On') }}"
        turn_on:
          service: rest_command.xbox
          data:
            power: "poweron"
        turn_off:
          service: rest_command.xbox
          data:
            power: "poweroff"
        friendly_name: "Xbox One Test Template"

Which ping component are you using? Again, you don’t show that. (There are multiple components that have a ping platform.) Is it a binary_sensor? If so, its state will be 'on', not 'On' (i.e., all lower case.)

You sir are a genius - thank you! I would never have noticed that mistake. :+1:

I will keep in mind the component thing for the future.

Thanks again

1 Like