add set mode option
Build and Publish / container-images (push) Has been skipped
Build and Publish / check-chart (push) Successful in 15s
Build and Publish / go-binaries (push) Has been skipped
Build and Publish / helm-release (push) Has been skipped

This commit is contained in:
2026-07-16 15:35:12 -04:00
parent 8e0e59db16
commit 52ed5a7e3a
10 changed files with 731 additions and 25 deletions
+218 -23
View File
@@ -24,6 +24,77 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Mode is a settable operating mode for a water heater. The values mirror the
// kebab-case slugs reported in Device.mode. Not every device supports every
// mode; the supported set is device-specific (derived from the unit's reported
// mode list), so SetMode validates against the target device.
type Mode int32
const (
Mode_MODE_UNSPECIFIED Mode = 0
Mode_MODE_OFF Mode = 1
Mode_MODE_ELECTRIC Mode = 2
Mode_MODE_ENERGY_SAVING Mode = 3
Mode_MODE_HEAT_PUMP Mode = 4
Mode_MODE_HIGH_DEMAND Mode = 5
Mode_MODE_GAS Mode = 6
Mode_MODE_PERFORMANCE Mode = 7
Mode_MODE_VACATION Mode = 8
)
// Enum value maps for Mode.
var (
Mode_name = map[int32]string{
0: "MODE_UNSPECIFIED",
1: "MODE_OFF",
2: "MODE_ELECTRIC",
3: "MODE_ENERGY_SAVING",
4: "MODE_HEAT_PUMP",
5: "MODE_HIGH_DEMAND",
6: "MODE_GAS",
7: "MODE_PERFORMANCE",
8: "MODE_VACATION",
}
Mode_value = map[string]int32{
"MODE_UNSPECIFIED": 0,
"MODE_OFF": 1,
"MODE_ELECTRIC": 2,
"MODE_ENERGY_SAVING": 3,
"MODE_HEAT_PUMP": 4,
"MODE_HIGH_DEMAND": 5,
"MODE_GAS": 6,
"MODE_PERFORMANCE": 7,
"MODE_VACATION": 8,
}
)
func (x Mode) Enum() *Mode {
p := new(Mode)
*p = x
return p
}
func (x Mode) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Mode) Descriptor() protoreflect.EnumDescriptor {
return file_econet_v1alpha1_econet_proto_enumTypes[0].Descriptor()
}
func (Mode) Type() protoreflect.EnumType {
return &file_econet_v1alpha1_econet_proto_enumTypes[0]
}
func (x Mode) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Mode.Descriptor instead.
func (Mode) EnumDescriptor() ([]byte, []int) {
return file_econet_v1alpha1_econet_proto_rawDescGZIP(), []int{0}
}
// Device is the live state of a single Rheem EcoNet device
// (typically a water heater) as reported by the Rheem cloud.
type Device struct {
@@ -374,6 +445,104 @@ func (x *GetDeviceResponse) GetDevice() *Device {
return nil
}
type SetModeRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
SerialNumber string `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"`
Mode Mode `protobuf:"varint,2,opt,name=mode,proto3,enum=econet.v1alpha1.Mode" json:"mode,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SetModeRequest) Reset() {
*x = SetModeRequest{}
mi := &file_econet_v1alpha1_econet_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SetModeRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SetModeRequest) ProtoMessage() {}
func (x *SetModeRequest) ProtoReflect() protoreflect.Message {
mi := &file_econet_v1alpha1_econet_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 SetModeRequest.ProtoReflect.Descriptor instead.
func (*SetModeRequest) Descriptor() ([]byte, []int) {
return file_econet_v1alpha1_econet_proto_rawDescGZIP(), []int{5}
}
func (x *SetModeRequest) GetSerialNumber() string {
if x != nil {
return x.SerialNumber
}
return ""
}
func (x *SetModeRequest) GetMode() Mode {
if x != nil {
return x.Mode
}
return Mode_MODE_UNSPECIFIED
}
type SetModeResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Last-known device state. The mode change is applied asynchronously by the
// Rheem cloud, so this reflects the requested mode only after a later poll.
Device *Device `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SetModeResponse) Reset() {
*x = SetModeResponse{}
mi := &file_econet_v1alpha1_econet_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SetModeResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SetModeResponse) ProtoMessage() {}
func (x *SetModeResponse) ProtoReflect() protoreflect.Message {
mi := &file_econet_v1alpha1_econet_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 SetModeResponse.ProtoReflect.Descriptor instead.
func (*SetModeResponse) Descriptor() ([]byte, []int) {
return file_econet_v1alpha1_econet_proto_rawDescGZIP(), []int{6}
}
func (x *SetModeResponse) GetDevice() *Device {
if x != nil {
return x.Device
}
return nil
}
var File_econet_v1alpha1_econet_proto protoreflect.FileDescriptor
const file_econet_v1alpha1_econet_proto_rawDesc = "" +
@@ -407,10 +576,27 @@ const file_econet_v1alpha1_econet_proto_rawDesc = "" +
"\x10GetDeviceRequest\x12,\n" +
"\rserial_number\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\fserialNumber\"D\n" +
"\x11GetDeviceResponse\x12/\n" +
"\x06device\x18\x01 \x01(\v2\x17.econet.v1alpha1.DeviceR\x06device2\x83\x02\n" +
"\x06device\x18\x01 \x01(\v2\x17.econet.v1alpha1.DeviceR\x06device\"u\n" +
"\x0eSetModeRequest\x12,\n" +
"\rserial_number\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\fserialNumber\x125\n" +
"\x04mode\x18\x02 \x01(\x0e2\x15.econet.v1alpha1.ModeB\n" +
"\xbaH\a\x82\x01\x04\x10\x01 \x00R\x04mode\"B\n" +
"\x0fSetModeResponse\x12/\n" +
"\x06device\x18\x01 \x01(\v2\x17.econet.v1alpha1.DeviceR\x06device*\xb6\x01\n" +
"\x04Mode\x12\x14\n" +
"\x10MODE_UNSPECIFIED\x10\x00\x12\f\n" +
"\bMODE_OFF\x10\x01\x12\x11\n" +
"\rMODE_ELECTRIC\x10\x02\x12\x16\n" +
"\x12MODE_ENERGY_SAVING\x10\x03\x12\x12\n" +
"\x0eMODE_HEAT_PUMP\x10\x04\x12\x14\n" +
"\x10MODE_HIGH_DEMAND\x10\x05\x12\f\n" +
"\bMODE_GAS\x10\x06\x12\x14\n" +
"\x10MODE_PERFORMANCE\x10\a\x12\x11\n" +
"\rMODE_VACATION\x10\b2\x84\x03\n" +
"\rEconetService\x12s\n" +
"\vListDevices\x12#.econet.v1alpha1.ListDevicesRequest\x1a$.econet.v1alpha1.ListDevicesResponse\"\x19\x82\xd3\xe4\x93\x02\x13\x12\x11/v1alpha1/devices\x12}\n" +
"\tGetDevice\x12!.econet.v1alpha1.GetDeviceRequest\x1a\".econet.v1alpha1.GetDeviceResponse\")\x82\xd3\xe4\x93\x02#\x12!/v1alpha1/devices/{serial_number}B\xcb\x01\n" +
"\tGetDevice\x12!.econet.v1alpha1.GetDeviceRequest\x1a\".econet.v1alpha1.GetDeviceResponse\")\x82\xd3\xe4\x93\x02#\x12!/v1alpha1/devices/{serial_number}\x12\x7f\n" +
"\aSetMode\x12\x1f.econet.v1alpha1.SetModeRequest\x1a .econet.v1alpha1.SetModeResponse\"1\x82\xd3\xe4\x93\x02+:\x01*\"&/v1alpha1/devices/{serial_number}/modeB\xcb\x01\n" +
"\x13com.econet.v1alpha1B\vEconetProtoP\x01ZJgitea.libretechconsulting.com/rmcguire/econet-exporter/api/econet/v1alpha1\xa2\x02\x03EXX\xaa\x02\x0fEconet.V1alpha1\xca\x02\x0fEconet\\V1alpha1\xe2\x02\x1bEconet\\V1alpha1\\GPBMetadata\xea\x02\x10Econet::V1alpha1b\x06proto3"
var (
@@ -425,28 +611,36 @@ func file_econet_v1alpha1_econet_proto_rawDescGZIP() []byte {
return file_econet_v1alpha1_econet_proto_rawDescData
}
var file_econet_v1alpha1_econet_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_econet_v1alpha1_econet_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_econet_v1alpha1_econet_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_econet_v1alpha1_econet_proto_goTypes = []any{
(*Device)(nil), // 0: econet.v1alpha1.Device
(*ListDevicesRequest)(nil), // 1: econet.v1alpha1.ListDevicesRequest
(*ListDevicesResponse)(nil), // 2: econet.v1alpha1.ListDevicesResponse
(*GetDeviceRequest)(nil), // 3: econet.v1alpha1.GetDeviceRequest
(*GetDeviceResponse)(nil), // 4: econet.v1alpha1.GetDeviceResponse
(*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp
(Mode)(0), // 0: econet.v1alpha1.Mode
(*Device)(nil), // 1: econet.v1alpha1.Device
(*ListDevicesRequest)(nil), // 2: econet.v1alpha1.ListDevicesRequest
(*ListDevicesResponse)(nil), // 3: econet.v1alpha1.ListDevicesResponse
(*GetDeviceRequest)(nil), // 4: econet.v1alpha1.GetDeviceRequest
(*GetDeviceResponse)(nil), // 5: econet.v1alpha1.GetDeviceResponse
(*SetModeRequest)(nil), // 6: econet.v1alpha1.SetModeRequest
(*SetModeResponse)(nil), // 7: econet.v1alpha1.SetModeResponse
(*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp
}
var file_econet_v1alpha1_econet_proto_depIdxs = []int32{
5, // 0: econet.v1alpha1.Device.last_updated:type_name -> google.protobuf.Timestamp
0, // 1: econet.v1alpha1.ListDevicesResponse.devices:type_name -> econet.v1alpha1.Device
0, // 2: econet.v1alpha1.GetDeviceResponse.device:type_name -> econet.v1alpha1.Device
1, // 3: econet.v1alpha1.EconetService.ListDevices:input_type -> econet.v1alpha1.ListDevicesRequest
3, // 4: econet.v1alpha1.EconetService.GetDevice:input_type -> econet.v1alpha1.GetDeviceRequest
2, // 5: econet.v1alpha1.EconetService.ListDevices:output_type -> econet.v1alpha1.ListDevicesResponse
4, // 6: econet.v1alpha1.EconetService.GetDevice:output_type -> econet.v1alpha1.GetDeviceResponse
5, // [5:7] is the sub-list for method output_type
3, // [3:5] 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
8, // 0: econet.v1alpha1.Device.last_updated:type_name -> google.protobuf.Timestamp
1, // 1: econet.v1alpha1.ListDevicesResponse.devices:type_name -> econet.v1alpha1.Device
1, // 2: econet.v1alpha1.GetDeviceResponse.device:type_name -> econet.v1alpha1.Device
0, // 3: econet.v1alpha1.SetModeRequest.mode:type_name -> econet.v1alpha1.Mode
1, // 4: econet.v1alpha1.SetModeResponse.device:type_name -> econet.v1alpha1.Device
2, // 5: econet.v1alpha1.EconetService.ListDevices:input_type -> econet.v1alpha1.ListDevicesRequest
4, // 6: econet.v1alpha1.EconetService.GetDevice:input_type -> econet.v1alpha1.GetDeviceRequest
6, // 7: econet.v1alpha1.EconetService.SetMode:input_type -> econet.v1alpha1.SetModeRequest
3, // 8: econet.v1alpha1.EconetService.ListDevices:output_type -> econet.v1alpha1.ListDevicesResponse
5, // 9: econet.v1alpha1.EconetService.GetDevice:output_type -> econet.v1alpha1.GetDeviceResponse
7, // 10: econet.v1alpha1.EconetService.SetMode:output_type -> econet.v1alpha1.SetModeResponse
8, // [8:11] is the sub-list for method output_type
5, // [5:8] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_econet_v1alpha1_econet_proto_init() }
@@ -459,13 +653,14 @@ func file_econet_v1alpha1_econet_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_econet_v1alpha1_econet_proto_rawDesc), len(file_econet_v1alpha1_econet_proto_rawDesc)),
NumEnums: 0,
NumMessages: 5,
NumEnums: 1,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_econet_v1alpha1_econet_proto_goTypes,
DependencyIndexes: file_econet_v1alpha1_econet_proto_depIdxs,
EnumInfos: file_econet_v1alpha1_econet_proto_enumTypes,
MessageInfos: file_econet_v1alpha1_econet_proto_msgTypes,
}.Build()
File_econet_v1alpha1_econet_proto = out.File