Dear all,
I have an MQTT sensor that serves a JSON string like this:
{"clients":[
{
"field1": "aaa",
"field2": "1.2.3.4:45980",
"field3": "10.8.0.3",
"field4": "925KiB",
"field5": "7.9MiB",
"field6": "16:19:22",
"field7": "1648559962",
"field8": "206",
"field9": "-",
"field10": "UNDEF"
},
{
"field1": "bbb",
"field2": "4.3.2.1:40681",
"field3": "10.8.0.2",
"field4": "61KiB",
"field5": "215KiB",
"field6": "16:34:35",
"field7": "1648560875",
"field8": "207",
"field9": "-",
"field10": "UNDEF"
}
]}
How do I filter the above to feed only one of the clients to my sensor?
I have this filter expression, that works as expected here:
$.clients[?(@.field1=="aaa")]
HA (template editor) wouldn’t accept this notation with this error:
TemplateSyntaxError: unexpected char '?' at 597
In the template documentation I haven’t found any filtering related content. Is it at all possible? If yes, how?
Thanks in advance for any pointers!