Need help with REST-sensor to return power status of Bravia TV

I am trying to configure my first REST sensor and I am having trouble retrieving the data.

I have a Bravia Smart TV (model: KD-65X8500F) and don’t want to use the Bravia integration as it causes the TV to turn off randomly. (I have checked Power settings, Eco mode etc). I am running HassOS Development 5.2 on a PI4.

My sensor is configured as:

  - platform: rest
    resource: http://10.1.1.20/sony/system -d
    method: POST
    payload: '{ "method": "getPowerStatus", "id": 50, "params": [], "version": "1.0" }'
    value_template: "{{ value_json['result'][0]['status']}}"
    name: tvpower

I have tested using :

 curl -POST http://10.1.1.20/sony/system -d '{ "method": "getPowerStatus", "id": 50, "params": [], "version": "1.0" }'

and it returns:

{"result":[{"status":"standby"}],"id":50}

The sensor.tvpower has state ‘unknown’.

I have tried a few different variations on the value_template without success.

Does anyone have any suggestion on the syntax for the sensor?

Try removing the -d from your resource. As far as I remwmber this is just the parameter to make a POST request for curl.

WOW! As simple as that. Thank you :slight_smile: It worked. :slight_smile: