Rest sensor returns "unknown"

Hi, I’m having some troubles with getting my first Rest sensor going. It is now returning “unknown” based on the following inputs:

JSON:

Request:
./api/menutree/read_datapoint.json?SessionId=e87d4947-6dff-445c-a856-371e15dc8c95&Id=1065
Response:
{
  "Data":
    {
    
      "Type": "Numeric",
      "Value": " 4.9",
      "Unit": "°C"
    
    },
  "Result":
    {
    "Success": "true"
    }
}

configuration.jaml:

sensor:
  - platform: rest
    name: temp sensor
    resource: http://192.168.1.3/api/menutree/read_datapoint.json&Id=1065
    value_template: '{{ value_json.Data.Value }}'
    headers:
      Authorization: e87d4947-6dff-445c-a856-371e15dc8c95
      User-Agent: Home Assistant
      Content-Type: application/json

What am I doing wrong?

The value template should be "{{ value_json['Data']['Value'] }}"

Your method should work fine as Phil said. I tested it in the template tool.

https://www.home-assistant.io/docs/configuration/templating/#processing-incoming-data

The value_template in the OP should be ok. There’s probably something else going wrong.

Do you see any warnings or errors in the log? What do you get if you temporarily remove value_template from the sensor config?

Ah you’re right. The part of the docs that I linked make it seem like using the bracket notation is the only way to grab nested JSON values. I’ll submit an edit adding the way OP has it.

If I comment out the value_template line I get:

{ "Result": { "Success": "false", "Error": { "Txt": "session not valid", "Nr": "2" } } }

This is another problem I’ll need to solve as it appears that the Authorization: line does not submit the session id correctly.

That’s the state of the REST sensor? If so, then yes, it does look like it’s not accepting the request (and it would explain why '{{ value_json.Data.Value }}' caused the state to be unknown.