28 lines
1.0 KiB
Protocol Buffer
28 lines
1.0 KiB
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 LightService {
|
||
rpc TurnOn(TurnOnRequest) returns (LightResponse);
|
||
rpc TurnOff(TurnOffRequest) returns (LightResponse);
|
||
rpc Toggle(ToggleRequest) returns (LightResponse);
|
||
}
|
||
|
||
// 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; // 0–100
|
||
optional uint32 color_temp_kelvin = 3; // e.g. 2700–6500
|
||
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; }
|