Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Thermal Sensor Data #79

Open
roadbikemike opened this issue Apr 21, 2023 · 10 comments
Open

Feature request: Thermal Sensor Data #79

roadbikemike opened this issue Apr 21, 2023 · 10 comments

Comments

@roadbikemike
Copy link

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.

@roadbikemike roadbikemike changed the title Thermal Sensor Thermal Sensor Data Apr 21, 2023
@roadbikemike roadbikemike changed the title Thermal Sensor Data Feature Request: Thermal Sensor Data Apr 21, 2023
@roadbikemike roadbikemike changed the title Feature Request: Thermal Sensor Data Feature request: Thermal Sensor Data Apr 21, 2023
@syberx
Copy link

syberx commented May 25, 2023

yes very cool !!

@travisghansen
Copy link
Owner

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.

@roadbikemike
Copy link
Author

roadbikemike commented May 25, 2023

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?

@travisghansen
Copy link
Owner

Perhaps. I’ll look deeper at some point. Just don’t have much time to put to the project currently :(

@roadbikemike
Copy link
Author

roadbikemike commented May 25, 2023

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).

@travisghansen
Copy link
Owner

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.

@roadbikemike
Copy link
Author

roadbikemike commented May 25, 2023

From what I can tell, this is the only way to gather thermal data programmatically at this time:

https://github.com/opnsense/core/blob/5d5e9579415c70d62e31876e4c649467f0db22b2/src/www/widgets/api/get.php

Which then references:

https://github.com/opnsense/core/blob/5d5e9579415c70d62e31876e4c649467f0db22b2/src/www/widgets/api/plugins/temperature.inc

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.

@travisghansen
Copy link
Owner

Right, but the way the integration works you can just tap into the latter directly.

@larhedse
Copy link

Any chance this might happen?

@3dRikal
Copy link

3dRikal commented Nov 1, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants