New api.proto format, user-defined service arrays
See https://github.com/esphome/esphome/pull/633
This commit is contained in:
parent
d8d7c684e5
commit
7ade99a614
|
@ -1,5 +1,45 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
|
import "api_options.proto";
|
||||||
|
|
||||||
|
service APIConnection {
|
||||||
|
rpc hello (HelloRequest) returns (HelloResponse) {
|
||||||
|
option (needs_setup_connection) = false;
|
||||||
|
option (needs_authentication) = false;
|
||||||
|
}
|
||||||
|
rpc connect (ConnectRequest) returns (ConnectResponse) {
|
||||||
|
option (needs_setup_connection) = false;
|
||||||
|
option (needs_authentication) = false;
|
||||||
|
}
|
||||||
|
rpc disconnect (DisconnectRequest) returns (DisconnectResponse) {
|
||||||
|
option (needs_setup_connection) = false;
|
||||||
|
option (needs_authentication) = false;
|
||||||
|
}
|
||||||
|
rpc ping (PingRequest) returns (PingResponse) {
|
||||||
|
option (needs_setup_connection) = false;
|
||||||
|
option (needs_authentication) = false;
|
||||||
|
}
|
||||||
|
rpc device_info (DeviceInfoRequest) returns (DeviceInfoResponse) {
|
||||||
|
option (needs_authentication) = false;
|
||||||
|
}
|
||||||
|
rpc list_entities (ListEntitiesRequest) returns (void) {}
|
||||||
|
rpc subscribe_states (SubscribeStatesRequest) returns (void) {}
|
||||||
|
rpc subscribe_logs (SubscribeLogsRequest) returns (void) {}
|
||||||
|
rpc subscribe_service_calls (SubscribeServiceCallsRequest) returns (void) {}
|
||||||
|
rpc subscribe_home_assistant_states (SubscribeHomeAssistantStatesRequest) returns (void) {}
|
||||||
|
rpc get_time (GetTimeRequest) returns (GetTimeResponse) {
|
||||||
|
option (needs_authentication) = false;
|
||||||
|
}
|
||||||
|
rpc execute_service (ExecuteServiceRequest) returns (void) {}
|
||||||
|
|
||||||
|
rpc cover_command (CoverCommandRequest) returns (void) {}
|
||||||
|
rpc fan_command (FanCommandRequest) returns (void) {}
|
||||||
|
rpc light_command (LightCommandRequest) returns (void) {}
|
||||||
|
rpc switch_command (SwitchCommandRequest) returns (void) {}
|
||||||
|
rpc camera_image (CameraImageRequest) returns (void) {}
|
||||||
|
rpc climate_command (ClimateCommandRequest) returns (void) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ==================== BASE PACKETS ====================
|
// ==================== BASE PACKETS ====================
|
||||||
|
|
||||||
|
@ -21,8 +61,11 @@ syntax = "proto3";
|
||||||
|
|
||||||
// Message sent at the beginning of each connection
|
// Message sent at the beginning of each connection
|
||||||
// Can only be sent by the client and only at the beginning of the connection
|
// Can only be sent by the client and only at the beginning of the connection
|
||||||
// ID: 1
|
|
||||||
message HelloRequest {
|
message HelloRequest {
|
||||||
|
option (id) = 1;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
// Description of client (like User Agent)
|
// Description of client (like User Agent)
|
||||||
// For example "Home Assistant"
|
// For example "Home Assistant"
|
||||||
// Not strictly necessary to send but nice for debugging
|
// Not strictly necessary to send but nice for debugging
|
||||||
|
@ -32,8 +75,11 @@ message HelloRequest {
|
||||||
|
|
||||||
// Confirmation of successful connection request.
|
// Confirmation of successful connection request.
|
||||||
// Can only be sent by the server and only at the beginning of the connection
|
// Can only be sent by the server and only at the beginning of the connection
|
||||||
// ID: 2
|
|
||||||
message HelloResponse {
|
message HelloResponse {
|
||||||
|
option (id) = 2;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
// The version of the API to use. The _client_ (for example Home Assistant) needs to check
|
// The version of the API to use. The _client_ (for example Home Assistant) needs to check
|
||||||
// for compatibility and if necessary adopt to an older API.
|
// for compatibility and if necessary adopt to an older API.
|
||||||
// Major is for breaking changes in the base protocol - a mismatch will lead to immediate disconnect_client_
|
// Major is for breaking changes in the base protocol - a mismatch will lead to immediate disconnect_client_
|
||||||
|
@ -49,49 +95,66 @@ message HelloResponse {
|
||||||
|
|
||||||
// Message sent at the beginning of each connection to authenticate the client
|
// Message sent at the beginning of each connection to authenticate the client
|
||||||
// Can only be sent by the client and only at the beginning of the connection
|
// Can only be sent by the client and only at the beginning of the connection
|
||||||
// ID: 3
|
|
||||||
message ConnectRequest {
|
message ConnectRequest {
|
||||||
|
option (id) = 3;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
// The password to log in with
|
// The password to log in with
|
||||||
string password = 1;
|
string password = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation of successful connection. After this the connection is available for all traffic.
|
// Confirmation of successful connection. After this the connection is available for all traffic.
|
||||||
// Can only be sent by the server and only at the beginning of the connection
|
// Can only be sent by the server and only at the beginning of the connection
|
||||||
// ID: 4
|
|
||||||
message ConnectResponse {
|
message ConnectResponse {
|
||||||
|
option (id) = 4;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
bool invalid_password = 1;
|
bool invalid_password = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request to close the connection.
|
// Request to close the connection.
|
||||||
// Can be sent by both the client and server
|
// Can be sent by both the client and server
|
||||||
// ID: 5
|
|
||||||
message DisconnectRequest {
|
message DisconnectRequest {
|
||||||
|
option (id) = 5;
|
||||||
|
option (source) = SOURCE_BOTH;
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
// Do not close the connection before the acknowledgement arrives
|
// Do not close the connection before the acknowledgement arrives
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 6
|
|
||||||
message DisconnectResponse {
|
message DisconnectResponse {
|
||||||
|
option (id) = 6;
|
||||||
|
option (source) = SOURCE_BOTH;
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
// Empty - Both parties are required to close the connection after this
|
// Empty - Both parties are required to close the connection after this
|
||||||
// message has been received.
|
// message has been received.
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 7
|
|
||||||
message PingRequest {
|
message PingRequest {
|
||||||
|
option (id) = 7;
|
||||||
|
option (source) = SOURCE_BOTH;
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 8
|
|
||||||
message PingResponse {
|
message PingResponse {
|
||||||
|
option (id) = 8;
|
||||||
|
option (source) = SOURCE_BOTH;
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 9
|
|
||||||
message DeviceInfoRequest {
|
message DeviceInfoRequest {
|
||||||
|
option (id) = 9;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 10
|
|
||||||
message DeviceInfoResponse {
|
message DeviceInfoResponse {
|
||||||
|
option (id) = 10;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
|
||||||
bool uses_password = 1;
|
bool uses_password = 1;
|
||||||
|
|
||||||
// The name of the node, given by "App.set_name()"
|
// The name of the node, given by "App.set_name()"
|
||||||
|
@ -101,7 +164,7 @@ message DeviceInfoResponse {
|
||||||
string mac_address = 3;
|
string mac_address = 3;
|
||||||
|
|
||||||
// A string describing the ESPHome version. For example "1.10.0"
|
// A string describing the ESPHome version. For example "1.10.0"
|
||||||
string esphome_core_version = 4;
|
string esphome_version = 4;
|
||||||
|
|
||||||
// A string describing the date of compilation, this is generated by the compiler
|
// A string describing the date of compilation, this is generated by the compiler
|
||||||
// and therefore may not be in the same format all the time.
|
// and therefore may not be in the same format all the time.
|
||||||
|
@ -114,22 +177,29 @@ message DeviceInfoResponse {
|
||||||
bool has_deep_sleep = 7;
|
bool has_deep_sleep = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 11
|
|
||||||
message ListEntitiesRequest {
|
message ListEntitiesRequest {
|
||||||
|
option (id) = 11;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
// ID: 19
|
|
||||||
message ListEntitiesDoneResponse {
|
message ListEntitiesDoneResponse {
|
||||||
|
option (id) = 19;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (no_delay) = true;
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
// ID: 20
|
|
||||||
message SubscribeStatesRequest {
|
message SubscribeStatesRequest {
|
||||||
|
option (id) = 20;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== BINARY SENSOR ====================
|
// ==================== BINARY SENSOR ====================
|
||||||
// ID: 12
|
|
||||||
message ListEntitiesBinarySensorResponse {
|
message ListEntitiesBinarySensorResponse {
|
||||||
|
option (id) = 12;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_BINARY_SENSOR";
|
||||||
|
|
||||||
string object_id = 1;
|
string object_id = 1;
|
||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
|
@ -138,15 +208,22 @@ message ListEntitiesBinarySensorResponse {
|
||||||
string device_class = 5;
|
string device_class = 5;
|
||||||
bool is_status_binary_sensor = 6;
|
bool is_status_binary_sensor = 6;
|
||||||
}
|
}
|
||||||
// ID: 21
|
|
||||||
message BinarySensorStateResponse {
|
message BinarySensorStateResponse {
|
||||||
|
option (id) = 21;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_BINARY_SENSOR";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
bool state = 2;
|
bool state = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== COVER ====================
|
// ==================== COVER ====================
|
||||||
// ID: 13
|
|
||||||
message ListEntitiesCoverResponse {
|
message ListEntitiesCoverResponse {
|
||||||
|
option (id) = 13;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_COVER";
|
||||||
|
|
||||||
string object_id = 1;
|
string object_id = 1;
|
||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
|
@ -157,38 +234,47 @@ message ListEntitiesCoverResponse {
|
||||||
bool supports_tilt = 7;
|
bool supports_tilt = 7;
|
||||||
string device_class = 8;
|
string device_class = 8;
|
||||||
}
|
}
|
||||||
// ID: 22
|
|
||||||
message CoverStateResponse {
|
|
||||||
fixed32 key = 1;
|
|
||||||
|
|
||||||
|
enum LegacyCoverState {
|
||||||
|
LEGACY_COVER_STATE_OPEN = 0;
|
||||||
|
LEGACY_COVER_STATE_CLOSED = 1;
|
||||||
|
}
|
||||||
|
enum CoverOperation {
|
||||||
|
COVER_OPERATION_IDLE = 0;
|
||||||
|
COVER_OPERATION_IS_OPENING = 1;
|
||||||
|
COVER_OPERATION_IS_CLOSING = 2;
|
||||||
|
}
|
||||||
|
message CoverStateResponse {
|
||||||
|
option (id) = 22;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_COVER";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
|
fixed32 key = 1;
|
||||||
// legacy: state has been removed in 1.13
|
// legacy: state has been removed in 1.13
|
||||||
// clients/servers must still send/accept it until the next protocol change
|
// clients/servers must still send/accept it until the next protocol change
|
||||||
enum LegacyCoverState {
|
|
||||||
OPEN = 0;
|
|
||||||
CLOSED = 1;
|
|
||||||
}
|
|
||||||
LegacyCoverState legacy_state = 2;
|
LegacyCoverState legacy_state = 2;
|
||||||
|
|
||||||
float position = 3;
|
float position = 3;
|
||||||
float tilt = 4;
|
float tilt = 4;
|
||||||
enum CoverOperation {
|
|
||||||
IDLE = 0;
|
|
||||||
IS_OPENING = 1;
|
|
||||||
IS_CLOSING = 2;
|
|
||||||
}
|
|
||||||
CoverOperation current_operation = 5;
|
CoverOperation current_operation = 5;
|
||||||
}
|
}
|
||||||
// ID: 30
|
|
||||||
|
enum LegacyCoverCommand {
|
||||||
|
LEGACY_COVER_COMMAND_OPEN = 0;
|
||||||
|
LEGACY_COVER_COMMAND_CLOSE = 1;
|
||||||
|
LEGACY_COVER_COMMAND_STOP = 2;
|
||||||
|
}
|
||||||
message CoverCommandRequest {
|
message CoverCommandRequest {
|
||||||
|
option (id) = 30;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
option (ifdef) = "USE_COVER";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
|
|
||||||
// legacy: command has been removed in 1.13
|
// legacy: command has been removed in 1.13
|
||||||
// clients/servers must still send/accept it until the next protocol change
|
// clients/servers must still send/accept it until the next protocol change
|
||||||
enum LegacyCoverCommand {
|
|
||||||
OPEN = 0;
|
|
||||||
CLOSE = 1;
|
|
||||||
STOP = 2;
|
|
||||||
}
|
|
||||||
bool has_legacy_command = 2;
|
bool has_legacy_command = 2;
|
||||||
LegacyCoverCommand legacy_command = 3;
|
LegacyCoverCommand legacy_command = 3;
|
||||||
|
|
||||||
|
@ -200,8 +286,11 @@ message CoverCommandRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== FAN ====================
|
// ==================== FAN ====================
|
||||||
// ID: 14
|
|
||||||
message ListEntitiesFanResponse {
|
message ListEntitiesFanResponse {
|
||||||
|
option (id) = 14;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_FAN";
|
||||||
|
|
||||||
string object_id = 1;
|
string object_id = 1;
|
||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
|
@ -211,19 +300,27 @@ message ListEntitiesFanResponse {
|
||||||
bool supports_speed = 6;
|
bool supports_speed = 6;
|
||||||
}
|
}
|
||||||
enum FanSpeed {
|
enum FanSpeed {
|
||||||
LOW = 0;
|
FAN_SPEED_LOW = 0;
|
||||||
MEDIUM = 1;
|
FAN_SPEED_MEDIUM = 1;
|
||||||
HIGH = 2;
|
FAN_SPEED_HIGH = 2;
|
||||||
}
|
}
|
||||||
// ID: 23
|
|
||||||
message FanStateResponse {
|
message FanStateResponse {
|
||||||
|
option (id) = 23;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_FAN";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
bool state = 2;
|
bool state = 2;
|
||||||
bool oscillating = 3;
|
bool oscillating = 3;
|
||||||
FanSpeed speed = 4;
|
FanSpeed speed = 4;
|
||||||
}
|
}
|
||||||
// ID: 31
|
|
||||||
message FanCommandRequest {
|
message FanCommandRequest {
|
||||||
|
option (id) = 31;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
option (ifdef) = "USE_FAN";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
bool has_state = 2;
|
bool has_state = 2;
|
||||||
bool state = 3;
|
bool state = 3;
|
||||||
|
@ -234,8 +331,11 @@ message FanCommandRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== LIGHT ====================
|
// ==================== LIGHT ====================
|
||||||
// ID: 15
|
|
||||||
message ListEntitiesLightResponse {
|
message ListEntitiesLightResponse {
|
||||||
|
option (id) = 15;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_LIGHT";
|
||||||
|
|
||||||
string object_id = 1;
|
string object_id = 1;
|
||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
|
@ -249,8 +349,12 @@ message ListEntitiesLightResponse {
|
||||||
float max_mireds = 10;
|
float max_mireds = 10;
|
||||||
repeated string effects = 11;
|
repeated string effects = 11;
|
||||||
}
|
}
|
||||||
// ID: 24
|
|
||||||
message LightStateResponse {
|
message LightStateResponse {
|
||||||
|
option (id) = 24;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_LIGHT";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
bool state = 2;
|
bool state = 2;
|
||||||
float brightness = 3;
|
float brightness = 3;
|
||||||
|
@ -261,8 +365,12 @@ message LightStateResponse {
|
||||||
float color_temperature = 8;
|
float color_temperature = 8;
|
||||||
string effect = 9;
|
string effect = 9;
|
||||||
}
|
}
|
||||||
// ID: 32
|
|
||||||
message LightCommandRequest {
|
message LightCommandRequest {
|
||||||
|
option (id) = 32;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
option (ifdef) = "USE_LIGHT";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
bool has_state = 2;
|
bool has_state = 2;
|
||||||
bool state = 3;
|
bool state = 3;
|
||||||
|
@ -285,8 +393,11 @@ message LightCommandRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== SENSOR ====================
|
// ==================== SENSOR ====================
|
||||||
// ID: 16
|
|
||||||
message ListEntitiesSensorResponse {
|
message ListEntitiesSensorResponse {
|
||||||
|
option (id) = 16;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_SENSOR";
|
||||||
|
|
||||||
string object_id = 1;
|
string object_id = 1;
|
||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
|
@ -296,15 +407,22 @@ message ListEntitiesSensorResponse {
|
||||||
string unit_of_measurement = 6;
|
string unit_of_measurement = 6;
|
||||||
int32 accuracy_decimals = 7;
|
int32 accuracy_decimals = 7;
|
||||||
}
|
}
|
||||||
// ID: 25
|
|
||||||
message SensorStateResponse {
|
message SensorStateResponse {
|
||||||
|
option (id) = 25;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_SENSOR";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
float state = 2;
|
float state = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== SWITCH ====================
|
// ==================== SWITCH ====================
|
||||||
// ID: 17
|
|
||||||
message ListEntitiesSwitchResponse {
|
message ListEntitiesSwitchResponse {
|
||||||
|
option (id) = 17;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_SWITCH";
|
||||||
|
|
||||||
string object_id = 1;
|
string object_id = 1;
|
||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
|
@ -313,20 +431,31 @@ message ListEntitiesSwitchResponse {
|
||||||
string icon = 5;
|
string icon = 5;
|
||||||
bool assumed_state = 6;
|
bool assumed_state = 6;
|
||||||
}
|
}
|
||||||
// ID: 26
|
|
||||||
message SwitchStateResponse {
|
message SwitchStateResponse {
|
||||||
|
option (id) = 26;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_SWITCH";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
bool state = 2;
|
bool state = 2;
|
||||||
}
|
}
|
||||||
// ID: 33
|
|
||||||
message SwitchCommandRequest {
|
message SwitchCommandRequest {
|
||||||
|
option (id) = 33;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
option (ifdef) = "USE_SWITCH";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
bool state = 2;
|
bool state = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== TEXT SENSOR ====================
|
// ==================== TEXT SENSOR ====================
|
||||||
// ID: 18
|
|
||||||
message ListEntitiesTextSensorResponse {
|
message ListEntitiesTextSensorResponse {
|
||||||
|
option (id) = 18;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_TEXT_SENSOR";
|
||||||
|
|
||||||
string object_id = 1;
|
string object_id = 1;
|
||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
|
@ -334,29 +463,38 @@ message ListEntitiesTextSensorResponse {
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5;
|
||||||
}
|
}
|
||||||
// ID: 27
|
|
||||||
message TextSensorStateResponse {
|
message TextSensorStateResponse {
|
||||||
|
option (id) = 27;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_TEXT_SENSOR";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
string state = 2;
|
string state = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== SUBSCRIBE LOGS ====================
|
// ==================== SUBSCRIBE LOGS ====================
|
||||||
enum LogLevel {
|
enum LogLevel {
|
||||||
NONE = 0;
|
LOG_LEVEL_NONE = 0;
|
||||||
ERROR = 1;
|
LOG_LEVEL_ERROR = 1;
|
||||||
WARN = 2;
|
LOG_LEVEL_WARN = 2;
|
||||||
INFO = 3;
|
LOG_LEVEL_INFO = 3;
|
||||||
DEBUG = 4;
|
LOG_LEVEL_DEBUG = 4;
|
||||||
VERBOSE = 5;
|
LOG_LEVEL_VERBOSE = 5;
|
||||||
VERY_VERBOSE = 6;
|
LOG_LEVEL_VERY_VERBOSE = 6;
|
||||||
}
|
}
|
||||||
// ID: 28
|
|
||||||
message SubscribeLogsRequest {
|
message SubscribeLogsRequest {
|
||||||
|
option (id) = 28;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
LogLevel level = 1;
|
LogLevel level = 1;
|
||||||
bool dump_config = 2;
|
bool dump_config = 2;
|
||||||
}
|
}
|
||||||
// ID: 29
|
|
||||||
message SubscribeLogsResponse {
|
message SubscribeLogsResponse {
|
||||||
|
option (id) = 29;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (log) = false;
|
||||||
|
option (no_delay) = false;
|
||||||
|
|
||||||
LogLevel level = 1;
|
LogLevel level = 1;
|
||||||
string tag = 2;
|
string tag = 2;
|
||||||
string message = 3;
|
string message = 3;
|
||||||
|
@ -364,109 +502,152 @@ message SubscribeLogsResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== HOMEASSISTANT.SERVICE ====================
|
// ==================== HOMEASSISTANT.SERVICE ====================
|
||||||
// ID: 34
|
|
||||||
message SubscribeServiceCallsRequest {
|
message SubscribeServiceCallsRequest {
|
||||||
|
option (id) = 34;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ServiceCallMap {
|
||||||
|
string key = 1;
|
||||||
|
string value = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 35
|
|
||||||
message ServiceCallResponse {
|
message ServiceCallResponse {
|
||||||
|
option (id) = 35;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
string service = 1;
|
string service = 1;
|
||||||
map<string, string> data = 2;
|
repeated ServiceCallMap data = 2;
|
||||||
map<string, string> data_template = 3;
|
repeated ServiceCallMap data_template = 3;
|
||||||
map<string, string> variables = 4;
|
repeated ServiceCallMap variables = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== IMPORT HOME ASSISTANT STATES ====================
|
// ==================== IMPORT HOME ASSISTANT STATES ====================
|
||||||
// 1. Client sends SubscribeHomeAssistantStatesRequest
|
// 1. Client sends SubscribeHomeAssistantStatesRequest
|
||||||
// 2. Server responds with zero or more SubscribeHomeAssistantStateResponse (async)
|
// 2. Server responds with zero or more SubscribeHomeAssistantStateResponse (async)
|
||||||
// 3. Client sends HomeAssistantStateResponse for state changes.
|
// 3. Client sends HomeAssistantStateResponse for state changes.
|
||||||
// ID: 38
|
|
||||||
message SubscribeHomeAssistantStatesRequest {
|
message SubscribeHomeAssistantStatesRequest {
|
||||||
|
option (id) = 38;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 39
|
|
||||||
message SubscribeHomeAssistantStateResponse {
|
message SubscribeHomeAssistantStateResponse {
|
||||||
|
option (id) = 39;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
string entity_id = 1;
|
string entity_id = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 40
|
|
||||||
message HomeAssistantStateResponse {
|
message HomeAssistantStateResponse {
|
||||||
|
option (id) = 40;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
string entity_id = 1;
|
string entity_id = 1;
|
||||||
string state = 2;
|
string state = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== IMPORT TIME ====================
|
// ==================== IMPORT TIME ====================
|
||||||
// ID: 36
|
|
||||||
message GetTimeRequest {
|
message GetTimeRequest {
|
||||||
|
option (id) = 36;
|
||||||
|
option (source) = SOURCE_BOTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 37
|
|
||||||
message GetTimeResponse {
|
message GetTimeResponse {
|
||||||
|
option (id) = 37;
|
||||||
|
option (source) = SOURCE_BOTH;
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 epoch_seconds = 1;
|
fixed32 epoch_seconds = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== USER-DEFINES SERVICES ====================
|
// ==================== USER-DEFINES SERVICES ====================
|
||||||
|
enum ServiceArgType {
|
||||||
|
SERVICE_ARG_TYPE_BOOL = 0;
|
||||||
|
SERVICE_ARG_TYPE_INT = 1;
|
||||||
|
SERVICE_ARG_TYPE_FLOAT = 2;
|
||||||
|
SERVICE_ARG_TYPE_STRING = 3;
|
||||||
|
SERVICE_ARG_TYPE_BOOL_ARRAY = 4;
|
||||||
|
SERVICE_ARG_TYPE_INT_ARRAY = 5;
|
||||||
|
SERVICE_ARG_TYPE_FLOAT_ARRAY = 6;
|
||||||
|
SERVICE_ARG_TYPE_STRING_ARRAY = 7;
|
||||||
|
}
|
||||||
message ListEntitiesServicesArgument {
|
message ListEntitiesServicesArgument {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
enum Type {
|
ServiceArgType type = 2;
|
||||||
BOOL = 0;
|
|
||||||
INT = 1;
|
|
||||||
FLOAT = 2;
|
|
||||||
STRING = 3;
|
|
||||||
}
|
|
||||||
Type type = 2;
|
|
||||||
}
|
}
|
||||||
// ID: 41
|
|
||||||
message ListEntitiesServicesResponse {
|
message ListEntitiesServicesResponse {
|
||||||
|
option (id) = 41;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
|
||||||
string name = 1;
|
string name = 1;
|
||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
repeated ListEntitiesServicesArgument args = 3;
|
repeated ListEntitiesServicesArgument args = 3;
|
||||||
}
|
}
|
||||||
message ExecuteServiceArgument {
|
message ExecuteServiceArgument {
|
||||||
bool bool_ = 1;
|
bool bool_ = 1;
|
||||||
int32 int_ = 2;
|
int32 legacy_int = 2;
|
||||||
float float_ = 3;
|
float float_ = 3;
|
||||||
string string_ = 4;
|
string string_ = 4;
|
||||||
|
// ESPHome 1.14 (api v1.3) make int a signed value
|
||||||
|
sint32 int_ = 5;
|
||||||
|
repeated bool bool_array = 6 [packed=false];
|
||||||
|
repeated sint32 int_array = 7 [packed=false];
|
||||||
|
repeated float float_array = 8 [packed=false];
|
||||||
|
repeated string string_array = 9;
|
||||||
}
|
}
|
||||||
// ID: 42
|
|
||||||
message ExecuteServiceRequest {
|
message ExecuteServiceRequest {
|
||||||
|
option (id) = 42;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
repeated ExecuteServiceArgument args = 2;
|
repeated ExecuteServiceArgument args = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== CAMERA ====================
|
// ==================== CAMERA ====================
|
||||||
// ID: 43
|
|
||||||
message ListEntitiesCameraResponse {
|
message ListEntitiesCameraResponse {
|
||||||
|
option (id) = 43;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_ESP32_CAMERA";
|
||||||
|
|
||||||
string object_id = 1;
|
string object_id = 1;
|
||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID: 44
|
|
||||||
message CameraImageResponse {
|
message CameraImageResponse {
|
||||||
|
option (id) = 44;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_ESP32_CAMERA";
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
bytes data = 2;
|
bytes data = 2;
|
||||||
bool done = 3;
|
bool done = 3;
|
||||||
}
|
}
|
||||||
// ID: 45
|
|
||||||
message CameraImageRequest {
|
message CameraImageRequest {
|
||||||
|
option (id) = 45;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
option (ifdef) = "USE_ESP32_CAMERA";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
bool single = 1;
|
bool single = 1;
|
||||||
bool stream = 2;
|
bool stream = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== CLIMATE ====================
|
// ==================== CLIMATE ====================
|
||||||
enum ClimateMode {
|
enum ClimateMode {
|
||||||
OFF = 0;
|
CLIMATE_MODE_OFF = 0;
|
||||||
AUTO = 1;
|
CLIMATE_MODE_AUTO = 1;
|
||||||
COOL = 2;
|
CLIMATE_MODE_COOL = 2;
|
||||||
HEAT = 3;
|
CLIMATE_MODE_HEAT = 3;
|
||||||
}
|
}
|
||||||
// ID: 46
|
|
||||||
message ListEntitiesClimateResponse {
|
message ListEntitiesClimateResponse {
|
||||||
|
option (id) = 46;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_CLIMATE";
|
||||||
|
|
||||||
string object_id = 1;
|
string object_id = 1;
|
||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
|
@ -480,8 +661,12 @@ message ListEntitiesClimateResponse {
|
||||||
float visual_temperature_step = 10;
|
float visual_temperature_step = 10;
|
||||||
bool supports_away = 11;
|
bool supports_away = 11;
|
||||||
}
|
}
|
||||||
// ID: 47
|
|
||||||
message ClimateStateResponse {
|
message ClimateStateResponse {
|
||||||
|
option (id) = 47;
|
||||||
|
option (source) = SOURCE_SERVER;
|
||||||
|
option (ifdef) = "USE_CLIMATE";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
ClimateMode mode = 2;
|
ClimateMode mode = 2;
|
||||||
float current_temperature = 3;
|
float current_temperature = 3;
|
||||||
|
@ -490,8 +675,12 @@ message ClimateStateResponse {
|
||||||
float target_temperature_high = 6;
|
float target_temperature_high = 6;
|
||||||
bool away = 7;
|
bool away = 7;
|
||||||
}
|
}
|
||||||
// ID: 48
|
|
||||||
message ClimateCommandRequest {
|
message ClimateCommandRequest {
|
||||||
|
option (id) = 48;
|
||||||
|
option (source) = SOURCE_CLIENT;
|
||||||
|
option (ifdef) = "USE_CLIMATE";
|
||||||
|
option (no_delay) = true;
|
||||||
|
|
||||||
fixed32 key = 1;
|
fixed32 key = 1;
|
||||||
bool has_mode = 2;
|
bool has_mode = 2;
|
||||||
ClimateMode mode = 3;
|
ClimateMode mode = 3;
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
syntax = "proto2";
|
||||||
|
import "google/protobuf/descriptor.proto";
|
||||||
|
|
||||||
|
|
||||||
|
enum APISourceType {
|
||||||
|
SOURCE_BOTH = 0;
|
||||||
|
SOURCE_SERVER = 1;
|
||||||
|
SOURCE_CLIENT = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message void {}
|
||||||
|
|
||||||
|
extend google.protobuf.MethodOptions {
|
||||||
|
optional bool needs_setup_connection = 1038 [default=true];
|
||||||
|
optional bool needs_authentication = 1039 [default=true];
|
||||||
|
}
|
||||||
|
|
||||||
|
extend google.protobuf.MessageOptions {
|
||||||
|
optional uint32 id = 1036 [default=0];
|
||||||
|
optional APISourceType source = 1037 [default=SOURCE_BOTH];
|
||||||
|
optional string ifdef = 1038;
|
||||||
|
optional bool log = 1039 [default=true];
|
||||||
|
optional bool no_delay = 1040 [default=false];
|
||||||
|
}
|
|
@ -0,0 +1,168 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
|
# source: api_options.proto
|
||||||
|
|
||||||
|
import sys
|
||||||
|
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||||
|
from google.protobuf.internal import enum_type_wrapper
|
||||||
|
from google.protobuf import descriptor as _descriptor
|
||||||
|
from google.protobuf import message as _message
|
||||||
|
from google.protobuf import reflection as _reflection
|
||||||
|
from google.protobuf import symbol_database as _symbol_database
|
||||||
|
# @@protoc_insertion_point(imports)
|
||||||
|
|
||||||
|
_sym_db = _symbol_database.Default()
|
||||||
|
|
||||||
|
|
||||||
|
from google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTOR = _descriptor.FileDescriptor(
|
||||||
|
name='api_options.proto',
|
||||||
|
package='',
|
||||||
|
syntax='proto2',
|
||||||
|
serialized_options=None,
|
||||||
|
serialized_pb=_b('\n\x11\x61pi_options.proto\x1a google/protobuf/descriptor.proto\"\x06\n\x04void*F\n\rAPISourceType\x12\x0f\n\x0bSOURCE_BOTH\x10\x00\x12\x11\n\rSOURCE_SERVER\x10\x01\x12\x11\n\rSOURCE_CLIENT\x10\x02:E\n\x16needs_setup_connection\x12\x1e.google.protobuf.MethodOptions\x18\x8e\x08 \x01(\x08:\x04true:C\n\x14needs_authentication\x12\x1e.google.protobuf.MethodOptions\x18\x8f\x08 \x01(\x08:\x04true:/\n\x02id\x12\x1f.google.protobuf.MessageOptions\x18\x8c\x08 \x01(\r:\x01\x30:M\n\x06source\x12\x1f.google.protobuf.MessageOptions\x18\x8d\x08 \x01(\x0e\x32\x0e.APISourceType:\x0bSOURCE_BOTH:/\n\x05ifdef\x12\x1f.google.protobuf.MessageOptions\x18\x8e\x08 \x01(\t:3\n\x03log\x12\x1f.google.protobuf.MessageOptions\x18\x8f\x08 \x01(\x08:\x04true:9\n\x08no_delay\x12\x1f.google.protobuf.MessageOptions\x18\x90\x08 \x01(\x08:\x05\x66\x61lse')
|
||||||
|
,
|
||||||
|
dependencies=[google_dot_protobuf_dot_descriptor__pb2.DESCRIPTOR,])
|
||||||
|
|
||||||
|
_APISOURCETYPE = _descriptor.EnumDescriptor(
|
||||||
|
name='APISourceType',
|
||||||
|
full_name='APISourceType',
|
||||||
|
filename=None,
|
||||||
|
file=DESCRIPTOR,
|
||||||
|
values=[
|
||||||
|
_descriptor.EnumValueDescriptor(
|
||||||
|
name='SOURCE_BOTH', index=0, number=0,
|
||||||
|
serialized_options=None,
|
||||||
|
type=None),
|
||||||
|
_descriptor.EnumValueDescriptor(
|
||||||
|
name='SOURCE_SERVER', index=1, number=1,
|
||||||
|
serialized_options=None,
|
||||||
|
type=None),
|
||||||
|
_descriptor.EnumValueDescriptor(
|
||||||
|
name='SOURCE_CLIENT', index=2, number=2,
|
||||||
|
serialized_options=None,
|
||||||
|
type=None),
|
||||||
|
],
|
||||||
|
containing_type=None,
|
||||||
|
serialized_options=None,
|
||||||
|
serialized_start=63,
|
||||||
|
serialized_end=133,
|
||||||
|
)
|
||||||
|
_sym_db.RegisterEnumDescriptor(_APISOURCETYPE)
|
||||||
|
|
||||||
|
APISourceType = enum_type_wrapper.EnumTypeWrapper(_APISOURCETYPE)
|
||||||
|
SOURCE_BOTH = 0
|
||||||
|
SOURCE_SERVER = 1
|
||||||
|
SOURCE_CLIENT = 2
|
||||||
|
|
||||||
|
NEEDS_SETUP_CONNECTION_FIELD_NUMBER = 1038
|
||||||
|
needs_setup_connection = _descriptor.FieldDescriptor(
|
||||||
|
name='needs_setup_connection', full_name='needs_setup_connection', index=0,
|
||||||
|
number=1038, type=8, cpp_type=7, label=1,
|
||||||
|
has_default_value=True, default_value=True,
|
||||||
|
message_type=None, enum_type=None, containing_type=None,
|
||||||
|
is_extension=True, extension_scope=None,
|
||||||
|
serialized_options=None, file=DESCRIPTOR)
|
||||||
|
NEEDS_AUTHENTICATION_FIELD_NUMBER = 1039
|
||||||
|
needs_authentication = _descriptor.FieldDescriptor(
|
||||||
|
name='needs_authentication', full_name='needs_authentication', index=1,
|
||||||
|
number=1039, type=8, cpp_type=7, label=1,
|
||||||
|
has_default_value=True, default_value=True,
|
||||||
|
message_type=None, enum_type=None, containing_type=None,
|
||||||
|
is_extension=True, extension_scope=None,
|
||||||
|
serialized_options=None, file=DESCRIPTOR)
|
||||||
|
ID_FIELD_NUMBER = 1036
|
||||||
|
id = _descriptor.FieldDescriptor(
|
||||||
|
name='id', full_name='id', index=2,
|
||||||
|
number=1036, type=13, cpp_type=3, label=1,
|
||||||
|
has_default_value=True, default_value=0,
|
||||||
|
message_type=None, enum_type=None, containing_type=None,
|
||||||
|
is_extension=True, extension_scope=None,
|
||||||
|
serialized_options=None, file=DESCRIPTOR)
|
||||||
|
SOURCE_FIELD_NUMBER = 1037
|
||||||
|
source = _descriptor.FieldDescriptor(
|
||||||
|
name='source', full_name='source', index=3,
|
||||||
|
number=1037, type=14, cpp_type=8, label=1,
|
||||||
|
has_default_value=True, default_value=0,
|
||||||
|
message_type=None, enum_type=None, containing_type=None,
|
||||||
|
is_extension=True, extension_scope=None,
|
||||||
|
serialized_options=None, file=DESCRIPTOR)
|
||||||
|
IFDEF_FIELD_NUMBER = 1038
|
||||||
|
ifdef = _descriptor.FieldDescriptor(
|
||||||
|
name='ifdef', full_name='ifdef', index=4,
|
||||||
|
number=1038, type=9, cpp_type=9, label=1,
|
||||||
|
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||||
|
message_type=None, enum_type=None, containing_type=None,
|
||||||
|
is_extension=True, extension_scope=None,
|
||||||
|
serialized_options=None, file=DESCRIPTOR)
|
||||||
|
LOG_FIELD_NUMBER = 1039
|
||||||
|
log = _descriptor.FieldDescriptor(
|
||||||
|
name='log', full_name='log', index=5,
|
||||||
|
number=1039, type=8, cpp_type=7, label=1,
|
||||||
|
has_default_value=True, default_value=True,
|
||||||
|
message_type=None, enum_type=None, containing_type=None,
|
||||||
|
is_extension=True, extension_scope=None,
|
||||||
|
serialized_options=None, file=DESCRIPTOR)
|
||||||
|
NO_DELAY_FIELD_NUMBER = 1040
|
||||||
|
no_delay = _descriptor.FieldDescriptor(
|
||||||
|
name='no_delay', full_name='no_delay', index=6,
|
||||||
|
number=1040, type=8, cpp_type=7, label=1,
|
||||||
|
has_default_value=True, default_value=False,
|
||||||
|
message_type=None, enum_type=None, containing_type=None,
|
||||||
|
is_extension=True, extension_scope=None,
|
||||||
|
serialized_options=None, file=DESCRIPTOR)
|
||||||
|
|
||||||
|
|
||||||
|
_VOID = _descriptor.Descriptor(
|
||||||
|
name='void',
|
||||||
|
full_name='void',
|
||||||
|
filename=None,
|
||||||
|
file=DESCRIPTOR,
|
||||||
|
containing_type=None,
|
||||||
|
fields=[
|
||||||
|
],
|
||||||
|
extensions=[
|
||||||
|
],
|
||||||
|
nested_types=[],
|
||||||
|
enum_types=[
|
||||||
|
],
|
||||||
|
serialized_options=None,
|
||||||
|
is_extendable=False,
|
||||||
|
syntax='proto2',
|
||||||
|
extension_ranges=[],
|
||||||
|
oneofs=[
|
||||||
|
],
|
||||||
|
serialized_start=55,
|
||||||
|
serialized_end=61,
|
||||||
|
)
|
||||||
|
|
||||||
|
DESCRIPTOR.message_types_by_name['void'] = _VOID
|
||||||
|
DESCRIPTOR.enum_types_by_name['APISourceType'] = _APISOURCETYPE
|
||||||
|
DESCRIPTOR.extensions_by_name['needs_setup_connection'] = needs_setup_connection
|
||||||
|
DESCRIPTOR.extensions_by_name['needs_authentication'] = needs_authentication
|
||||||
|
DESCRIPTOR.extensions_by_name['id'] = id
|
||||||
|
DESCRIPTOR.extensions_by_name['source'] = source
|
||||||
|
DESCRIPTOR.extensions_by_name['ifdef'] = ifdef
|
||||||
|
DESCRIPTOR.extensions_by_name['log'] = log
|
||||||
|
DESCRIPTOR.extensions_by_name['no_delay'] = no_delay
|
||||||
|
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
||||||
|
|
||||||
|
void = _reflection.GeneratedProtocolMessageType('void', (_message.Message,), dict(
|
||||||
|
DESCRIPTOR = _VOID,
|
||||||
|
__module__ = 'api_options_pb2'
|
||||||
|
# @@protoc_insertion_point(class_scope:void)
|
||||||
|
))
|
||||||
|
_sym_db.RegisterMessage(void)
|
||||||
|
|
||||||
|
google_dot_protobuf_dot_descriptor__pb2.MethodOptions.RegisterExtension(needs_setup_connection)
|
||||||
|
google_dot_protobuf_dot_descriptor__pb2.MethodOptions.RegisterExtension(needs_authentication)
|
||||||
|
google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(id)
|
||||||
|
source.enum_type = _APISOURCETYPE
|
||||||
|
google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(source)
|
||||||
|
google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(ifdef)
|
||||||
|
google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(log)
|
||||||
|
google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(no_delay)
|
||||||
|
|
||||||
|
# @@protoc_insertion_point(module_scope)
|
File diff suppressed because one or more lines are too long
|
@ -78,7 +78,7 @@ class APIClient:
|
||||||
uses_password=resp.uses_password,
|
uses_password=resp.uses_password,
|
||||||
name=resp.name,
|
name=resp.name,
|
||||||
mac_address=resp.mac_address,
|
mac_address=resp.mac_address,
|
||||||
esphome_core_version=resp.esphome_core_version,
|
esphome_version=resp.esphome_version,
|
||||||
compilation_time=resp.compilation_time,
|
compilation_time=resp.compilation_time,
|
||||||
model=resp.model,
|
model=resp.model,
|
||||||
has_deep_sleep=resp.has_deep_sleep,
|
has_deep_sleep=resp.has_deep_sleep,
|
||||||
|
@ -357,13 +357,25 @@ class APIClient:
|
||||||
for arg_desc in service.args:
|
for arg_desc in service.args:
|
||||||
arg = pb.ExecuteServiceArgument()
|
arg = pb.ExecuteServiceArgument()
|
||||||
val = data[arg_desc.name]
|
val = data[arg_desc.name]
|
||||||
attr_ = {
|
int_type = 'int_' if self.api_version >= APIVersion(1, 3) else 'legacy_int'
|
||||||
|
map_single = {
|
||||||
UserServiceArgType.BOOL: 'bool_',
|
UserServiceArgType.BOOL: 'bool_',
|
||||||
UserServiceArgType.INT: 'int_',
|
UserServiceArgType.INT: int_type,
|
||||||
UserServiceArgType.FLOAT: 'float_',
|
UserServiceArgType.FLOAT: 'float_',
|
||||||
UserServiceArgType.STRING: 'string_',
|
UserServiceArgType.STRING: 'string_',
|
||||||
}[arg_desc.type_]
|
}
|
||||||
setattr(arg, attr_, val)
|
map_array = {
|
||||||
|
UserServiceArgType.BOOL_ARRAY: 'bool_array',
|
||||||
|
UserServiceArgType.INT_ARRAY: 'int_array',
|
||||||
|
UserServiceArgType.FLOAT_ARRAY: 'float_array',
|
||||||
|
UserServiceArgType.STRING_ARRAY: 'string_array',
|
||||||
|
}
|
||||||
|
if arg_desc.type_ in map_array:
|
||||||
|
attr = getattr(arg, map_array[arg_desc.type_])
|
||||||
|
attr.extend(val)
|
||||||
|
else:
|
||||||
|
setattr(arg, map_single[arg_desc.type_], val)
|
||||||
|
|
||||||
args.append(arg)
|
args.append(arg)
|
||||||
req.args.extend(args)
|
req.args.extend(args)
|
||||||
await self._connection.send_message(req)
|
await self._connection.send_message(req)
|
||||||
|
|
|
@ -177,8 +177,8 @@ class APIConnection:
|
||||||
return self._authenticated
|
return self._authenticated
|
||||||
|
|
||||||
async def _write(self, data: bytes) -> None:
|
async def _write(self, data: bytes) -> None:
|
||||||
_LOGGER.debug("%s: Write: %s", self._params.address,
|
# _LOGGER.debug("%s: Write: %s", self._params.address,
|
||||||
' '.join('{:02X}'.format(x) for x in data))
|
# ' '.join('{:02X}'.format(x) for x in data))
|
||||||
if not self._socket_connected:
|
if not self._socket_connected:
|
||||||
raise APIConnectionError("Socket is not connected")
|
raise APIConnectionError("Socket is not connected")
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -15,10 +15,10 @@ class DeviceInfo:
|
||||||
uses_password = attr.ib(type=bool)
|
uses_password = attr.ib(type=bool)
|
||||||
name = attr.ib(type=str)
|
name = attr.ib(type=str)
|
||||||
mac_address = attr.ib(type=str)
|
mac_address = attr.ib(type=str)
|
||||||
esphome_core_version = attr.ib(type=str)
|
|
||||||
compilation_time = attr.ib(type=str)
|
compilation_time = attr.ib(type=str)
|
||||||
model = attr.ib(type=str)
|
model = attr.ib(type=str)
|
||||||
has_deep_sleep = attr.ib(type=bool)
|
has_deep_sleep = attr.ib(type=bool)
|
||||||
|
esphome_version = attr.ib(type=str, default='')
|
||||||
|
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
|
@ -236,6 +236,10 @@ class UserServiceArgType(enum.IntEnum):
|
||||||
INT = 1
|
INT = 1
|
||||||
FLOAT = 2
|
FLOAT = 2
|
||||||
STRING = 3
|
STRING = 3
|
||||||
|
BOOL_ARRAY = 4
|
||||||
|
INT_ARRAY = 5
|
||||||
|
FLOAT_ARRAY = 6
|
||||||
|
STRING_ARRAY = 7
|
||||||
|
|
||||||
|
|
||||||
def _attr_obj_from_dict(cls, **kwargs):
|
def _attr_obj_from_dict(cls, **kwargs):
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Generate protobuf compiled files
|
||||||
|
protoc --python_out=aioesphomeapi -I aioesphomeapi aioesphomeapi/*.proto
|
||||||
|
|
||||||
|
# https://github.com/protocolbuffers/protobuf/issues/1491
|
||||||
|
sed -i '' 's/import api_options_pb2 as api__options__pb2/from . import api_options_pb2 as api__options__pb2/' aioesphomeapi/api_pb2.py
|
Loading…
Reference in New Issue