that means your incoming data is not seen as json. Something is invalid in the response at some point. Either your device/endpoint is outputting empty data, or there’s “hidden” characters that make it not json like leading or trailing characters that cannot be visualized as text (So you don’t see them in the response).
You can try and see the full response by just using “{{ value }}” however it will be truncated to 254 characters.
I also believe there are debug logs for rest that allow you to see the full rest response.
Hi I suspect I have to just define a default state as this sensor is not immediately available during startup, I am just not sure how to define the default in this case.
I already explained the problem. You aren’t getting json back on some calls. The only way to account for that is to not use value_json and use value instead.
No, you aren’t understanding what I’m telling you. You seem to think your API always sends JSON. It does not. Sometimes it’s json, sometimes it’s not json. So you’re getting errors when it’s not json. You have to account for that by checking value, and if it has information, cast it to json and then use it.
If you’re getting the error every time, it’s 100% not json, regardless what json checker is telling you. You can see the full json being output by plopping the entire returned value in an attribute.
I’m not sure that will work, I personally don’t believe his output is json as he’s never gotten a value. But he keeps telling me it is otherwise. There’s most likely an encoding issue with his output that’s placing hidden characters at the start or end of his json.
Yes, I know. You’ve posted this multiple times. However I’m telling you: You will not get that error if yoru value is truely JSON. What you’re posting is truely JSON, but you’re getting the error. So there is only 2 possibilities:
The API doesn’t always respond with json.
The API is adding special hidden characters that you aren’t accounting for.
I’ve tried getting this information out of you, but you keep posting the json. So at this point, there’s nothing that can be done because you’re not able to give the requested information. As soon as you can supply myself or troon with the information we need, we can help you. But right now the ball is in your court.