[SOLVED] Parsing a json value from an existing entity in a template sensor

I’ve looked into it and reproduced the problem on my end. The cause is the fact that the JSON reply gets parsed as a list instead of a dictionary. I’ve made some changes to the custom component, and now it seems to work fine. Get the latest copy from here: https://github.com/mad-ady/home-assistant-customizations/blob/master/custom_components/sensor/jsonrest.py

Here is a sample config:

  - platform: jsonrest
    name: 'array'
    scan_interval: '00:01'
    resource: http://127.0.0.1/cgi-bin/array.sh

Here’s how you can parse the result (the array gets associated to the name ‘list’ and ‘list[0]’ is the first dictionary in the array):

{{ states.sensor.array.attributes.list[0].pwr }}
4 Likes