This commit is contained in:
		| @@ -33,16 +33,21 @@ func (wu *WUProvider) ReqToWeather(_ context.Context, r *http.Request) ( | ||||
| } | ||||
|  | ||||
| func MapWUUpdate(wuUpdate *WundergroundUpdate) *weather.WeatherUpdate { | ||||
| 	updateTime, err := time.Parse(time.DateTime, wuUpdate.DateUTC) | ||||
| 	if err != nil { | ||||
| 		updateTime = time.Now() | ||||
| 	updateTime := time.Now() | ||||
|  | ||||
| 	if wuUpdate.DateUTC != nil { | ||||
| 		ut, err := time.Parse(time.DateTime, *wuUpdate.DateUTC) | ||||
| 		if err == nil { | ||||
| 			updateTime = ut | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return &weather.WeatherUpdate{ | ||||
| 		StationType:     wuUpdate.SoftwareType, | ||||
| 		DateUTC:         &updateTime, | ||||
| 		TempOutdoorF:           wuUpdate.Tempf, | ||||
| 		HumidityOudoor:        wuUpdate.Humidity, | ||||
| 		StationID:       wuUpdate.ID, | ||||
| 		StationType:     wuUpdate.SoftwareType, | ||||
| 		TempOutdoorF:    wuUpdate.Tempf, | ||||
| 		HumidityOudoor:  wuUpdate.Humidity, | ||||
| 		WindSpeedMPH:    wuUpdate.WindGustMPH, | ||||
| 		WindGustMPH:     wuUpdate.WindGustMPH, | ||||
| 		WindDir:         wuUpdate.WindDir, | ||||
|   | ||||
| @@ -1,29 +1,29 @@ | ||||
| package wunderground | ||||
|  | ||||
| type WundergroundUpdate struct { | ||||
| 	ID             string  `json:"ID,omitempty" schema:"ID"` | ||||
| 	Password       string  `json:"PASSWORD,omitempty" schema:"PASSWORD"` | ||||
| 	UV             int     `json:"UV,omitempty" schema:"UV"` | ||||
| 	Action         string  `json:"action,omitempty" schema:"action"` | ||||
| 	BaromIn        float64 `json:"baromin,omitempty" schema:"baromin"` | ||||
| 	DailyRainIn    float64 `json:"dailyrainin,omitempty" schema:"dailyrainin"` | ||||
| 	DateUTC        string  `json:"dateutc,omitempty" schema:"dateutc"` | ||||
| 	DewPtF         float64 `json:"dewptf,omitempty" schema:"dewptf"` | ||||
| 	Humidity       int     `json:"humidity,omitempty" schema:"humidity"` | ||||
| 	IndoorHumidity int     `json:"indoorhumidity,omitempty" schema:"indoorhumidity"` | ||||
| 	IndoorTempF    float64 `json:"indoortempf,omitempty" schema:"indoortempf"` | ||||
| 	LowBatt        bool    `json:"lowbatt,omitempty" schema:"lowbatt"` | ||||
| 	MonthlyRainIn  float64 `json:"monthlyrainin,omitempty" schema:"monthlyrainin"` | ||||
| 	RainIn         float64 `json:"rainin,omitempty" schema:"rainin"` | ||||
| 	Realtime       bool    `json:"realtime,omitempty" schema:"realtime"` | ||||
| 	Rtfreq         int     `json:"rtfreq,omitempty" schema:"rtfreq"` | ||||
| 	SoftwareType   string  `json:"softwaretype,omitempty" schema:"softwaretype"` | ||||
| 	SolarRadiation float64 `json:"solarradiation,omitempty" schema:"solarradiation"` | ||||
| 	Tempf          float64 `json:"tempf,omitempty" schema:"tempf"` | ||||
| 	WeeklyRainIn   float64 `json:"weeklyrainin,omitempty" schema:"weeklyrainin"` | ||||
| 	WindChillF     float64 `json:"windchillf,omitempty" schema:"windchillf"` | ||||
| 	WindDir        int     `json:"winddir,omitempty" schema:"winddir"` | ||||
| 	WindGustMPH    float64 `json:"windgustmph,omitempty" schema:"windgustmph"` | ||||
| 	WindSpeedMPH   float64 `json:"windspeedmph,omitempty" schema:"windspeedmph"` | ||||
| 	YearlyRainIn   float64 `json:"yearlyrainin,omitempty" schema:"yearlyrainin"` | ||||
| 	ID             *string  `json:"ID,omitempty" schema:"ID"` | ||||
| 	Password       *string  `json:"PASSWORD,omitempty" schema:"PASSWORD"` | ||||
| 	UV             *int     `json:"UV,omitempty" schema:"UV"` | ||||
| 	Action         *string  `json:"action,omitempty" schema:"action"` | ||||
| 	BaromIn        *float64 `json:"baromin,omitempty" schema:"baromin"` | ||||
| 	DailyRainIn    *float64 `json:"dailyrainin,omitempty" schema:"dailyrainin"` | ||||
| 	DateUTC        *string  `json:"dateutc,omitempty" schema:"dateutc"` | ||||
| 	DewPtF         *float64 `json:"dewptf,omitempty" schema:"dewptf"` | ||||
| 	Humidity       *int     `json:"humidity,omitempty" schema:"humidity"` | ||||
| 	IndoorHumidity *int     `json:"indoorhumidity,omitempty" schema:"indoorhumidity"` | ||||
| 	IndoorTempF    *float64 `json:"indoortempf,omitempty" schema:"indoortempf"` | ||||
| 	LowBatt        *bool    `json:"lowbatt,omitempty" schema:"lowbatt"` | ||||
| 	MonthlyRainIn  *float64 `json:"monthlyrainin,omitempty" schema:"monthlyrainin"` | ||||
| 	RainIn         *float64 `json:"rainin,omitempty" schema:"rainin"` | ||||
| 	Realtime       *bool    `json:"realtime,omitempty" schema:"realtime"` | ||||
| 	Rtfreq         *int     `json:"rtfreq,omitempty" schema:"rtfreq"` | ||||
| 	SoftwareType   *string  `json:"softwaretype,omitempty" schema:"softwaretype"` | ||||
| 	SolarRadiation *float64 `json:"solarradiation,omitempty" schema:"solarradiation"` | ||||
| 	Tempf          *float64 `json:"tempf,omitempty" schema:"tempf"` | ||||
| 	WeeklyRainIn   *float64 `json:"weeklyrainin,omitempty" schema:"weeklyrainin"` | ||||
| 	WindChillF     *float64 `json:"windchillf,omitempty" schema:"windchillf"` | ||||
| 	WindDir        *int     `json:"winddir,omitempty" schema:"winddir"` | ||||
| 	WindGustMPH    *float64 `json:"windgustmph,omitempty" schema:"windgustmph"` | ||||
| 	WindSpeedMPH   *float64 `json:"windspeedmph,omitempty" schema:"windspeedmph"` | ||||
| 	YearlyRainIn   *float64 `json:"yearlyrainin,omitempty" schema:"yearlyrainin"` | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user