Pulling data from a really big JSON string

I’ve been playing with OpenHardwareMonitor. It has the facility to create a JSON string of all the properties of the machine.

It’s really big and complicated - when technically I only want the temps.

Would it be worth trying to read the json in a transformer or rule…or, since i can get access to the source - implement a MQTT broker to send the temps over?

Also how does an http rule poll the server? or would you do that from a rule?

I would probably just pull the values from the JSON string. While the JSON itself is complicated, the transform to pull the value would probably be really simple. JSON is nice like that. I think it would be less work overall and more maintainable to do this than to modify OpenHardwareMonitor code.

See the HTTP Binding wiki page. The tl;dr is you specify a polling period in openhab.cfg and it pulls the value that often and distributes the data to the various Items that need it.

So If I make an item the follwoing:
Number Server_Temperature “Temperature [%.1f °C]” (g_temperature) { http="<[http://aragorn.lan:8085/data.json:10000:JSONPATH($[0].SubHardware[0].Sensors[12].Value)]" }

Should I expect to see something in the logs? As I dont. I wonder if the 8085 is getting picked up as the refresh time?

It could be. You can move the call to a rule and use sendHttpGetRequest and see if that works. That would show you whether the binding is interpreting the port as the refresh, though if that is the case I would expect to see errors in the log when OH loads the items file complaining about not being able to parse the binding string.

You can put the logger into debug or trace mode for the HTTP binding and get some more info. See the bottom of the Zwave binding wiki page for a good exmaple of how to do this.

I figured it out. The http://aragorn:8985 was being picked up as aragorn with a 8085 refresh. But I ended the web page with / and it worked…

I tried figuring out how to add debugging for http binding but couldn’t. I’ll look at the binding page.