calvinmclean/automated-garden

Getting RainData fails if WaterSchedule.Interval < 24h

Closed this issue · 0 comments

When WaterSchedule.Interval is 12h, GetRainData fails with error:

unable to get rain data from weather client: unable to read response body '{\"body\":[],\"status\":\"ok\",\"time_exec\":0.02210092544555664,\"time_server\":1668203473}': json: cannot unmarshal array into Go struct field weatherDataResponse.body of type map[string][]float32

This requires 2 changes:

  • Correctly handle empty data/array
  • Default to larger interval (like temperature control) or do not allow rain delays with such small intervals