generated from rmcguire/go-server-with-otel
add set mode option
This commit is contained in:
@@ -30,6 +30,22 @@ message Device {
|
||||
google.protobuf.Timestamp last_updated = 18;
|
||||
}
|
||||
|
||||
// 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.
|
||||
enum Mode {
|
||||
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;
|
||||
}
|
||||
|
||||
message ListDevicesRequest {}
|
||||
|
||||
message ListDevicesResponse {
|
||||
@@ -44,6 +60,20 @@ message GetDeviceResponse {
|
||||
Device device = 1;
|
||||
}
|
||||
|
||||
message SetModeRequest {
|
||||
string serial_number = 1 [(buf.validate.field).string.min_len = 1];
|
||||
Mode mode = 2 [(buf.validate.field).enum = {
|
||||
defined_only: true
|
||||
not_in: [0]
|
||||
}];
|
||||
}
|
||||
|
||||
message SetModeResponse {
|
||||
// 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 = 1;
|
||||
}
|
||||
|
||||
// EconetService exposes read-only access to Rheem EcoNet device state.
|
||||
service EconetService {
|
||||
rpc ListDevices(ListDevicesRequest) returns (ListDevicesResponse) {
|
||||
@@ -52,4 +82,10 @@ service EconetService {
|
||||
rpc GetDevice(GetDeviceRequest) returns (GetDeviceResponse) {
|
||||
option (google.api.http) = {get: "/v1alpha1/devices/{serial_number}"};
|
||||
}
|
||||
rpc SetMode(SetModeRequest) returns (SetModeResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1alpha1/devices/{serial_number}/mode"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user