- Added ListSwitches method to SwitchService in switch_grpc.pb.go. - Implemented SwitchGRPC adapter for ListSwitches in switch.go. - Created SwitchApp for managing switch states and added ListSwitches logic. - Updated core domain with Switch struct and associated methods. - Enhanced LightApp to include ListLights functionality. - Updated protobuf definitions for Switch and Light services to include new request and response messages. - Introduced error handling for unimplemented methods in the gRPC server.
39 lines
774 B
Go
39 lines
774 B
Go
package domain
|
|
|
|
type ColorMode string
|
|
|
|
const (
|
|
ColorModeColorTemp ColorMode = "color_temp"
|
|
ColorModeHS ColorMode = "hs"
|
|
ColorModeXY ColorMode = "xy"
|
|
ColorModeBrightness ColorMode = "brightness"
|
|
)
|
|
|
|
type Light struct {
|
|
EntityID EntityID
|
|
FriendlyName string
|
|
State string // "on" | "off" | "unavailable"
|
|
SupportedColorModes []ColorMode
|
|
MinColorTempKelvin uint32
|
|
MaxColorTempKelvin uint32
|
|
IsHueGroup bool
|
|
EffectList []string
|
|
}
|
|
|
|
type TurnOnParams struct {
|
|
EntityID EntityID
|
|
BrightnessPct *uint32
|
|
ColorTempKelvin *uint32
|
|
RGBColor *RGBColor
|
|
Transition *uint32
|
|
}
|
|
|
|
type RGBColor struct {
|
|
R, G, B uint8
|
|
}
|
|
|
|
type TurnOffParams struct {
|
|
EntityID EntityID
|
|
Transition *uint32
|
|
}
|