Replies: 4 comments 4 replies
-
I'd like to know that too |
Beta Was this translation helpful? Give feedback.
-
Hi, I did it by adding in sensors_custom.py the code below. Maybe you have to adjust the sensor Name search depending on what you can see in the LibreHardwareMonitor report (check sensors_custom wiki)
After that you can simply use them in the theme.yaml with something like that :
|
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the help, I don't know anything about it, I'm just a regular
PC user. I don't know why I didn't want to go, in the end I made a mistake
and put it in the pile somehow. Thank you for the muster and sorry for the
English, it's through a translator.
class GpuNvidia(CustomDataSource):
def as_numeric(self) -> float:
gpu = get_hw_and_update(Hardware.HardwareType.GpuNvidia)
for sensor in gpu.Sensors:
if "Package" in str(sensor.Name) :
return float(sensor.Value)
#return float(50)
logger.error("GPU Nvidia fan percent cannot be read")
return math.nan
def as_string(self) -> str:
return f'{int(self.as_numeric())}w'
def as_histo(self) -> list[float]:
pass
class CpuPower(CustomDataSource):
def as_numeric(self) -> float:
cpu = get_hw_and_update(Hardware.HardwareType.Cpu)
for sensor in cpu.Sensors:
if sensor.SensorType == Hardware.SensorType.Power:
return float(sensor.Value)
#return float(50)
logger.error("CPU Power cannot be read")
return math.nan
def as_string(self) -> str:
return f'{int(self.as_numeric())}w'
def as_histo(self) -> list[float]:
pass
…---------- Původní e-mail ----------
Od: Queven ***@***.***>
Komu: mathoudebine/turing-smart-screen-python <turing-smart-screen-python@
noreply.github.com>
Kopie: Ladik12345 ***@***.***>, Comment ***@***.***
github.com>
Datum: 5. 2. 2024 13:58:01
Předmět: Re: [mathoudebine/turing-smart-screen-python] How to monitor the
power of CPU/GPU in watts with this software. Or is that possible?
(Discussion #248)
"
This is my sensrs_custom.py file. Probably it can be done better but I do
not programing in python.
`# turing-smart-screen-python - a Python system monitor and library for USB-
C displays like Turing Smart Screen or XuanFang
https://github.com/mathoudebine/turing-smart-screen-python/
(https://github.com/mathoudebine/turing-smart-screen-python/)
import math
Copyright (C) 2021-2023 Matthieu Houdebine (mathoudebine)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/
(https://www.gnu.org/licenses/).
This file allows to add custom data source as sensors and display them in
System Monitor themes
There is no limitation on how much custom data source classes can be added
to this file
See CustomDataExample theme for the theme implementation part
import platform
from abc import ABC, abstractmethod
from library.sensors.sensors_librehardwaremonitor import get_hw_and_update
from library.log import logger
from LibreHardwareMonitor import Hardware
Custom data classes must be implemented in this file, inherit the
CustomDataSource and implement its 2 methods
class CustomDataSource(ABC):
@AbstractMethod(https://github.com/AbstractMethod)
def as_numeric(self) -> float:
# Numeric value will be used for graph and radial progress bars
# If there is no numeric value, keep this function empty
pass
<code ***@***.***
def as_string(self) -> str:
# Text value will be used for text display and radial progress bar inner text
# Numeric value can be formatted here to be displayed as expected
# It is also possible to return a text unrelated to the numeric value
# If this function is empty, the numeric value will be used as string without formatting
pass
</code>
Example for a custom data class that has numeric and text values
class ExampleCustomNumericData(CustomDataSource):
def as_numeric(self) -> float:
# Numeric value will be used for graph and radial progress bars
# Here a Python function from another module can be called to get data
# Example: return my_module.get_rgb_led_brightness() / return audio.system_
volume() ...
return 75.845
<code class='-wm-notranslate'>def as_string(self) -> str:
# Text value will be used for text display and radial progress bar inner text.
# Numeric value can be formatted here to be displayed as expected
# It is also possible to return a text unrelated to the numeric value
# If this function is empty, the numeric value will be used as string without formatting
# Example here: format numeric value: add unit as a suffix, and keep 1 digit decimal precision
return f'{self.as_numeric(): .1f}%'
# Important note! If your numeric value can vary in size, be sure to display it with a default size.
# E.g. if your value can range from 0 to 9999, you need to display it with at least 4 characters every time.
# --> return f'{self.as_numeric():>4}%'
# Otherwise, part of the previous value can stay displayed ("ghosting") after a refresh
</code>
Example for a custom data class that only has text values
class ExampleCustomTextOnlyData(CustomDataSource):
def as_numeric(self) -> float:
# If there is no numeric value, keep this function empty
pass
<code class='-wm-notranslate'>def as_string(self) -> str:
# If a custom data class only has text values, it won't be possible to display graph or radial bars
return "Python version: " + platform.python_version()
</code>
class GPUPOWER(CustomDataSource):
def as_numeric(self) -> float:
<code class='-wm-notranslate'> gpu = get_hw_and_update(Hardware.HardwareType.GpuNvidia)
for sensor in gpu.Sensors:
if "Package" in str(sensor.Name):
return float(sensor.Value)
logger.error("GPU Power cannot be read")
return math.nan
def as_string(self) -> str:
return f'{int(self.as_numeric()):>3} W'
</code>
class CPUPOWER(CustomDataSource):
def as_numeric(self) -> float:
cpu = get_hw_and_update(Hardware.HardwareType.Cpu)
for sensor in cpu.Sensors:
if "CPU Package" in str(sensor.Name) and sensor.SensorType == Hardware.
SensorType.Power:
return float(sensor.Value)
<code class='-wm-notranslate'> logger.error("CPU Power cannot be read")
return math.nan
def as_string(self) -> str:
return f'{int(self.as_numeric()):>3} W'
</code>
`
—
Reply to this email directly, view it on GitHub
(#248 (comment))
, or unsubscribe
(https://github.com/notifications/unsubscribe-auth/BFMGDMOB4U3G6WEJOLIM6YTYSDJNJAVCNFSM6AAAAAAYSOV4CCVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DGNRZHA2TI)
.
You are receiving this because you commented. Message ID: <mathoudebine/
***@***.***>
"
|
Beta Was this translation helpful? Give feedback.
-
Hello, I tryied to retrieve GPU HotSpot temperature from LHW by adding this small code lines to sensors_custom.py:
But I got this error, seems sensors_librehardwaremonitor.py is not charged atm...
Has anything changed since the new updates about this? Using 3.5.0 version. Thank's. |
Beta Was this translation helpful? Give feedback.
-
Hi, I recently bought this set of small monitor screens because I enjoy monitoring the hardware status of my computer.
However, I noticed that none of the default themes have the ability to display CPU and GPU power in watts.
I was wondering if this alternative software can achieve that?
I understand that I can find all the available items in the theme examples, but it seems that power is not included.
Is it possible to add power monitoring?
Or is this item not capturing power values at the core level?
Can you help me with how to proceed?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions