home-services/gen/ha/v1/light.pb.go
Nik Afiq abb6774b77 feat: implement SwitchService with ListSwitches method
- 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.
2026-04-06 19:25:06 +09:00

541 lines
17 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: ha/v1/light.proto
package hav1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// optional fields require protobuf 3.15+ / buf >= 1.0. They generate
// pointer fields in Go with Has*() accessor methods. This is intentional —
// it lets the gateway distinguish "brightness not set" from "brightness = 0".
type TurnOnRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
EntityId string `protobuf:"bytes,1,opt,name=entity_id,json=entityId,proto3" json:"entity_id,omitempty"`
BrightnessPct *uint32 `protobuf:"varint,2,opt,name=brightness_pct,json=brightnessPct,proto3,oneof" json:"brightness_pct,omitempty"` // 0100
ColorTempKelvin *uint32 `protobuf:"varint,3,opt,name=color_temp_kelvin,json=colorTempKelvin,proto3,oneof" json:"color_temp_kelvin,omitempty"` // e.g. 27006500
RgbColor *RGBColor `protobuf:"bytes,4,opt,name=rgb_color,json=rgbColor,proto3,oneof" json:"rgb_color,omitempty"` // ignored if color_temp_kelvin set
Transition *uint32 `protobuf:"varint,5,opt,name=transition,proto3,oneof" json:"transition,omitempty"` // seconds
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TurnOnRequest) Reset() {
*x = TurnOnRequest{}
mi := &file_ha_v1_light_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TurnOnRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TurnOnRequest) ProtoMessage() {}
func (x *TurnOnRequest) ProtoReflect() protoreflect.Message {
mi := &file_ha_v1_light_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TurnOnRequest.ProtoReflect.Descriptor instead.
func (*TurnOnRequest) Descriptor() ([]byte, []int) {
return file_ha_v1_light_proto_rawDescGZIP(), []int{0}
}
func (x *TurnOnRequest) GetEntityId() string {
if x != nil {
return x.EntityId
}
return ""
}
func (x *TurnOnRequest) GetBrightnessPct() uint32 {
if x != nil && x.BrightnessPct != nil {
return *x.BrightnessPct
}
return 0
}
func (x *TurnOnRequest) GetColorTempKelvin() uint32 {
if x != nil && x.ColorTempKelvin != nil {
return *x.ColorTempKelvin
}
return 0
}
func (x *TurnOnRequest) GetRgbColor() *RGBColor {
if x != nil {
return x.RgbColor
}
return nil
}
func (x *TurnOnRequest) GetTransition() uint32 {
if x != nil && x.Transition != nil {
return *x.Transition
}
return 0
}
type TurnOffRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
EntityId string `protobuf:"bytes,1,opt,name=entity_id,json=entityId,proto3" json:"entity_id,omitempty"`
Transition *uint32 `protobuf:"varint,2,opt,name=transition,proto3,oneof" json:"transition,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TurnOffRequest) Reset() {
*x = TurnOffRequest{}
mi := &file_ha_v1_light_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TurnOffRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TurnOffRequest) ProtoMessage() {}
func (x *TurnOffRequest) ProtoReflect() protoreflect.Message {
mi := &file_ha_v1_light_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TurnOffRequest.ProtoReflect.Descriptor instead.
func (*TurnOffRequest) Descriptor() ([]byte, []int) {
return file_ha_v1_light_proto_rawDescGZIP(), []int{1}
}
func (x *TurnOffRequest) GetEntityId() string {
if x != nil {
return x.EntityId
}
return ""
}
func (x *TurnOffRequest) GetTransition() uint32 {
if x != nil && x.Transition != nil {
return *x.Transition
}
return 0
}
type ToggleRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
EntityId string `protobuf:"bytes,1,opt,name=entity_id,json=entityId,proto3" json:"entity_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ToggleRequest) Reset() {
*x = ToggleRequest{}
mi := &file_ha_v1_light_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ToggleRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ToggleRequest) ProtoMessage() {}
func (x *ToggleRequest) ProtoReflect() protoreflect.Message {
mi := &file_ha_v1_light_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ToggleRequest.ProtoReflect.Descriptor instead.
func (*ToggleRequest) Descriptor() ([]byte, []int) {
return file_ha_v1_light_proto_rawDescGZIP(), []int{2}
}
func (x *ToggleRequest) GetEntityId() string {
if x != nil {
return x.EntityId
}
return ""
}
type LightResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
State *EntityState `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LightResponse) Reset() {
*x = LightResponse{}
mi := &file_ha_v1_light_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LightResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LightResponse) ProtoMessage() {}
func (x *LightResponse) ProtoReflect() protoreflect.Message {
mi := &file_ha_v1_light_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LightResponse.ProtoReflect.Descriptor instead.
func (*LightResponse) Descriptor() ([]byte, []int) {
return file_ha_v1_light_proto_rawDescGZIP(), []int{3}
}
func (x *LightResponse) GetState() *EntityState {
if x != nil {
return x.State
}
return nil
}
type LightEntity struct {
state protoimpl.MessageState `protogen:"open.v1"`
EntityId string `protobuf:"bytes,1,opt,name=entity_id,json=entityId,proto3" json:"entity_id,omitempty"`
FriendlyName string `protobuf:"bytes,2,opt,name=friendly_name,json=friendlyName,proto3" json:"friendly_name,omitempty"`
State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"`
SupportedColorModes []string `protobuf:"bytes,4,rep,name=supported_color_modes,json=supportedColorModes,proto3" json:"supported_color_modes,omitempty"`
MinColorTempKelvin uint32 `protobuf:"varint,5,opt,name=min_color_temp_kelvin,json=minColorTempKelvin,proto3" json:"min_color_temp_kelvin,omitempty"`
MaxColorTempKelvin uint32 `protobuf:"varint,6,opt,name=max_color_temp_kelvin,json=maxColorTempKelvin,proto3" json:"max_color_temp_kelvin,omitempty"`
IsHueGroup bool `protobuf:"varint,7,opt,name=is_hue_group,json=isHueGroup,proto3" json:"is_hue_group,omitempty"`
EffectList []string `protobuf:"bytes,8,rep,name=effect_list,json=effectList,proto3" json:"effect_list,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LightEntity) Reset() {
*x = LightEntity{}
mi := &file_ha_v1_light_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LightEntity) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LightEntity) ProtoMessage() {}
func (x *LightEntity) ProtoReflect() protoreflect.Message {
mi := &file_ha_v1_light_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LightEntity.ProtoReflect.Descriptor instead.
func (*LightEntity) Descriptor() ([]byte, []int) {
return file_ha_v1_light_proto_rawDescGZIP(), []int{4}
}
func (x *LightEntity) GetEntityId() string {
if x != nil {
return x.EntityId
}
return ""
}
func (x *LightEntity) GetFriendlyName() string {
if x != nil {
return x.FriendlyName
}
return ""
}
func (x *LightEntity) GetState() string {
if x != nil {
return x.State
}
return ""
}
func (x *LightEntity) GetSupportedColorModes() []string {
if x != nil {
return x.SupportedColorModes
}
return nil
}
func (x *LightEntity) GetMinColorTempKelvin() uint32 {
if x != nil {
return x.MinColorTempKelvin
}
return 0
}
func (x *LightEntity) GetMaxColorTempKelvin() uint32 {
if x != nil {
return x.MaxColorTempKelvin
}
return 0
}
func (x *LightEntity) GetIsHueGroup() bool {
if x != nil {
return x.IsHueGroup
}
return false
}
func (x *LightEntity) GetEffectList() []string {
if x != nil {
return x.EffectList
}
return nil
}
type ListLightsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListLightsRequest) Reset() {
*x = ListLightsRequest{}
mi := &file_ha_v1_light_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListLightsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListLightsRequest) ProtoMessage() {}
func (x *ListLightsRequest) ProtoReflect() protoreflect.Message {
mi := &file_ha_v1_light_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListLightsRequest.ProtoReflect.Descriptor instead.
func (*ListLightsRequest) Descriptor() ([]byte, []int) {
return file_ha_v1_light_proto_rawDescGZIP(), []int{5}
}
type ListLightsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Lights []*LightEntity `protobuf:"bytes,1,rep,name=lights,proto3" json:"lights,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListLightsResponse) Reset() {
*x = ListLightsResponse{}
mi := &file_ha_v1_light_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListLightsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListLightsResponse) ProtoMessage() {}
func (x *ListLightsResponse) ProtoReflect() protoreflect.Message {
mi := &file_ha_v1_light_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListLightsResponse.ProtoReflect.Descriptor instead.
func (*ListLightsResponse) Descriptor() ([]byte, []int) {
return file_ha_v1_light_proto_rawDescGZIP(), []int{6}
}
func (x *ListLightsResponse) GetLights() []*LightEntity {
if x != nil {
return x.Lights
}
return nil
}
var File_ha_v1_light_proto protoreflect.FileDescriptor
const file_ha_v1_light_proto_rawDesc = "" +
"\n" +
"\x11ha/v1/light.proto\x12\x05ha.v1\x1a\x12ha/v1/common.proto\"\xa7\x02\n" +
"\rTurnOnRequest\x12\x1b\n" +
"\tentity_id\x18\x01 \x01(\tR\bentityId\x12*\n" +
"\x0ebrightness_pct\x18\x02 \x01(\rH\x00R\rbrightnessPct\x88\x01\x01\x12/\n" +
"\x11color_temp_kelvin\x18\x03 \x01(\rH\x01R\x0fcolorTempKelvin\x88\x01\x01\x121\n" +
"\trgb_color\x18\x04 \x01(\v2\x0f.ha.v1.RGBColorH\x02R\brgbColor\x88\x01\x01\x12#\n" +
"\n" +
"transition\x18\x05 \x01(\rH\x03R\n" +
"transition\x88\x01\x01B\x11\n" +
"\x0f_brightness_pctB\x14\n" +
"\x12_color_temp_kelvinB\f\n" +
"\n" +
"_rgb_colorB\r\n" +
"\v_transition\"a\n" +
"\x0eTurnOffRequest\x12\x1b\n" +
"\tentity_id\x18\x01 \x01(\tR\bentityId\x12#\n" +
"\n" +
"transition\x18\x02 \x01(\rH\x00R\n" +
"transition\x88\x01\x01B\r\n" +
"\v_transition\",\n" +
"\rToggleRequest\x12\x1b\n" +
"\tentity_id\x18\x01 \x01(\tR\bentityId\"9\n" +
"\rLightResponse\x12(\n" +
"\x05state\x18\x01 \x01(\v2\x12.ha.v1.EntityStateR\x05state\"\xc2\x02\n" +
"\vLightEntity\x12\x1b\n" +
"\tentity_id\x18\x01 \x01(\tR\bentityId\x12#\n" +
"\rfriendly_name\x18\x02 \x01(\tR\ffriendlyName\x12\x14\n" +
"\x05state\x18\x03 \x01(\tR\x05state\x122\n" +
"\x15supported_color_modes\x18\x04 \x03(\tR\x13supportedColorModes\x121\n" +
"\x15min_color_temp_kelvin\x18\x05 \x01(\rR\x12minColorTempKelvin\x121\n" +
"\x15max_color_temp_kelvin\x18\x06 \x01(\rR\x12maxColorTempKelvin\x12 \n" +
"\fis_hue_group\x18\a \x01(\bR\n" +
"isHueGroup\x12\x1f\n" +
"\veffect_list\x18\b \x03(\tR\n" +
"effectList\"\x13\n" +
"\x11ListLightsRequest\"@\n" +
"\x12ListLightsResponse\x12*\n" +
"\x06lights\x18\x01 \x03(\v2\x12.ha.v1.LightEntityR\x06lights2\xf5\x01\n" +
"\fLightService\x124\n" +
"\x06TurnOn\x12\x14.ha.v1.TurnOnRequest\x1a\x14.ha.v1.LightResponse\x126\n" +
"\aTurnOff\x12\x15.ha.v1.TurnOffRequest\x1a\x14.ha.v1.LightResponse\x124\n" +
"\x06Toggle\x12\x14.ha.v1.ToggleRequest\x1a\x14.ha.v1.LightResponse\x12A\n" +
"\n" +
"ListLights\x12\x18.ha.v1.ListLightsRequest\x1a\x19.ha.v1.ListLightsResponseB4Z2gitea.nik4nao.com/nik/home-services/gen/ha/v1;hav1b\x06proto3"
var (
file_ha_v1_light_proto_rawDescOnce sync.Once
file_ha_v1_light_proto_rawDescData []byte
)
func file_ha_v1_light_proto_rawDescGZIP() []byte {
file_ha_v1_light_proto_rawDescOnce.Do(func() {
file_ha_v1_light_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ha_v1_light_proto_rawDesc), len(file_ha_v1_light_proto_rawDesc)))
})
return file_ha_v1_light_proto_rawDescData
}
var file_ha_v1_light_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_ha_v1_light_proto_goTypes = []any{
(*TurnOnRequest)(nil), // 0: ha.v1.TurnOnRequest
(*TurnOffRequest)(nil), // 1: ha.v1.TurnOffRequest
(*ToggleRequest)(nil), // 2: ha.v1.ToggleRequest
(*LightResponse)(nil), // 3: ha.v1.LightResponse
(*LightEntity)(nil), // 4: ha.v1.LightEntity
(*ListLightsRequest)(nil), // 5: ha.v1.ListLightsRequest
(*ListLightsResponse)(nil), // 6: ha.v1.ListLightsResponse
(*RGBColor)(nil), // 7: ha.v1.RGBColor
(*EntityState)(nil), // 8: ha.v1.EntityState
}
var file_ha_v1_light_proto_depIdxs = []int32{
7, // 0: ha.v1.TurnOnRequest.rgb_color:type_name -> ha.v1.RGBColor
8, // 1: ha.v1.LightResponse.state:type_name -> ha.v1.EntityState
4, // 2: ha.v1.ListLightsResponse.lights:type_name -> ha.v1.LightEntity
0, // 3: ha.v1.LightService.TurnOn:input_type -> ha.v1.TurnOnRequest
1, // 4: ha.v1.LightService.TurnOff:input_type -> ha.v1.TurnOffRequest
2, // 5: ha.v1.LightService.Toggle:input_type -> ha.v1.ToggleRequest
5, // 6: ha.v1.LightService.ListLights:input_type -> ha.v1.ListLightsRequest
3, // 7: ha.v1.LightService.TurnOn:output_type -> ha.v1.LightResponse
3, // 8: ha.v1.LightService.TurnOff:output_type -> ha.v1.LightResponse
3, // 9: ha.v1.LightService.Toggle:output_type -> ha.v1.LightResponse
6, // 10: ha.v1.LightService.ListLights:output_type -> ha.v1.ListLightsResponse
7, // [7:11] is the sub-list for method output_type
3, // [3:7] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_ha_v1_light_proto_init() }
func file_ha_v1_light_proto_init() {
if File_ha_v1_light_proto != nil {
return
}
file_ha_v1_common_proto_init()
file_ha_v1_light_proto_msgTypes[0].OneofWrappers = []any{}
file_ha_v1_light_proto_msgTypes[1].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ha_v1_light_proto_rawDesc), len(file_ha_v1_light_proto_rawDesc)),
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ha_v1_light_proto_goTypes,
DependencyIndexes: file_ha_v1_light_proto_depIdxs,
MessageInfos: file_ha_v1_light_proto_msgTypes,
}.Build()
File_ha_v1_light_proto = out.File
file_ha_v1_light_proto_goTypes = nil
file_ha_v1_light_proto_depIdxs = nil
}