From b2b4f2626842602b448afd1653e75e0dd3320a34 Mon Sep 17 00:00:00 2001 From: Sebastian Plattner Date: Fri, 3 May 2024 14:48:08 +0200 Subject: [PATCH] some small renamings --- pkg/entities/button.go | 8 ++++---- pkg/entities/climate.go | 8 ++++---- pkg/entities/cover.go | 8 ++++---- pkg/entities/entities.go | 4 ++++ pkg/entities/light.go | 8 ++++---- pkg/entities/media_player.go | 10 +++++----- pkg/entities/remote.go | 10 +++++----- pkg/entities/sensor.go | 8 ++++---- pkg/entities/switch.go | 8 ++++---- pkg/integration/types.go | 18 +++++++++--------- 10 files changed, 47 insertions(+), 43 deletions(-) diff --git a/pkg/entities/button.go b/pkg/entities/button.go index 4d373ea..4c42587 100644 --- a/pkg/entities/button.go +++ b/pkg/entities/button.go @@ -1,9 +1,9 @@ package entities -type ButtonEntityState string -type ButtonEntityFeatures string -type ButtonEntityAttribute string -type ButtonEntityCommand string +type ButtonEntityState EntityState +type ButtonEntityFeatures EntityFeature +type ButtonEntityAttribute EntityAttribute +type ButtonEntityCommand EntityCommand const ( AvailableButtonEntityState EntityState = "AVAILABLE" diff --git a/pkg/entities/climate.go b/pkg/entities/climate.go index 87bd654..4ea1f89 100644 --- a/pkg/entities/climate.go +++ b/pkg/entities/climate.go @@ -1,9 +1,9 @@ package entities -type ClimateEntityState string -type ClimateEntityFeatures string -type ClimateEntityAttributes string -type ClimateEntityCommand string +type ClimateEntityState EntityState +type ClimateEntityFeatures EntityFeature +type ClimateEntityAttributes EntityAttribute +type ClimateEntityCommand EntityCommand const ( OffClimateEntityState ClimateEntityState = "OFF" diff --git a/pkg/entities/cover.go b/pkg/entities/cover.go index 8537b84..7c34afd 100644 --- a/pkg/entities/cover.go +++ b/pkg/entities/cover.go @@ -1,9 +1,9 @@ package entities -type CoverEntityState string -type CoverEntityFeatures string -type CoverEntityAttributes string -type CoverEntityCommand string +type CoverEntityState EntityState +type CoverEntityFeatures EntityFeature +type CoverEntityAttributes EntityAttribute +type CoverEntityCommand EntityCommand const ( OpeningCoverEntityState CoverEntityState = "OPENING" diff --git a/pkg/entities/entities.go b/pkg/entities/entities.go index 42fa19f..d4848b4 100644 --- a/pkg/entities/entities.go +++ b/pkg/entities/entities.go @@ -5,6 +5,10 @@ import ( ) type EntityState string +type EntityCommand string +type EntityAttribute string +type EntityFeature string +type EntityOption string const ( UnavailableEntityState EntityState = "UNAVAILABLE" diff --git a/pkg/entities/light.go b/pkg/entities/light.go index 34432c7..80fd601 100644 --- a/pkg/entities/light.go +++ b/pkg/entities/light.go @@ -4,10 +4,10 @@ import ( log "github.com/sirupsen/logrus" ) -type LightEntityState string -type LightEntityFeatures string -type LightEntityAttributes string -type LightEntityCommand string +type LightEntityState EntityState +type LightEntityFeatures EntityFeature +type LightEntityAttributes EntityAttribute +type LightEntityCommand EntityCommand const ( OnLightEntityState LightEntityState = "ON" diff --git a/pkg/entities/media_player.go b/pkg/entities/media_player.go index 96842ae..21b087e 100644 --- a/pkg/entities/media_player.go +++ b/pkg/entities/media_player.go @@ -2,11 +2,11 @@ package entities import "slices" -type MediaPlayerEntityState string -type MediaPlayerEntityFeatures string -type MediaPlayerEntityAttributes string -type MediaPlayerEntityCommand string -type MediaPlayerEntityOption string +type MediaPlayerEntityState EntityState +type MediaPlayerEntityFeatures EntityFeature +type MediaPlayerEntityAttributes EntityAttribute +type MediaPlayerEntityCommand EntityCommand +type MediaPlayerEntityOption EntityOption type MediaPlayerDeviceClass string const ( diff --git a/pkg/entities/remote.go b/pkg/entities/remote.go index 83c560e..164d695 100644 --- a/pkg/entities/remote.go +++ b/pkg/entities/remote.go @@ -1,10 +1,10 @@ package entities -type RemoteEntityState string -type RemoteEntityFeatures string -type RemoteEntityAttributes string -type RemoteEntityCommand string -type RemoteEntityOption string +type RemoteEntityState EntityState +type RemoteEntityFeatures EntityFeature +type RemoteEntityAttributes EntityAttribute +type RemoteEntityCommand EntityCommand +type RemoteEntityOption EntityOption const ( OnRemoteEntityState RemoteEntityState = "ON" diff --git a/pkg/entities/sensor.go b/pkg/entities/sensor.go index e90decc..49b7a07 100644 --- a/pkg/entities/sensor.go +++ b/pkg/entities/sensor.go @@ -1,9 +1,9 @@ package entities -type SensorEntityState string -type SensorEntityFeatures string -type SensorEntityAttributes string -type SensorEntityCommand string +type SensorEntityState EntityState +type SensorEntityFeatures EntityFeature +type SensorEntityAttributes EntityAttribute +type SensorEntityCommand EntityCommand type SensorDeviceClass string const ( diff --git a/pkg/entities/switch.go b/pkg/entities/switch.go index 2a12a5d..8a0bf00 100644 --- a/pkg/entities/switch.go +++ b/pkg/entities/switch.go @@ -1,9 +1,9 @@ package entities -type SwitchEntityState string -type SwitchEntityFeatures string -type SwitchEntityAttributes string -type SwitchEntityCommand string +type SwitchEntityState EntityState +type SwitchEntityFeatures EntityFeature +type SwitchEntityAttributes EntityAttribute +type SwitchEntityCommand EntityCommand const ( OnSwitchtEntityState SwitchEntityState = "ON" diff --git a/pkg/integration/types.go b/pkg/integration/types.go index 0d732c4..eceb61b 100644 --- a/pkg/integration/types.go +++ b/pkg/integration/types.go @@ -363,13 +363,13 @@ type RequireUserAction struct { Confirmation interface{} `json:"confirmation,omitempty"` } -type RemoteButtonMapping struct { - Button string `json:"string"` - ShortPress RemoteCommand `json:"short_press,omitempty"` - LongPress RemoteCommand `json:"long_press,omitempty"` +type ButtonMapping struct { + Button string `json:"string"` + ShortPress Command `json:"short_press,omitempty"` + LongPress Command `json:"long_press,omitempty"` } -type RemoteCommand struct { +type Command struct { CmdId string `json:"cmd_id"` Params map[string]string `json:"params,omitempty"` } @@ -389,10 +389,10 @@ type UserInterfacePage struct { } type UserInterfaceItem struct { - Type string `json:"type"` - Icon string `json:"icon"` - Text string `json:"text"` - Command RemoteCommand `json:"command"` + Type string `json:"type"` + Icon string `json:"icon"` + Text string `json:"text"` + Command Command `json:"command"` Location struct { X int `json:"x"` Y int `json:"y"`