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

  1. package variables
  2. import "git.aiterp.net/lucifer3/server/internal/gentools"
  3. type Variables struct {
  4. Temperature map[string]AvgMinMax `json:"temperature"`
  5. Motion map[string]AvgMinMax `json:"motion"`
  6. }
  7. func (v Variables) WithPropertyPatch(patch PropertyPatch) Variables {
  8. if patch.Motion != nil {
  9. v.Motion = gentools.CopyMap(v.Motion)
  10. v.Motion[patch.Key] = *patch.Motion
  11. }
  12. if patch.Temperature != nil {
  13. v.Temperature = gentools.CopyMap(v.Temperature)
  14. v.Temperature[patch.Key] = *patch.Temperature
  15. }
  16. return v
  17. }
  18. type AvgMinMax struct {
  19. Avg float64 `json:"avg"`
  20. Min float64 `json:"min"`
  21. Max float64 `json:"max"`
  22. }