Help with JSON value template

Hi,

As always I would really appreciate your help with the following. I am trying to parse a value from a JSON file but can’t get it working. The JSON file is structured like this:

{
   "data":{
      "timeProgs":[
         
      ],
      "plantData":{
         "outsideTemp":20.2,
         "hasOutsideTempProbe":true,
         "dhwComfortTemp":{
            "min":44.0,
            "max":55.0,
            "value":48.0,
            "step":1.0
         },
         "dhwReducedTemp":{
            "min":8.0,
            "max":48.0,
            "value":44.0,
            "step":1.0
         },
         "dhwEnabled":true,
         "dhwMode":{
            "value":1,
            "options":[
               {
                  "value":0,
                  "text":"Off"
               },
               {
                  "value":1,
                  "text":"On"
               }
            ]
         },
         "flameSensor":false,
         "heatPumpOn":false,
         "dhwStorageTemp":49.5,
         "dhwStorageTempError":false,
         "hasDhwStorageProbe":true,
         "outsideTempError":false,
         "isDhwProgReadOnly":false
      },
      "zoneData":{
         "holidays":[
            
         ],
         "mode":{
            "allowedOptions":[
               0,
               1,
               2,
               3
            ],
            "allowedOptionTexts":[
               "Protection",
               "Automatic",
               "Reduced",
               "Comfort"
            ],
            "value":1
         },
         "isHeatingActive":true,
         "isCoolingActive":false,
         "hasRoomSensor":false,
         "chComfortTemp":{
            "min":22.0,
            "max":28.0,
            "value":23.0,
            "step":0.5
         },
         "chReducedTemp":{
            "min":10.0,
            "max":23.0,
            "value":22.0,
            "step":0.5
         },
         "coolComfortTemp":{
            "min":0.0,
            "max":0.0,
            "value":0.0,
            "step":0.0
         },
         "coolReducedTemp":{
            "min":0.0,
            "max":0.0,
            "value":0.0,
            "step":0.0
         },
         "roomTemp":0.0,
         "heatOrCoolRequest":false,
         "chProtectionTemp":10.0,
         "coolProtectionTemp":10.0,
         "chHolidayTemp":0.0,
         "coolHolidayTemp":0.0,
         "desiredRoomTemp":23.0,
         "useReducedOperationModeOnHoliday":false,
         "roomTempError":false
      }
   },
   "ok":true,
   "redirectUrl":null,
   "message":"",
   "debugMessage":""
}

The value I try to get is: 20.2 from: “outsideTemp”:20.2

I tried it like this:

        value_template: "{{ value_json.Data['plantData'].outsideTemp }}"

but no success. Thanks for your support.

Try with just

{{ value_json.data.plantData.outsideTemp }}

Edit… I see now you have capital letter D in data.

Thanks for the hint with the lower case but I am afraid it doesn’t work. The log says:

2022-07-15 20:53:10 ERROR (MainThread) [pyhap.characteristic] TargetHeatingCoolingState: value=0 is an invalid value.

No idea where this is coming from.

The complete code I am using in configuration.yaml is:

multiscrape:
  - resource: https://www.remocon-net.remotethermo.com/R2/PlantHomeBsb/GetData/MYSECRET
    method: POST
    scan_interval: 900
    form_submit:
      submit_once: True
      resource: 'https://www.remocon-net.remotethermo.com/R2/Account/Login'
      select: "#loginForm"
      input:
        Email: !secret elco_username
        Password: !secret elco_password
        extra: field
    sensor:
      - name: ElcoOutsideTemperature
        value_template: "{{ value_json.data.plantData.outsideTemp }}"
        unit_of_measurement: "°C" 

It seems I am passing the login page. But then there seems to be something wrong with the parsing. Any hint on how to debug this in more detail would be great as well. Thanks.

That is strange.
I copied the JSON and tested it in template tools and it worked there.

It is super strange. I tried to debug a bit more and when using this code:

        value_template: "{{ value_json.data }}"

I get this value back:

Any idea? @Hellis81

No… very strange.
Could it be that the login doesn’t work as it should?