I’m trying to get json data from a http server with this item:
String Weer "Temperature [%s]" {http="<[http://192.168.0.163:5001/weer:30000:JS(weer.js)]"}
And this javascript:
JSON.parse(input).temp;
This is the json data:
{
"temp": "11"
}
Hoping that the string would turn up 11 in my sitemap, but I only get a ‘-’.
Nothing to see in the logs
I must be doing something wrong but I can’t figure out what
cli indicates that http & javascript bindings are enabled:
String Weer "Temperature [%s]" {http="<[http://192.168.13.91:5001/weer:30000:JSONPATH('$.temp')]"}
using double quotes gave me an error so I replaced with single quotes.
Think JSONPATH is fine now I think, but I don’t see a connection coming in on my web server.
PS I’m using other ip adress cause I’m on other network now
Any ideas ??
Hmm, even without the quotes I get the same result. In my sitemap I only get the string Temperature, the result is not displayed.
No errors or warnings in the logs and no connection to my http server.
Strange, according to the manual and some tutorials I went through it should work.
Wow man, you are great! I thing openhab is still booting up (I only have Rest API, Home Builder and HAB panel) But I’m getting a response on my web server now the thing is refreshing every 3 sec like I told it to! I will put that time much longer though.
What I did: I first cleared the cache and then I got an error that I had no rights to delete the folders, so I deleted them manually. Then I restarted OH and had a lot of errors in the logs like can’t find files. Restarted again and now everything looks OK.
I don’t know how to thank you if everything turns up all right
Strange thing, PaperUI and the others never showed up.
I took a backup of all the things etc en did a remove and reinstall of openhab, still not working.
I guess I played around too much and now its time for a new image on my RPi. Probably deleted too much, I don’t know. But learned now how to clear the cache
Hope I never need it again.
Well, I’ll say that I’ve never needed to do it myself. But I know some users who have had to manually clear the cache after every upgrade. So keep your fingers crossed but don’t lose that link.
Glad to hear you never needed it. I’ve been testing around a lot the last couple of days, I’m sure I made a mistake somewhere and messed up the whole system. But hey, that’s the pain you get when learning a new system. Glad I backed up all my files and have a second sd card prepared for cases like this.
Looking forward to start again with a blank image. I’ll press a reset button in my mind and start over again.
Thanks for being there for me. Really enjoyed this conversation.