I need some help in understanding what I am missing in a rest api call please. I finally thought I had a fairly good grasp of API:s and decided to make use of a publicly available api. That being said, I am struggling with the generated sensors which appear to be empty/unavailable. I have tried with two differerent approaches as visible in my configuration.yaml below.
Assuming the parser can read through the potential Byte Order Mark suggested above, your problem is the first [0] in your templates. Remove them — should start value_json.Payload.
Thanks for the quick reply! That’s strange. I don’t get an error like you do. At least not for the first rows. I did however saw some issues (null values?) further down the API code:
Thanks, I think I did try this in one of many earlier attempts without any luck. The usage of [number] is when I want to reference a particular row (?) in a table right? At least that was how I interpretated it from my reading today
Nevertheless, I will give your suggestion a go for sure, thanks again!
Out of curiosity, is it sufficient to only reload all YAML files or do I need to restart HA every time i make adjustments to sensors like these? Would be great if I didn’t have to restart all the time. Though, I’m pretty sure I’ve had a few cases in HA where I had to actually restart HA in order to get a few sensors up and running…
You’re not going to get far guessing like that. [0] is indeed for accessing the first element in a list, but that JSON isn’t a list at the top level.
The problem is indeed with the response. I set up the same sensors and get this in the log:
This is currently beyond my level of understanding I’m afraid. Node-RED appear to be very useful but still something I haven’t had the pleasure to dig into yet.
Does it matter or, perhaps I should say is it possible to exclude the first part in the API? I’m thinking of the part you have in this printscreen (providerPayload). I was hoping to skip that part and move straight to the “Payload” part underneath?
That being said, if the API that I’m connecting to is broken then it’s quite unfortunate as it’s out of my control then. Fortunately I have another API for flights that I am planning to make use of but that was a bit more complex with credentials etc. TBC
I really appreciate you both took your time here to support. I’ve learned a lot and will continue to learn thanks to the awesome community members of HA such as yourselves. Many thanks!
Wow, many thanks for looking into this one Troon! I completely missed your reply above since I thought my issue was more or less a dead end. Instead I found a different API serving the temperatures I was looking for and this time I got it to work after some additional reading.