Open roadbikemike opened 1 year ago
yes very cool !!
I’ll get to it at some point. If you want to find out where the data is available in the api that would help preempt my research when I get a little time.
I poked around some of the documented Core API functions and unfortunately could not find much regarding thermal data. However, I may have missed something. Looking at the OPNsense dashboard, the thermal data is populated using this URL:
https://opnsense.localdomain/widgets/api/get.php?load=temperature
Which returns:
{"system":"OPNsense","plugins":["interfaces","system","temperature"],"data":{"temperature":[{"device":"dev.cpu.0.temperature","device_seq":"0","temperature":"48.7","type":"core","type_translated":"Core"},{"device":"dev.cpu.1.temperature","device_seq":"1","temperature":"48.7","type":"core","type_translated":"Core"},{"device":"hw.acpi.thermal.tz0.temperature","device_seq":"0","temperature":"47.6","type":"zone","type_translated":"Zone"}]}}
Perhaps this is enough?
Perhaps. I’ll look deeper at some point. Just don’t have much time to put to the project currently :(
Totally understand and thanks for getting back on this! Much appreciated. I will keep poking to see if there is something I am missing for thermal data in the documented API. Although, that URL does seem to be part of the API, but under widgets (which is not documented).
There is an underlying ‘api’ in php land that they are almost certainly using. The way the integration is designed it gives complete access to all the underlying php libs/code as well. In this particular case it’s probably a better option to figure out what the endpoint is using and use that vs using the endpoint directly.
From what I can tell, this is the only way to gather thermal data programmatically at this time:
Which then references:
Looks like temperature.inc executes the actual command via configd_run
which returns the thermal metrics.
There is a comment in get.php which states:
Simple wrapper to retrieve data for widgets using legacy code.
Perhaps they have not moved the thermal data into the mainstream/underlying API yet.
Right, but the way the integration works you can just tap into the latter directly.
Any chance this might happen?
Any chance this might happen?
Yep, that would be a useful feature as monitoring the SBC that runs OPNsense (at least in my case) is something I need to keep an eye on. There is no fans on that SBC and the room is shared with other warm stuff. I do it indirectly at the moment via my NAS temp but would be a nice quality of life implementation.
up
I see someone had asked about gathering thermal data in Discussions but do not see an open Issue. Would be great to have CPU thermal data sent to Home Assistant. Would like to do some automation around this metric and disappointed to not see it there.