Fetching JSON value by restful API

Hello, I would like to retrieve value and I created rest sensor by the documentation. However, it seems it does not return any value and it is very hard to debug it, because I can’t find in any log the actual response from the server. What could be wrong?
The sensor definition is like this:

sensor 47:
  - platform: rest
    resource: https://slushpool.com/stats/json/btc/
    method: GET
    headers:
      SlushPool-Auth-Token: <authentication token>
    value_template: "{{ value_json.round_duration }}"
    json_attributes:
      - round_duration
    name: slush

and part of the json return (if I manually trigger the call by curl), where I want to get value “round_duration” is this:

{"btc": {"luck_b10": "0.90", "luck_b50": "1.03", "luck_b250": "0.95", "hash_rate_unit": "Gh/s", "pool_scoring_hash_rate": 7735084874.5763, "pool_active_workers": 149715, "round_probability": "0.73", "round_started": 1635783128, "round_duration": 15872,

It is nested in second level of depth.

How do I debug it and see real server response?

Use this tool to find the path to the data you want:

https://jsonpathfinder.com/

Paste your json data on the left, drill down on the right. The path is at the top of the right hand column. Replace x with value_json.

3 Likes