Another JSON parsing question for th REST sensor

Hi,

I hope I read all the REST sensor threads but still I’m lost…
I’m using a P1MON system (https://www.ztatz.nl/). With the following API call:
http://192.168.178.54/api/v1/smartmeter/?limit=1
I get the following results:
[[“2019-05-12 21:28:23”, 1557689303, 0, 2216.694, 2777.013, 0.0, 0.0, “D”, 347, 0, 1645.051]]
I;m only interested in the 9th item (347) but I cannot seems to filter it correctly with the value_template. I tried to use:
value_template: ‘{{ value_json[9] }}’ But that only returns the 9th character from the call (a 5)

What I’m doing wrong?
Regards, Erik

It’s a list containing one item and that one item is a list containing 11 items.

Lists are zero-based, meaning the item index starts with zero (not one). So you want the 8th item.

Paste this into Home Assistant’s Template Editor and experiment with it to get a better understanding of how it works.

{% set value_json = [["2019-05-12 21:28:23", 1557689303, 0, 2216.694, 2777.013, 0.0, 0.0, "D", 347, 0, 1645.051]] %}

A) {{ value_json }}

B) {{ value_json[0] }}

C) {{ value_json[0][8] }}

Here are the results:

Thank you, that was the trick! I was aware of the Template Editor but did not understand hoe to use it.
Thanks again for your time.