ultrabug / py3status

py3status is an extensible i3status wrapper written in python

Home Page:https://ultrabug.github.io/py3status/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Manually determine output order of lm_sensors

mlmatlock opened this issue · comments

How can we help you today?
Trying to get a more ordered output of lm_sensors

Your py3status version
py3status version 3.54 (python 3.11.6) on sway

Share your configuration
sensors -u

Module config:

lm_sensors {
    format_chip = '[\?if=name=drivetemp-scsi-0-0 sda: ]'
    format_chip += '[\?if=name=drivetemp-scsi-2-0 sdb: ]'
    format_chip += '[\?if=name=drivetemp-scsi-4-0 sdc: ]'
    format_chip += '{format_sensor}'
    format_sensor = '[\?if=name=motherboard MoBo: ]'
    format_sensor += '[\?if=name=cpu CPU: ]'
    format_sensor += '[\?if=name=edge GPU: ]'
    format_sensor += '[\?if=name=composite NVMe: ]'
    format_sensor += '[\?color=auto.input {input}°C]'
    sensors = ['composite', 'edge', 'motherboard', 'cpu', 'samsung*', 'hitachi*', 'input']
    }

Additional context
The output is taken straight down the sensor list

20231227_09h28m01s_grim

Would really like to sort the output.

@lasers, tagging you as the module author. :)

Can we get your sensors -j too? Yeah, I can see how that's annoying.

Here you go:

sensors -j

You likely can run lm_sensors module twice. First one for sda stuff. Second one for other stuff. That's the current solution right now. I'll look into this issue in the future.

Try specifying ordered chips in chips = []. See if that works. (Untested)

EDIT: It may be something like... chips = ["drivetemp-scsi-*-*", "nct6793-isa-*", "coretemp-isa-*", "nvme-pci-*"] to rearrange output from sensors -j so the drivetemp chips comes out first before the other chips.

You likely can run lm_sensors module twice. First one for sda stuff. Second one for other stuff. That's the current solution right now.

This is what I started with:

 lm_sensors {
    format_chip = '{format_sensor}'
    format_sensor = '[\?if=name=motherboard MoBo: ]'
    format_sensor += '[\?if=name=cpu CPU: ]'
    format_sensor += '[\?if=name=edge GPU: ]'
    format_sensor += '[\?if=name=composite NVMe: ]'
    format_sensor += '[\?color=auto.input {input:.0f}°C]'
    sensors = ['composite', 'edge', 'motherboard', 'cpu']
    }
    lm_sensors {
    format_chip = '[\?if=name=drivetemp-scsi-0-0 sda: ]'
    format_chip += '[\?if=name=drivetemp-scsi-2-0 sdb: ]'
    format_chip += '[\?if=name=drivetemp-scsi-4-0 sdc: ]'
    format_chip += '{format_sensor}'
    format_sensor = '[\?color=auto.input {input}°C]'
    sensors = ['samsung*', 'hitachi*', 'input']
    }

20231227_17h20m21s_grim

Was trying for colorized output for all temps.

It sounds like you got bit by #1927 if using multiple instances.

What about specifying ordered chips (comment above)?
EDIT: Scratch that. It looks like sensors -j doesn't output correctly with chips if specified more than one.
ISSUE: https://github.com/lm-sensors/lm-sensors/issues/372

It sounds like you got bit by #1927 if using multiple instances.

What about specifying ordered chips (comment above)? EDIT: Scratch that. It looks like sensors -j doesn't output correctly with chips if specified more than one. ISSUE: https://github.com/lm-sensors/lm-sensors/issues/372

Yeah, #1927 is me.

Wondering if the JSON output could be sorted by sensor?

Wondering if the JSON output could be sorted by sensor?

It already does. It just didn't come out right. I made a PR. Talk there.

Version 3.55 is out!