continue working on weather mapping
This commit is contained in:
@ -25,25 +25,44 @@ func UpdateToPbUpdate(u *weather.WeatherUpdate) *pb.WeatherUpdate {
|
||||
TempIndoorF: u.TempIndoorF,
|
||||
HumidityOutdoor: ptr.To(int32(*u.HumidityOudoor)),
|
||||
HumidityIndoor: ptr.To(int32(*u.HumidityIndoor)),
|
||||
WindSpeedMph: new(float64),
|
||||
WindGustMph: new(float64),
|
||||
MaxDailyGust: new(float64),
|
||||
WindDir: new(int32),
|
||||
WindDirAvg_10M: new(int32),
|
||||
Uv: new(int32),
|
||||
SolarRadiation: new(float64),
|
||||
HourlyRainIn: new(float64),
|
||||
EventRainIn: new(float64),
|
||||
DailyRainIn: new(float64),
|
||||
WeeklyRainIn: new(float64),
|
||||
MonthlyRainIn: new(float64),
|
||||
YearlyRainIn: new(float64),
|
||||
TotalRainIn: new(float64),
|
||||
WindSpeedMph: ptr.To(*u.WindSpeedMPH),
|
||||
WindGustMph: ptr.To(*u.WindGustMPH),
|
||||
MaxDailyGust: ptr.To(*u.MaxDailyGust),
|
||||
WindDir: ptr.To(int32(*u.WindDir)),
|
||||
WindDirAvg_10M: ptr.To(int32(*u.WindDirAvg10m)),
|
||||
Uv: ptr.To(int32(*u.UV)),
|
||||
SolarRadiation: ptr.To(*u.SolarRadiation),
|
||||
HourlyRainIn: ptr.To(*u.HourlyRainIn),
|
||||
EventRainIn: ptr.To(*u.EventRainIn),
|
||||
DailyRainIn: ptr.To(*u.DailyRainIn),
|
||||
WeeklyRainIn: ptr.To(*u.WeeklyRainIn),
|
||||
MonthlyRainIn: ptr.To(*u.MonthlyRainIn),
|
||||
YearlyRainIn: ptr.To(*u.YearlyRainIn),
|
||||
TotalRainIn: ptr.To(*u.TotalRainIn),
|
||||
Batteries: []*pb.BatteryStatus{},
|
||||
BaromRelativeIn: new(float64),
|
||||
BaromAbsoluteIn: new(float64),
|
||||
DewPointF: new(float64),
|
||||
WindChillF: new(float64),
|
||||
BaromRelativeIn: ptr.To(*u.BaromRelativeIn),
|
||||
BaromAbsoluteIn: ptr.To(*u.BaromAbsoluteIn),
|
||||
DewPointF: ptr.To(*u.DewPointF),
|
||||
WindChillF: ptr.To(*u.WindChillF),
|
||||
TempHumiditySensors: []*pb.TempHumiditySensor{},
|
||||
}
|
||||
}
|
||||
|
||||
func BatteriesToPbBatteries(batteries []weather.BatteryStatus) []*pb.BatteryStatus {
|
||||
pbBatteries := make([]*pb.BatteryStatus, len(batteries))
|
||||
for i, b := range batteries {
|
||||
pbBatteries[i] = &pb.BatteryStatus{
|
||||
Component: b.Component,
|
||||
Status: ptr.To(int32(*b.Status)),
|
||||
}
|
||||
}
|
||||
return pbBatteries
|
||||
}
|
||||
|
||||
func nilOrValPtr[T *int32 | *float64](v T) *T {
|
||||
switch T.(type) {
|
||||
case *int32:
|
||||
return v.(*int32)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import (
|
||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/state"
|
||||
)
|
||||
|
||||
// TODO: Implement
|
||||
type GRPCWeather struct {
|
||||
ctx context.Context
|
||||
state *state.WeatherState
|
||||
|
Reference in New Issue
Block a user