fix messages

This commit is contained in:
2026-02-08 03:38:57 +01:00
parent 65fed65bf2
commit 27517bd2ea

View File

@@ -56,13 +56,13 @@ func (s *DeviceState) handleWriteCommand(cmd string) string {
return "ERRORE: I comandi 'W' sono accettati solo in modalità programmazione." return "ERRORE: I comandi 'W' sono accettati solo in modalità programmazione."
} }
// Parse command format: "W<id> <value>" // Parse command format: "W<id>=<value>"
parts := strings.Fields(cmd) parts := strings.SplitN(cmd, "=", 2)
if len(parts) != 2 { if len(parts) != 2 {
return "ERRORE: Formato comando non valido" return "ERRORE: Formato comando non valido"
} }
// Extract parameter ID // Extract parameter ID (remove "W" prefix from first part)
idStr := strings.TrimPrefix(parts[0], "W") idStr := strings.TrimPrefix(parts[0], "W")
id, err := strconv.Atoi(idStr) id, err := strconv.Atoi(idStr)
if err != nil { if err != nil {