Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95437

Parse complex JSON response

$
0
0

@SuperMaximus wrote:

Please help to parse JSON response. None of methods in similar topics worked out.

My JSON is:

Summary

{
“zones”:{
“transaction_time”:null,
“elements”:[

  ],
  "globalSchedules":{
     "time":null,
     "duringChange":null,
     "elements":[

     ]
  },
  "controllerParameters":{

  }

},
“tiles”:[
{
“id”:2006,
“parentId”:4630,
“type”:40,
“menuId”:2006,
“orderId”:null,
“visibility”:true,
“params”:{
“description”:“Text information”,
“statusId”:587,
“headerId”:814,
“iconId”:3,
“options”:[

        ]
     }
  },
  {
     "id":2040,
     "parentId":0,
     "type":50,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Controller software version",
        "version":"1.1.11",
        "txtId":0,
        "iconId":0,
        "companyId":6,
        "controllerName":"i-3",
        "mainControllerId":0
     }
  },
  {
     "id":2050,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":true,
        "txtId":192,
        "value":277,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":2051,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":true,
        "txtId":194,
        "value":286,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":2052,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":true,
        "txtId":795,
        "value":147,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":2053,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":true,
        "txtId":1040,
        "value":304,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":2054,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":false,
        "txtId":196,
        "value":-2030,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":2055,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":false,
        "txtId":197,
        "value":-2030,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":2056,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":false,
        "txtId":1288,
        "value":-2030,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":2057,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":true,
        "txtId":1289,
        "value":236,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":2058,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":true,
        "txtId":221,
        "value":181,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":2059,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":true,
        "txtId":222,
        "value":242,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":2060,
     "parentId":4631,
     "type":1,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Temperature sensor",
        "workingStatus":true,
        "txtId":1308,
        "value":239,
        "batteryLevel":null,
        "signalStrength":null
     }
  },
  {
     "id":4057,
     "parentId":4630,
     "type":6,
     "menuId":3203,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Universal status with widgets",
        "statusId":0,
        "iconId":17,
        "widget1":{
           "txtId":573,
           "value":50,
           "unit":6,
           "type":1,
           "params":[
              0,
              0,
              0,
              0,
              0
           ]
        },
        "widget2":{
           "txtId":0,
           "value":28,
           "unit":6,
           "type":1,
           "params":[
              0,
              0,
              0,
              0,
              0
           ]
        }
     }
  },
  {
     "id":4063,
     "parentId":4630,
     "type":23,
     "menuId":2320,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Built-in valve",
        "workingStatus":true,
        "valveNumber":1,
        "currentTemp":182,
        "returnTemp":303,
        "setTempCorrection":0,
        "openingPercentage":0,
        "valvePump":0,
        "boilerProtection":1,
        "returnProtection":0,
        "setTemp":10,
        "txtId":992
     }
  },
  {
     "id":4064,
     "parentId":4630,
     "type":23,
     "menuId":2420,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Built-in valve",
        "workingStatus":true,
        "valveNumber":2,
        "currentTemp":241,
        "returnTemp":303,
        "setTempCorrection":0,
        "openingPercentage":100,
        "valvePump":0,
        "boilerProtection":0,
        "returnProtection":0,
        "setTemp":34,
        "txtId":993
     }
  },
  {
     "id":4066,
     "parentId":4630,
     "type":23,
     "menuId":2520,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Built-in valve",
        "workingStatus":true,
        "valveNumber":3,
        "currentTemp":239,
        "returnTemp":303,
        "setTempCorrection":0,
        "openingPercentage":100,
        "valvePump":0,
        "boilerProtection":0,
        "returnProtection":0,
        "setTemp":53,
        "txtId":3449
     }
  },
  {
     "id":4600,
     "parentId":4633,
     "type":6,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Universal status with widgets",
        "statusId":0,
        "iconId":167,
        "widget1":{
           "txtId":730,
           "value":0,
           "unit":-1,
           "type":0,
           "params":[
              0,
              0,
              0,
              0,
              0
           ]
        },
        "widget2":{
           "txtId":3731,
           "value":0,
           "unit":-1,
           "type":0,
           "params":[
              0,
              0,
              0,
              0,
              0
           ]
        }
     }
  },
  {
     "id":4605,
     "parentId":4633,
     "type":6,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Universal status with widgets",
        "statusId":0,
        "iconId":167,
        "widget1":{
           "txtId":4023,
           "value":0,
           "unit":-1,
           "type":0,
           "params":[
              0,
              0,
              0,
              0,
              0
           ]
        },
        "widget2":{
           "txtId":3028,
           "value":0,
           "unit":-1,
           "type":0,
           "params":[
              0,
              0,
              0,
              0,
              0
           ]
        }
     }
  },
  {
     "id":4610,
     "parentId":4632,
     "type":11,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Relay",
        "workingStatus":true,
        "txtId":645,
        "iconId":98
     }
  },
  {
     "id":4611,
     "parentId":4632,
     "type":11,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Relay",
        "workingStatus":true,
        "txtId":646,
        "iconId":98
     }
  },
  {
     "id":4612,
     "parentId":4632,
     "type":11,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Relay",
        "workingStatus":true,
        "txtId":1333,
        "iconId":98
     }
  },
  {
     "id":4613,
     "parentId":4632,
     "type":6,
     "menuId":4614,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Universal status with widgets",
        "statusId":0,
        "iconId":98,
        "widget1":{
           "txtId":1177,
           "value":0,
           "unit":7,
           "type":1,
           "params":[
              0,
              0,
              0,
              0,
              0
           ]
        },
        "widget2":{
           "txtId":0,
           "value":0,
           "unit":7,
           "type":1,
           "params":[
              0,
              0,
              0,
              0,
              0
           ]
        }
     }
  },
  {
     "id":4630,
     "parentId":0,
     "type":60,
     "menuId":0,
     "orderId":1,
     "visibility":true,
     "expanded":true,
     "params":{
        "description":"Container",
        "txtId":1290,
        "iconId":138
     }
  },
  {
     "id":4631,
     "parentId":0,
     "type":60,
     "menuId":0,
     "orderId":2,
     "visibility":true,
     "expanded":true,
     "params":{
        "description":"Container",
        "txtId":1617,
        "iconId":87
     }
  },
  {
     "id":4632,
     "parentId":0,
     "type":60,
     "menuId":0,
     "orderId":3,
     "visibility":true,
     "expanded":false,
     "params":{
        "description":"Container",
        "txtId":642,
        "iconId":98
     }
  },
  {
     "id":4633,
     "parentId":0,
     "type":60,
     "menuId":0,
     "orderId":4,
     "visibility":true,
     "expanded":false,
     "params":{
        "description":"Container",
        "txtId":729,
        "iconId":167
     }
  },
  {
     "id":4660,
     "parentId":4630,
     "type":6,
     "menuId":0,
     "orderId":null,
     "visibility":true,
     "params":{
        "description":"Universal status with widgets",
        "statusId":0,
        "iconId":17,
        "widget1":{
           "txtId":2442,
           "value":23,
           "unit":6,
           "type":1,
           "params":[
              0,
              0,
              0,
              0,
              0
           ]
        },
        "widget2":{
           "txtId":0,
           "value":30,
           "unit":6,
           "type":1,
           "params":[
              0,
              0,
              0,
              0,
              0
           ]
        }
     }
  }

]
}

I need to pull sensor values under
“tiles”, selected “id” and under nested “params” there is “SetTemp” and “Value” figures.
Please advise how to do it.

Something like

value_template: '{{ value_json["tiles"][0]["params"]["value"] }}'

doesn’t work.

Any help on pulling, for instance, “value” data from Temperature sensor with ID = 2059 will be pretty much appreciated.
Thank you!

Posts: 14

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95437

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>