home-services/proto/ha/v1/switch.proto
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

27 lines
775 B
Protocol Buffer

syntax = "proto3";
package ha.v1;
option go_package = "gitea.nik4nao.com/nik/home-services/gen/ha/v1;hav1";
import "ha/v1/common.proto";
service SwitchService {
rpc TurnOn(SwitchRequest) returns (SwitchResponse);
rpc TurnOff(SwitchRequest) returns (SwitchResponse);
rpc Toggle(SwitchRequest) returns (SwitchResponse);
rpc ListSwitches(ListSwitchesRequest) returns (ListSwitchesResponse);
}
message SwitchRequest { string entity_id = 1; }
message SwitchResponse { EntityState state = 1; }
message SwitchEntity {
string entity_id = 1;
string friendly_name = 2;
string state = 3;
string device_class = 4;
}
message ListSwitchesRequest {}
message ListSwitchesResponse {
repeated SwitchEntity switches = 1;
}