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.
27 lines
637 B
27 lines
637 B
package variables
|
|
|
|
import "git.aiterp.net/lucifer3/server/internal/gentools"
|
|
|
|
type Variables struct {
|
|
Temperature map[string]AvgMinMax `json:"temperature"`
|
|
Motion map[string]AvgMinMax `json:"motion"`
|
|
}
|
|
|
|
func (v Variables) WithPropertyPatch(patch PropertyPatch) Variables {
|
|
if patch.Motion != nil {
|
|
v.Motion = gentools.CopyMap(v.Motion)
|
|
v.Motion[patch.Key] = *patch.Motion
|
|
}
|
|
if patch.Temperature != nil {
|
|
v.Temperature = gentools.CopyMap(v.Temperature)
|
|
v.Temperature[patch.Key] = *patch.Temperature
|
|
}
|
|
|
|
return v
|
|
}
|
|
|
|
type AvgMinMax struct {
|
|
Avg float64 `json:"avg"`
|
|
Min float64 `json:"min"`
|
|
Max float64 `json:"max"`
|
|
}
|