Files
2026-07-16 16:32:44 -04:00

94 lines
2.9 KiB
Protocol Buffer

syntax = "proto3";
package econet.v1alpha1;
import "buf/validate/validate.proto";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
option go_package = "gitea.libretechconsulting.com/rmcguire/econet-exporter/api/econet/v1alpha1";
// Device is the live state of a single Rheem EcoNet device
// (typically a water heater) as reported by the Rheem cloud.
message Device {
string serial_number = 1;
string device_id = 2;
string friendly_name = 3;
string type = 4; // water_heater, thermostat, unknown
string generic_type = 5; // e.g. heatpumpWaterHeater, gasWaterHeater
bool connected = 6;
int32 wifi_signal = 7; // dB, MQTT-only
string mode = 8; // kebab-case, e.g. heat-pump, energy-saving
bool enabled = 9;
bool running = 10;
string running_state = 11;
int32 setpoint = 12; // degrees Fahrenheit
int32 setpoint_min = 13;
int32 setpoint_max = 14;
int32 hot_water_availability = 15; // 0/33/66/100, -1 unknown
int32 alert_count = 16;
bool away = 17;
google.protobuf.Timestamp last_updated = 18;
repeated Mode supported_modes = 19; // modes this device can be set to (may be empty)
}
// 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;
MODE_ELECTRIC_GAS = 9; // combined electric/gas backup mode (e.g. hybrid units)
}
message ListDevicesRequest {}
message ListDevicesResponse {
repeated Device devices = 1;
}
message GetDeviceRequest {
string serial_number = 1 [(buf.validate.field).string.min_len = 1];
}
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) {
option (google.api.http) = {get: "/v1alpha1/devices"};
}
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: "*"
};
}
}