Use input variables.

This commit is contained in:
Michael Lehmann
2025-02-18 23:00:14 +01:00
parent 5399bc9a8a
commit 977475806c
2 changed files with 4 additions and 2 deletions

View File

@@ -15,8 +15,10 @@ func TurnOn(ip string, port string, temperature int, dimming int) {
if err != nil {
panic("Unable to connect to light bulp!")
}
// Erstelle den JSON-String mit den übergebenen Parametern
jsonStr := fmt.Sprintf(`{"method": "setPilot", "params":{"state": true, "temp": %d, "dimming": %d}}`, temperature, dimming)
c.Write([]byte(`{"method": "setPilot", "params":{"state": true, "temp": 2700, "dimming": 100}}`))
c.Write([]byte(jsonStr))
}
func TurnOff(ip string, port string) {

View File

@@ -16,7 +16,7 @@ func main() {
return
}
//gin.SetMode(gin.ReleaseMode)
gin.SetMode(gin.ReleaseMode)
r := gin.Default()
r.LoadHTMLGlob("templates/*")