The officially official Devuan Forum!

You are not logged in.

#1 2020-11-23 10:09:22

dice
Member
Registered: 2020-11-22
Posts: 346  
Website

Conky + sensors temp settings ?

Hi, anyone able to help with an issue i have with conky hwmon sensor readings?

I dont leave my computer on constantly so it gets turned off after im finished with it and upon booting it up i get a hwmon sensor temp reading sometimes and other times i dont.

What is happening is /sys/class/hwmon1 and 2 keep switching in sensors.

eg; These two values keep switching over reboots, so i would have to change conkyrc hwmon 1 temp 2 to hwmon 2 temp 2 and vice versa.

 cat /sys/class/hwmon/hwmon1/
device/      name         power/       subsystem/   temp1_input  uevent
cat /sys/class/hwmon/hwmon2/
device/           subsystem/        temp1_input       temp2_crit        temp2_label       temp3_crit_alarm  temp3_max         temp4_input       temp5_crit        temp5_label
name              temp1_crit        temp1_label       temp2_crit_alarm  temp2_max         temp3_input       temp4_crit        temp4_label       temp5_crit_alarm  temp5_max
power/            temp1_crit_alarm  temp1_max         temp2_input       temp3_crit        temp3_label       temp4_crit_alarm  temp4_max         temp5_input       uevent

This is what cpu temp looks like in conkyrc via dzen2

https://pastebin.com/raw/UvuT1Xmv

Last edited by dice (2020-11-23 10:18:25)


Do good things.  Share.  Be helpful.  Be decent.  Live large.

Offline

#2 2020-11-23 12:13:57

steve_v
Member
Registered: 2018-01-11
Posts: 72  

Re: Conky + sensors temp settings ?

dice wrote:

What is happening is /sys/class/hwmon1 and 2 keep switching in sensors.

I don't have equivalent hardware so I can't check (exact names will differ), but my approach would be either:
a) If hwmon1 and hwmon2 are handled by different drivers, go see how and when they are loaded. They'll be getting an index based on which module loads first, so if you can fix the load order they should always get the same name.
b) See if there's another usable source, such as conky's {acpitemp} object or a node in e.g. /sys/class/thermal.
c) Get the values externally. IIRC conky can call external binaries, so you should be able to use lm-sensors with something like:

${execi 10 sensors | grep "Package id 0" | cut -d'+' -f2 | cut -c1-7}

"Package id 0" is from the intel coretemp driver so your sensor name will probably differ, but it should still be easily grepable.

It shouldn't be difficult to search through the /sys/class/hwmon[x]/name files for the sensor you want in a bash script either, push comes to shove.

Last edited by steve_v (2020-11-23 12:20:12)


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#3 2020-11-23 13:05:24

dice
Member
Registered: 2020-11-22
Posts: 346  
Website

Re: Conky + sensors temp settings ?

Hi steve_v

thanks for your input. I think you may be right about what modules are getting loaded first, currently im not at that computer but will have a dig around and see if i can debug it asap.

The machine has an intel cpu with integrated graphics, it has sensors detect for acpi, cpu, graphics and the wifi card, so it is definitely possible it is a modules load issue.


Do good things.  Share.  Be helpful.  Be decent.  Live large.

Offline

#4 2020-11-24 08:37:58

dice
Member
Registered: 2020-11-22
Posts: 346  
Website

Re: Conky + sensors temp settings ?

I dont understand why but hwmon seems to be a moving target, also not sure if im listing modules correctly in /etc/modules as per below too see if this would fix it doesnt, the only other like you say steve is i think making a script up. Ive found that cat /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp2_input | cut -c-2 seems to be consistent enough for execi in conky.

NB: ive added all the modules below except for coretemp which sensors-detect do, i dont think order here really matters though?

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

# Generated by sensors-detect on Tue Nov 24 17:47:49 2020
# Chip drivers
iwlwifi
cfg80211
mac80211
coretemp
acpitz

Last edited by dice (2020-11-24 08:39:28)


Do good things.  Share.  Be helpful.  Be decent.  Live large.

Offline

#5 2020-11-24 19:07:01

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 1,530  
Website

Re: Conky + sensors temp settings ?


Black Lives Matter

Offline

#6 2020-11-25 07:21:13

dice
Member
Registered: 2020-11-22
Posts: 346  
Website

Re: Conky + sensors temp settings ?

If the solution in that thread was ${platform coretemp.0 temp 1} my conky dzen2 says no such file,

conky: can't open '/sys/bus/platform/devices/coretemp.0/temp1_input': No such file or directory please check your device or remove this var from conky 

However it shows up as

cat /sys/bus/platform/devices/coretemp.0/hwmon/hwmon1/temp1_input

Maybe conky is looking in the wrong directory for that variable?

Last edited by dice (2020-11-25 07:25:29)


Do good things.  Share.  Be helpful.  Be decent.  Live large.

Offline

#7 2020-12-02 10:56:19

dice
Member
Registered: 2020-11-22
Posts: 346  
Website

Re: Conky + sensors temp settings ?

I found a really nice script for use with lm_sensors, way beyond my scripting abilities, all credit to the author whoever it is.

If you want this in °F you need to add an -f to sensors in the script and change out the celcius parts, i did it the other way around as this script was for °F originally.

needs bc package if you havent already installed it.

#!/bin/bash

# 1. get temperature

## a. split response
## Core 0:        +48.0°C  (high = +105.0°C, crit = +105.0°C)
IFS=')' read -ra core_temp_arr <<< $(sensors | grep '^Core\s[[:digit:]]\+:') #echo "${core_temp_arr[0]}"

## b. find cpu usage
total_cpu_temp=0
index=0
for i in "${core_temp_arr[@]}"; do :
    temp=$(echo $i | sed -n 's/°C.*//; s/.*[+-]//; p; q')
    let index++
    total_cpu_temp=$(echo "$total_cpu_temp + $temp" | bc)
done
avg_cpu_temp=$(echo "scale=2; $total_cpu_temp / $index" | bc)

## c. build entry
temp_status="CPU: $avg_cpu_temp °C"
echo $temp_status

exit 0

source: https://stackoverflow.com/questions/506 … -from-bash

Last edited by dice (2020-12-02 10:58:08)


Do good things.  Share.  Be helpful.  Be decent.  Live large.

Offline

#8 2020-12-02 11:05:52

fsmithred
Administrator
Registered: 2016-11-25
Posts: 1,835  

Re: Conky + sensors temp settings ?

I like seeing the individual core temps. Here's the line I'm using:

${execi 8 sensors | awk '/Core/ { printf substr($3,2,2)" " }'}

and the output looks like this:

CPU: 42 36 40 41

Offline

#9 2020-12-02 12:49:29

dice
Member
Registered: 2020-11-22
Posts: 346  
Website

Re: Conky + sensors temp settings ?

fsmithred wrote:

I like seeing the individual core temps. Here's the line I'm using:

${execi 8 sensors | awk '/Core/ { printf substr($3,2,2)" " }'}

and the output looks like this:

CPU: 42 36 40 41

That is a good one, i like to see the individual cores as well and this solves my issue with hwmon moving around. Thanks


Do good things.  Share.  Be helpful.  Be decent.  Live large.

Offline

Board footer