From daac0b3b9ec247947e7c0cc06a93488a66ada448 Mon Sep 17 00:00:00 2001 From: Bennett Wetters Date: Sun, 14 Jan 2024 01:01:12 +0100 Subject: [PATCH] Change Sensors field type in config and response to map --- config/types.go | 7 ++----- types/v14.go | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/config/types.go b/config/types.go index c8d9524..c2b3f12 100644 --- a/config/types.go +++ b/config/types.go @@ -19,11 +19,8 @@ type EnvironmentSensorConfig struct { } type DynamicStateConfig struct { - Sensors struct { - Temperature []EnvironmentSensorConfig `json:"temperature"` - Humidity []EnvironmentSensorConfig `json:"humidity"` - } `json:"sensors"` - State struct { + Sensors map[string][]EnvironmentSensorConfig `json:"sensors"` + State struct { Open struct { AllowedCredentials []HTTPBACredentialID `json:"allowed_credentials"` } `json:"open"` diff --git a/types/v14.go b/types/v14.go index 341013c..81b92a6 100644 --- a/types/v14.go +++ b/types/v14.go @@ -23,11 +23,8 @@ type SpaceAPIResponseV14 struct { ML string `json:"ml"` Matrix string `json:"matrix"` } `json:"contact"` - Sensors struct { - Temperature []EnvironmentSensor `json:"temperature"` - Humidity []EnvironmentSensor `json:"humidity"` - } `json:"sensors"` - Feeds struct { + Sensors map[string][]EnvironmentSensor `json:"sensors"` + Feeds struct { Blog struct { Type string `json:"type"` URL string `json:"url"`