ultrabug / py3status

py3status is an extensible i3status wrapper written in python
https://ultrabug.github.io/py3status/
BSD 3-Clause "New" or "Revised" License
893 stars 261 forks source link

Manually determine output order of lm_sensors #2224

Closed mlmatlock closed 8 months ago

mlmatlock commented 9 months ago

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

lasers commented 9 months ago

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

mlmatlock commented 9 months ago

Here you go:

sensors -j

lasers commented 9 months ago

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.

lasers commented 9 months ago

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.

mlmatlock commented 9 months ago

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.

lasers commented 9 months ago

It sounds like you got bit by https://github.com/ultrabug/py3status/issues/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

mlmatlock commented 9 months ago

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?

lasers commented 9 months ago

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.

ultrabug commented 8 months ago

Version 3.55 is out!