From f4b289f745e84e121814c3d35487becac9416043 Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Tue, 18 Aug 2026 12:02:29 +0200 Subject: [PATCH] Sponsor: include device serial in hardware check metadata (#32927) --- util/sponsor/hemspro_linux.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/util/sponsor/hemspro_linux.go b/util/sponsor/hemspro_linux.go index c2e3d144e..7180441af 100644 --- a/util/sponsor/hemspro_linux.go +++ b/util/sponsor/hemspro_linux.go @@ -20,11 +20,23 @@ package sponsor // SOFTWARE. import ( + "os" + "strings" + i2c "github.com/d2r2/go-i2c" ) const hemspro = "hemspro" +// deviceSerial returns the device tree serial number or empty string +func deviceSerial() string { + b, err := os.ReadFile("/sys/firmware/devicetree/base/serial-number") + if err != nil { + return "" + } + return strings.TrimSpace(strings.Trim(string(b), "\x00")) +} + // checkHemsPro checks if the hardware is a supported HEMS Pro device and returns sponsor subject func checkHemsPro() string { const ( @@ -49,5 +61,7 @@ func checkHemsPro() string { } // I2C succeeded — verify with server - return checkHardware(hemspro, nil) + return checkHardware(hemspro, map[string]string{ + "serial": deviceSerial(), + }) }