- Added ClimateApp to handle climate entity operations including turning on/off, adjusting temperature, and setting HVAC modes. - Implemented caching mechanism for climate entities to optimize state retrieval. - Created domain model for Climate with attributes such as current temperature, target temperature, and HVAC modes. - Developed unit tests for ClimateApp to ensure functionality and correctness. feat: add RemoteApp for SwitchBot commands - Introduced RemoteApp to facilitate sending commands to SwitchBot devices. - Implemented SendCommand method for executing device commands without state management. chore: update configuration for SwitchBot integration - Added SwitchBotToken and SwitchBotSecret to configuration for enabling SwitchBot Cloud commands. feat: define gRPC services for Climate and Remote operations - Created climate.proto and remote.proto files to define gRPC services for climate management and remote command execution. - Implemented corresponding request and response message structures for gRPC interactions.
122 lines
4.5 KiB
Go
122 lines
4.5 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.6.2
|
|
// - protoc (unknown)
|
|
// source: ha/v1/remote.proto
|
|
|
|
package hav1
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.64.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion9
|
|
|
|
const (
|
|
RemoteService_SendCommand_FullMethodName = "/ha.v1.RemoteService/SendCommand"
|
|
)
|
|
|
|
// RemoteServiceClient is the client API for RemoteService service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
type RemoteServiceClient interface {
|
|
SendCommand(ctx context.Context, in *SendCommandRequest, opts ...grpc.CallOption) (*SendCommandResponse, error)
|
|
}
|
|
|
|
type remoteServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewRemoteServiceClient(cc grpc.ClientConnInterface) RemoteServiceClient {
|
|
return &remoteServiceClient{cc}
|
|
}
|
|
|
|
func (c *remoteServiceClient) SendCommand(ctx context.Context, in *SendCommandRequest, opts ...grpc.CallOption) (*SendCommandResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(SendCommandResponse)
|
|
err := c.cc.Invoke(ctx, RemoteService_SendCommand_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// RemoteServiceServer is the server API for RemoteService service.
|
|
// All implementations must embed UnimplementedRemoteServiceServer
|
|
// for forward compatibility.
|
|
type RemoteServiceServer interface {
|
|
SendCommand(context.Context, *SendCommandRequest) (*SendCommandResponse, error)
|
|
mustEmbedUnimplementedRemoteServiceServer()
|
|
}
|
|
|
|
// UnimplementedRemoteServiceServer must be embedded to have
|
|
// forward compatible implementations.
|
|
//
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
// pointer dereference when methods are called.
|
|
type UnimplementedRemoteServiceServer struct{}
|
|
|
|
func (UnimplementedRemoteServiceServer) SendCommand(context.Context, *SendCommandRequest) (*SendCommandResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method SendCommand not implemented")
|
|
}
|
|
func (UnimplementedRemoteServiceServer) mustEmbedUnimplementedRemoteServiceServer() {}
|
|
func (UnimplementedRemoteServiceServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeRemoteServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to RemoteServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeRemoteServiceServer interface {
|
|
mustEmbedUnimplementedRemoteServiceServer()
|
|
}
|
|
|
|
func RegisterRemoteServiceServer(s grpc.ServiceRegistrar, srv RemoteServiceServer) {
|
|
// If the following call panics, it indicates UnimplementedRemoteServiceServer was
|
|
// embedded by pointer and is nil. This will cause panics if an
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
|
// time to prevent it from happening at runtime later due to I/O.
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
t.testEmbeddedByValue()
|
|
}
|
|
s.RegisterService(&RemoteService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _RemoteService_SendCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(SendCommandRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(RemoteServiceServer).SendCommand(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: RemoteService_SendCommand_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(RemoteServiceServer).SendCommand(ctx, req.(*SendCommandRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// RemoteService_ServiceDesc is the grpc.ServiceDesc for RemoteService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var RemoteService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "ha.v1.RemoteService",
|
|
HandlerType: (*RemoteServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "SendCommand",
|
|
Handler: _RemoteService_SendCommand_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "ha/v1/remote.proto",
|
|
}
|