Possible "fix" for #69
This commit is contained in:
parent
33dc5d0185
commit
8f0ac4bdb6
@ -76,6 +76,8 @@ next
|
|||||||
audio is muted.
|
audio is muted.
|
||||||
* `parcel`_: added support for Itella (Finnish national postal service)
|
* `parcel`_: added support for Itella (Finnish national postal service)
|
||||||
* `network`_: detached_down is now True by default
|
* `network`_: detached_down is now True by default
|
||||||
|
* `temp`_: removed color_critical and high_factor options
|
||||||
|
* `temp`_: fixed issue with Linux kernels 3.15 and newer
|
||||||
|
|
||||||
3.29
|
3.29
|
||||||
++++
|
++++
|
||||||
@ -692,7 +694,7 @@ Settings:
|
|||||||
:host: (default: ``localhost``)
|
:host: (default: ``localhost``)
|
||||||
:port: MPD port (default: ``6600``)
|
:port: MPD port (default: ``6600``)
|
||||||
:format: formatp string (default: ``{title} {status}``)
|
:format: formatp string (default: ``{title} {status}``)
|
||||||
:status: Dictionary mapping pause, play and stop to output (default: ``{'play': '▶', 'pause': '▷', 'stop': '◾'}``)
|
:status: Dictionary mapping pause, play and stop to output (default: ``{'play': '▶', 'stop': '◾', 'pause': '▷'}``)
|
||||||
:interval: (default: ``1``)
|
:interval: (default: ``1``)
|
||||||
|
|
||||||
|
|
||||||
@ -884,10 +886,8 @@ AMD is currently not supported as they can only report a relative temperature, w
|
|||||||
|
|
||||||
Settings:
|
Settings:
|
||||||
|
|
||||||
:format: format string used for output. {temp} is the temperature in degrees celsius, {critical} and {high} are the trip point temps. (default: ``{temp} °C``)
|
:format: format string used for output. {temp} is the temperature in degrees celsius (default: ``{temp} °C``)
|
||||||
:color: (default: ``#FFFFFF``)
|
:color: (default: ``#FFFFFF``)
|
||||||
:color_critical: (default: ``#FF0000``)
|
|
||||||
:high_factor: (default: ``0.7``)
|
|
||||||
:interval: (default: ``5``)
|
:interval: (default: ``5``)
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ next
|
|||||||
audio is muted.
|
audio is muted.
|
||||||
* `parcel`_: added support for Itella (Finnish national postal service)
|
* `parcel`_: added support for Itella (Finnish national postal service)
|
||||||
* `network`_: detached_down is now True by default
|
* `network`_: detached_down is now True by default
|
||||||
|
* `temp`_: removed color_critical and high_factor options
|
||||||
|
* `temp`_: fixed issue with Linux kernels 3.15 and newer
|
||||||
|
|
||||||
3.29
|
3.29
|
||||||
++++
|
++++
|
||||||
|
@ -13,42 +13,20 @@ class Temperature(IntervalModule):
|
|||||||
|
|
||||||
settings = (
|
settings = (
|
||||||
("format",
|
("format",
|
||||||
"format string used for output. {temp} is the temperature in degrees celsius, {critical} and {high} are the trip point temps."),
|
"format string used for output. {temp} is the temperature in degrees celsius"),
|
||||||
"color", "color_critical", "high_factor"
|
"color",
|
||||||
)
|
)
|
||||||
format = "{temp} °C"
|
format = "{temp} °C"
|
||||||
high_factor = 0.7
|
|
||||||
color = "#FFFFFF"
|
color = "#FFFFFF"
|
||||||
color_high = "#FFFF00"
|
|
||||||
color_critical = "#FF0000"
|
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
self.base_path = "/sys/devices/platform/coretemp.0"
|
self.file = "/sys/class/thermal/thermal_zone0/temp"
|
||||||
input = glob.glob(
|
|
||||||
"{base_path}/temp*_input".format(base_path=self.base_path))[0]
|
|
||||||
self.input = re.search("temp([0-9]+)_input", input).group(1)
|
|
||||||
self.base_path = "{base_path}/temp{input}_".format(
|
|
||||||
base_path=self.base_path, input=self.input)
|
|
||||||
|
|
||||||
with open("{base_path}crit".format(base_path=self.base_path), "r") as f:
|
|
||||||
self.critical = float(f.read().strip()) / 1000
|
|
||||||
self.high = self.critical * self.high_factor
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
with open("{base_path}input".format(base_path=self.base_path), "r") as f:
|
with open(self.file, "r") as f:
|
||||||
temp = float(f.read().strip()) / 1000
|
temp = float(f.read().strip()) / 1000
|
||||||
|
|
||||||
urgent = False
|
|
||||||
color = self.color
|
|
||||||
if temp >= self.critical:
|
|
||||||
urgent = True
|
|
||||||
color = self.color_critical
|
|
||||||
elif temp >= self.high:
|
|
||||||
urgent = True
|
|
||||||
color = self.color_high
|
|
||||||
|
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": self.format.format(temp=temp, critical=self.critical, high=self.high),
|
"full_text": self.format.format(temp=temp),
|
||||||
"urgent": urgent,
|
"color": self.color,
|
||||||
"color": color,
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user