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: show temperature, power, fan sensors #93

Closed
robjtede opened this issue Dec 1, 2016 · 6 comments
Closed

feature: show temperature, power, fan sensors #93

robjtede opened this issue Dec 1, 2016 · 6 comments

Comments

@robjtede
Copy link

robjtede commented Dec 1, 2016

Not sure how difficult this would be.
Can't seem to find a built in way of doing it.

@rgcr
Copy link
Owner

rgcr commented Dec 3, 2016

Good idea, I think it should be easy

@pbnj
Copy link
Contributor

pbnj commented Dec 4, 2016

@rgcr - I've done some research and I can't seem to find any evidence that this is possible natively.

The closest thing I found were a few third-party apps and one ruby app (iStats) that leverages this C project.

Either way, seems like you would need to rely on third-party dependencies to achieve this.

@rgcr
Copy link
Owner

rgcr commented Dec 5, 2016

Yea, I think it is more difficult than I had expected.
We can know the fan speed running sudo spindump 1 1 -nofile -stdout | grep -i 'fan speed'
I'll keep looking for information about how to do it natively, there must be something.

@paxperscientiam
Copy link
Contributor

paxperscientiam commented Jul 20, 2021

@rgcr If you'd like an average of three samples:

a=($(sudo powermetrics -s smc -n 3 -i 200 |grep -i 'fan' | grep -Eo '[0-9]+'))
echo $'('$(IFS='+';echo "${a[*]// /+}";IFS=$' \t\n')$')/3' | bc
# OR math like this without bc:
echo $(( ($(IFS='+';echo "${a[*]// /+}";IFS=$' \t\n')) / 3))

For a single measurement:

sudo powermetrics -s smc -n 1 -i 200 |grep -i 'fan' | grep -Eo '[0-9]+'

I can make a PR if you like this approach, but let me know which you prefer.

EDIT: One caveat, it seems that both powermetrics and sysctl are limited when running off of battery power.

EDIT2: Third way (single value)

sudo powermetrics -s smc -n 1 -i 200 -f plist | plutil -extract 'smc.fan' xml1 -o - - | plutil -p -

@bensleveritt
Copy link
Collaborator

bensleveritt commented Oct 18, 2021

Thanks to @paxperscientiam we have fan speed, waiting to be released.

As this issue has been around a long time, I'll close for now. If we find a way to do the other items, we'll open issues/PRs for them separately

@paxperscientiam
Copy link
Contributor

@bensleveritt awesome!!

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

No branches or pull requests

5 participants