#Yep I put OK or the retrieval datetime

1 messages · Page 1 of 1 (latest)

unborn plinth
#

I am actively trying to do this with this output and I can NOT get it to play nicely.

#

Can you take a look at the pastebin I posted a few lines up?

neon topaz
#

If you set the attribute to just value_json do you get anything back or just the invalid json? I wonder if the command is perhaps adding something around the json may be file encoding characters or something similar.

unborn plinth
#

No, I don't get anything with value_json

#

The command appears fine. Every now and again I can change something around to get an output that HA says isn't valid

#

But shows up as JSON in the error

neon topaz
#

I might be tempted to write a test script to use the json directly from a file on the HA server. That way you can play around with a simple json first, then add in the [] wrapper which yours has and see if HA is un happy with that. Once you have that working you can build up to the other. I mostly use json with the rest sensor and mqtt so have not needed to use command line.

unborn plinth
#

I normally dont have a wrapper

neon topaz
#

I did get stuck with an odd one, but ended up writing a small php script on one of my servers to pull the data and clean it up for HA

unborn plinth
#

But the majority of the command line sensors that grab json data don't have multiple dicts

#

I was thinking about doing that a moment ago but I figured JQ should be able to do that for me

#

Wrap it all in a dict with a key at the front like {items:[]}

#

But... can't find a simple solution for that either

neon topaz
#

I would be tempted to see if JQ can split out one dict or write a bash script to grab the data, tweak it and then return that to HA.

#

So if you have 3 entries just use 3 sensors one for each.

unborn plinth
#

I don't, it gets more complicated than that

#

I have to individually pull lat/long and then write automations to convert that data in a device tracker after the fact

neon topaz
#

If you only want the lat/long. JQ looks like it can pull that data directly out of the received json, then you can might be able to use a template sensor of the device tracker?

unborn plinth
#

I might

neon topaz
unborn plinth
#

Hmm no, I hadn't seen that