-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels_weather.go
53 lines (46 loc) · 1.2 KB
/
models_weather.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package tado
import (
"fmt"
"net/http"
"time"
)
// Weather is the weather info for a home
type Weather struct {
SolarIntensity struct {
Type string `json:"type"`
Percentage float64 `json:"percentage"`
Timestamp time.Time `json:"timestamp"`
} `json:"solarIntensity"`
OutsideTemperature struct {
Celsius float64 `json:"celsius"`
Fahrenheit float64 `json:"fahrenheit"`
Timestamp time.Time `json:"timestamp"`
Type string `json:"type"`
Precision struct {
Celsius float64 `json:"celsius"`
Fahrenheit float64 `json:"fahrenheit"`
} `json:"precision"`
} `json:"outsideTemperature"`
WeatherState struct {
Type string `json:"type"`
Value string `json:"value"`
Timestamp time.Time `json:"timestamp"`
} `json:"weatherState"`
}
// GetWeatherInput is the input for GetWeather
type GetWeatherInput struct {
HomeID int
}
func (gwi *GetWeatherInput) method() string {
return http.MethodGet
}
func (gwi *GetWeatherInput) path() string {
return fmt.Sprintf("/v2/homes/%d/weather", gwi.HomeID)
}
func (gwi *GetWeatherInput) body() interface{} {
return nil
}
// GetWeatherOutput is the output for GetWeather
type GetWeatherOutput struct {
Weather
}