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

45 lines
1.5 KiB
Protocol Buffer
Raw Permalink 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.

syntax = "proto3";
package ha.v1;
option go_package = "gitea.nik4nao.com/nik/home-services/gen/ha/v1;hav1";
import "ha/v1/common.proto";
service LightService {
rpc TurnOn(TurnOnRequest) returns (LightResponse);
rpc TurnOff(TurnOffRequest) returns (LightResponse);
rpc Toggle(ToggleRequest) returns (LightResponse);
rpc ListLights(ListLightsRequest) returns (ListLightsResponse);
}
// 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".
message TurnOnRequest {
string entity_id = 1;
optional uint32 brightness_pct = 2; // 0100
optional uint32 color_temp_kelvin = 3; // e.g. 27006500
optional RGBColor rgb_color = 4; // ignored if color_temp_kelvin set
optional uint32 transition = 5; // seconds
}
message TurnOffRequest {
string entity_id = 1;
optional uint32 transition = 2;
}
message ToggleRequest { string entity_id = 1; }
message LightResponse { EntityState state = 1; }
message LightEntity {
string entity_id = 1;
string friendly_name = 2;
string state = 3;
repeated string supported_color_modes = 4;
uint32 min_color_temp_kelvin = 5;
uint32 max_color_temp_kelvin = 6;
bool is_hue_group = 7;
repeated string effect_list = 8;
}
message ListLightsRequest {}
message ListLightsResponse {
repeated LightEntity lights = 1;
}