Template variable Error + runner.py

Hello people,

I just can’t get on here, everything works but my log keeps showing this message here:

Template variable error: 'dict object' has no attribute 'data' when rendering '{{ value_json.data.state }}'
and
JSON result was not a dictionary or list with 0th element a dictionary

My config looks like this:

    - platform: rest
      resource: http://192.168.1.5:8123/api/hassio/addons/core_duckdns/info
      name: DuckDNS Addon Update Sensor
      value_template: "{{ value_json.data.state }}"
      scan_interval: 60
      headers:
        Authorization: !secret token_ha_update
        Content-Type: application/json
      json_attributes_path: "$.data"
      json_attributes:
        - version
        - version_latest
        - slug
        - name

i tried it with config

value_template: "{{ value_json.data.state | defafult }}"

but same error :frowning:

My second problem is these error:

Logger: homeassistant
Source: runner.py:96
First occurred: 10:02:02 (5 occurrences)
Last logged: 10:03:14

Error doing job: Task was destroyed but it is pending!
Error doing job: Unclosed client session

Can anyone tell me what this runner.py is about?

So i got it working with this

value_template: "{% if 'data' in value_json %}{{ value_json['data']['state'] }}{% endif %}"

But now i have this warning:

JSON result was not a dictionary or list with 0th element a dictionary

Can somebody help me?

Thanks

The error is telling you that you aren’t getting valid json from whatever is presenting the json. You should be focusing on your device and why it’s not producing valid json. The issue isn’t in your templates.