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

Battery Temperature reading from ioreg [Idea/Discussion] #71

Open
redoacs opened this issue Nov 6, 2018 · 1 comment
Open

Battery Temperature reading from ioreg [Idea/Discussion] #71

redoacs opened this issue Nov 6, 2018 · 1 comment

Comments

@redoacs
Copy link

redoacs commented Nov 6, 2018

Hi,

This is not really an issue with iStats it is just something i noticed and i thought that you are the guy to discuss this with.

I was curious about the battery temperature on my mac, and came across iStats (thanks for your work on it!). Reading the source code i noticed it uses ioreg -rn AppleSmartBattery for some measurements (i.e. capacities and cycles).

ioreg -rn AppleSmartBattery also returns a Temperature reading. Somewhere else i saw that the value is read as it was in Celsius * 100.

But that seems not quite in agreement with the iStats battery temperature, that as far as i can tell is read using SMC and the TB0T key.

So, i collected around 10 days of minute by minute simultaneous readings from both sources, the ioreg -rn AppleSmartBattery``Temperature and istats battery temperature, then i ran a linear regression using those values. And given the resulting coefficient and intercept, i have the theory that the ioreg -rn AppleSmartBattery Temperature reading is in tenths of Kelvin. Do you think that is possible?

What bothers me is that while the conversion is very good (.975 Rˆ2 with the tenths of kelvin to celsius conversion) it is not perfect, there are some different ioreg readings with the same istats value. That could be maybe that the sensor changed value before the second measurement was taken, they are technically not simultaneous. Or that they are coming from different sensors. If they come from different sensors, which is the one to trust?

Well, i hope you find this interesting and share your expert insights.

Thank you!

@xilopaint
Copy link

I think you're right. Converting the ioreg value in tenths of Kelvin to Celsius I get the exact same measure displayed by coconutBattery.

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

2 participants