You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package device
import ( "fmt" "git.aiterp.net/lucifer3/server/internal/color" "strings" )
type State struct { Power *bool `json:"power"` Temperature *float64 `json:"temperature"` Intensity *float64 `json:"intensity"` Color *color.Color `json:"color"` }
func (d State) String() string { parts := make([]string, 0, 4) if d.Power != nil { parts = append(parts, fmt.Sprintf("power:%t", *d.Power)) } if d.Temperature != nil { parts = append(parts, fmt.Sprintf("temperature:%f", *d.Temperature)) } if d.Intensity != nil { parts = append(parts, fmt.Sprintf("intensity:%.2f", *d.Intensity)) } if d.Color != nil { parts = append(parts, fmt.Sprintf("color:%s", d.Color.String())) }
return fmt.Sprint("(", strings.Join(parts, ", "), ")") }
type PresenceState struct { Present bool `json:"present"` AbsenceSeconds float64 `json:"absenceSeconds,omitempty"` }
|