hacompanion
hacompanion copied to clipboard
Tempature not shown
I got hacompanion running on my raspberry pi vm server (mouse) and my primary laptop. (Blue-mage)
But tempature is not shown. Perhaps its configuration but i dont see any configuration mentions in the readme.
Btw you closed #15 the quote was there because i 1st tryed to run it with out the listener. I think it runs port 80 it there is no configuration so you cant turn off the listener.
The Regex to parse the cpu temp currently only looks fore core
or Package id
but not for CPU
, this could be easily fixed:
https://github.com/tobias-kuendig/hacompanion/blob/d7b3431aa96bef742700311d0a44c64545c12318/sensor/cpu.go#L19
I fixed this on my Pi with this change
--- a/sensor/cpu.go
+++ b/sensor/cpu.go
@@ -16,7 +16,7 @@ import (
)
var (
- reCPUTemp = regexp.MustCompile(`(?m)(Package id|Core \d)[\s\d]*:\s+.?([\d\.]+)°`)
+ reCPUTemp = regexp.MustCompile(`(?m)(temp1|Package id|Core \d)[\s\d]*:\s+.?([\d\.]+)°`)
reCPUUsage = regexp.MustCompile(`(?m)^\s*cpu(\d+)?.*`)
)
@@ -54,7 +54,7 @@ func (c CPUTemp) process(output string) (*entity.Payload, error) {
if len(match) < 3 {
return nil, fmt.Errorf("invalid output form lm-sensors received: %s", output)
}
- if strings.EqualFold(match[1], "Package id") {
+ if strings.EqualFold(match[1], "Package id") || strings.EqualFold(match[1], "temp1") {
p.State = match[2]
} else {
p.Attributes[util.ToSnakeCase(match[1])] = match[2]
how do i build a go project? i tried go build but that did not work.
You can try the steps here: https://github.com/jackyaz/hacompanion#installation
Depending on your platform, you may need to install a newer version of Go than provided by your package manager. https://go.dev/doc/install
strange i compiled it for my amd64 it works. but when i crosscompiled it for my PI it did not work. program runs cpu not shown.
Was that compiling my fork or this one? I didn't cross-compile, I built it on the Pi directly
Did not run on pi correctly due to configuration all is fine now.
Have this issue on PopOS:
pop-os hacompanion[43608]: 2023/09/25 15:41:13 received Payload for cpu_temp: &{Icon: State:<nil> Attributes:map[]}
Just opened a PR that will probably fix that: #38
fixed in #38