Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
2ed4eca56c | |||
2e3cfb44f4 | |||
be8a4f3bca |
@ -85,6 +85,7 @@ func (aw *AmbientWeather) handleProviderRequest(
|
|||||||
|
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
w.Write([]byte(err.Error()))
|
w.Write([]byte(err.Error()))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate any fields that may be missing
|
// Calculate any fields that may be missing
|
||||||
|
@ -60,6 +60,7 @@ func MapAwnUpdate(awnUpdate *AmbientWeatherUpdate) *weather.WeatherUpdate {
|
|||||||
BattOutdoorSensor: awnUpdate.BattOut,
|
BattOutdoorSensor: awnUpdate.BattOut,
|
||||||
BattIndoorSensor: awnUpdate.BattIn,
|
BattIndoorSensor: awnUpdate.BattIn,
|
||||||
BattRainSensor: awnUpdate.BattRain,
|
BattRainSensor: awnUpdate.BattRain,
|
||||||
|
BattCO2Sensor: awnUpdate.BattCO2,
|
||||||
TempIndoorF: awnUpdate.TempInF,
|
TempIndoorF: awnUpdate.TempInF,
|
||||||
HumidityIndoor: awnUpdate.HumidityIn,
|
HumidityIndoor: awnUpdate.HumidityIn,
|
||||||
BaromRelativeIn: awnUpdate.BaromRelIn,
|
BaromRelativeIn: awnUpdate.BaromRelIn,
|
||||||
|
@ -27,4 +27,5 @@ type AmbientWeatherUpdate struct {
|
|||||||
BaromRelIn float64 `json:"baromrelin,omitempty" schema:"baromrelin"`
|
BaromRelIn float64 `json:"baromrelin,omitempty" schema:"baromrelin"`
|
||||||
BaromAbsIn float64 `json:"baromabsin,omitempty" schema:"baromabsin"`
|
BaromAbsIn float64 `json:"baromabsin,omitempty" schema:"baromabsin"`
|
||||||
BattIn int `json:"battin,omitempty" schema:"battin"`
|
BattIn int `json:"battin,omitempty" schema:"battin"`
|
||||||
|
BattCO2 int `json:"batt_co2,omitempty" schema:"batt_co2"`
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,10 @@ import "math"
|
|||||||
// Attempts to complete missing fields that may not
|
// Attempts to complete missing fields that may not
|
||||||
// be set by a specific provider, such as DewPoint and WindChill
|
// be set by a specific provider, such as DewPoint and WindChill
|
||||||
func (u *WeatherUpdate) Enrich() {
|
func (u *WeatherUpdate) Enrich() {
|
||||||
|
if u == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if u.WindChillF == 0 {
|
if u.WindChillF == 0 {
|
||||||
u.WindChillF = CalculateWindChill(u.TempOutdoorF, u.WindSpeedMPH)
|
u.WindChillF = CalculateWindChill(u.TempOutdoorF, u.WindSpeedMPH)
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ type WeatherUpdate struct {
|
|||||||
BattOutdoorSensor int
|
BattOutdoorSensor int
|
||||||
BattIndoorSensor int
|
BattIndoorSensor int
|
||||||
BattRainSensor int
|
BattRainSensor int
|
||||||
|
BattCO2Sensor int
|
||||||
BaromRelativeIn float64
|
BaromRelativeIn float64
|
||||||
BaromAbsoluteIn float64
|
BaromAbsoluteIn float64
|
||||||
// These fields may be calculated
|
// These fields may be calculated
|
||||||
|
Reference in New Issue
Block a user