Can someone please help me debug my code?
I cannot get it to work.
I think it is something wrong with the CSS select, but I do not know what.
I used Copy Select in the inspect tool in Chrome.
I tried to scrape different values from the same site, but without any success.
I tried to make a rest sensor, but I cannot get it to work.
I got the following error message in https://jsonpathfinder.com/ when I added the code using https://reqbin.com/ "Unexpected token âï»żâ, "ï»ż [{ â⊠is not valid JSONâ.
That was harder than it should have been. The URL is not using correct headers and is sending a Byte Order Mark first. The configuration below works to pull the indicated number: apologies if the name makes no sense in Norwegian:
If you open the JSON in a browser and copy/paste it to online tools, it works. My value_template strips off the first byte (value[1:]), converts it from a JSON string to an object, finds the (first and only) data block where navn is à gÄrdselva, looks up the list of avlesninger data entries, and pulls the avlesning number for the last one ([-1]) of those entries.