mirror of
https://github.com/esphome/esphome.git
synced 2025-08-03 17:07:54 +00:00
Reduce binary size with field-level conditional compilation for protobuf messages
This commit is contained in:
parent
84956b6dc5
commit
d2569c0f1e
@ -222,37 +222,37 @@ message DeviceInfoResponse {
|
|||||||
// The model of the board. For example NodeMCU
|
// The model of the board. For example NodeMCU
|
||||||
string model = 6;
|
string model = 6;
|
||||||
|
|
||||||
bool has_deep_sleep = 7;
|
bool has_deep_sleep = 7 [(field_ifdef) = "USE_DEEP_SLEEP"];
|
||||||
|
|
||||||
// The esphome project details if set
|
// The esphome project details if set
|
||||||
string project_name = 8;
|
string project_name = 8 [(field_ifdef) = "ESPHOME_PROJECT_NAME"];
|
||||||
string project_version = 9;
|
string project_version = 9 [(field_ifdef) = "ESPHOME_PROJECT_NAME"];
|
||||||
|
|
||||||
uint32 webserver_port = 10;
|
uint32 webserver_port = 10 [(field_ifdef) = "USE_WEBSERVER"];
|
||||||
|
|
||||||
uint32 legacy_bluetooth_proxy_version = 11;
|
uint32 legacy_bluetooth_proxy_version = 11 [(field_ifdef) = "USE_BLUETOOTH_PROXY"];
|
||||||
uint32 bluetooth_proxy_feature_flags = 15;
|
uint32 bluetooth_proxy_feature_flags = 15 [(field_ifdef) = "USE_BLUETOOTH_PROXY"];
|
||||||
|
|
||||||
string manufacturer = 12;
|
string manufacturer = 12;
|
||||||
|
|
||||||
string friendly_name = 13;
|
string friendly_name = 13;
|
||||||
|
|
||||||
uint32 legacy_voice_assistant_version = 14;
|
uint32 legacy_voice_assistant_version = 14 [(field_ifdef) = "USE_VOICE_ASSISTANT"];
|
||||||
uint32 voice_assistant_feature_flags = 17;
|
uint32 voice_assistant_feature_flags = 17 [(field_ifdef) = "USE_VOICE_ASSISTANT"];
|
||||||
|
|
||||||
string suggested_area = 16;
|
string suggested_area = 16 [(field_ifdef) = "USE_AREAS"];
|
||||||
|
|
||||||
// The Bluetooth mac address of the device. For example "AC:BC:32:89:0E:AA"
|
// The Bluetooth mac address of the device. For example "AC:BC:32:89:0E:AA"
|
||||||
string bluetooth_mac_address = 18;
|
string bluetooth_mac_address = 18 [(field_ifdef) = "USE_BLUETOOTH_PROXY"];
|
||||||
|
|
||||||
// Supports receiving and saving api encryption key
|
// Supports receiving and saving api encryption key
|
||||||
bool api_encryption_supported = 19;
|
bool api_encryption_supported = 19 [(field_ifdef) = "USE_API_NOISE"];
|
||||||
|
|
||||||
repeated DeviceInfo devices = 20;
|
repeated DeviceInfo devices = 20 [(field_ifdef) = "USE_DEVICES"];
|
||||||
repeated AreaInfo areas = 21;
|
repeated AreaInfo areas = 21 [(field_ifdef) = "USE_AREAS"];
|
||||||
|
|
||||||
// Top-level area info to phase out suggested_area
|
// Top-level area info to phase out suggested_area
|
||||||
AreaInfo area = 22;
|
AreaInfo area = 22 [(field_ifdef) = "USE_AREAS"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListEntitiesRequest {
|
message ListEntitiesRequest {
|
||||||
@ -295,9 +295,9 @@ message ListEntitiesBinarySensorResponse {
|
|||||||
string device_class = 5;
|
string device_class = 5;
|
||||||
bool is_status_binary_sensor = 6;
|
bool is_status_binary_sensor = 6;
|
||||||
bool disabled_by_default = 7;
|
bool disabled_by_default = 7;
|
||||||
string icon = 8;
|
string icon = 8 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
EntityCategory entity_category = 9;
|
EntityCategory entity_category = 9;
|
||||||
uint32 device_id = 10;
|
uint32 device_id = 10 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message BinarySensorStateResponse {
|
message BinarySensorStateResponse {
|
||||||
option (id) = 21;
|
option (id) = 21;
|
||||||
@ -331,10 +331,10 @@ message ListEntitiesCoverResponse {
|
|||||||
bool supports_tilt = 7;
|
bool supports_tilt = 7;
|
||||||
string device_class = 8;
|
string device_class = 8;
|
||||||
bool disabled_by_default = 9;
|
bool disabled_by_default = 9;
|
||||||
string icon = 10;
|
string icon = 10 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
EntityCategory entity_category = 11;
|
EntityCategory entity_category = 11;
|
||||||
bool supports_stop = 12;
|
bool supports_stop = 12;
|
||||||
uint32 device_id = 13;
|
uint32 device_id = 13 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
|
|
||||||
enum LegacyCoverState {
|
enum LegacyCoverState {
|
||||||
@ -388,7 +388,7 @@ message CoverCommandRequest {
|
|||||||
bool has_tilt = 6;
|
bool has_tilt = 6;
|
||||||
float tilt = 7;
|
float tilt = 7;
|
||||||
bool stop = 8;
|
bool stop = 8;
|
||||||
uint32 device_id = 9;
|
uint32 device_id = 9 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== FAN ====================
|
// ==================== FAN ====================
|
||||||
@ -408,10 +408,10 @@ message ListEntitiesFanResponse {
|
|||||||
bool supports_direction = 7;
|
bool supports_direction = 7;
|
||||||
int32 supported_speed_count = 8;
|
int32 supported_speed_count = 8;
|
||||||
bool disabled_by_default = 9;
|
bool disabled_by_default = 9;
|
||||||
string icon = 10;
|
string icon = 10 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
EntityCategory entity_category = 11;
|
EntityCategory entity_category = 11;
|
||||||
repeated string supported_preset_modes = 12;
|
repeated string supported_preset_modes = 12;
|
||||||
uint32 device_id = 13;
|
uint32 device_id = 13 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
enum FanSpeed {
|
enum FanSpeed {
|
||||||
FAN_SPEED_LOW = 0;
|
FAN_SPEED_LOW = 0;
|
||||||
@ -436,7 +436,7 @@ message FanStateResponse {
|
|||||||
FanDirection direction = 5;
|
FanDirection direction = 5;
|
||||||
int32 speed_level = 6;
|
int32 speed_level = 6;
|
||||||
string preset_mode = 7;
|
string preset_mode = 7;
|
||||||
uint32 device_id = 8;
|
uint32 device_id = 8 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message FanCommandRequest {
|
message FanCommandRequest {
|
||||||
option (id) = 31;
|
option (id) = 31;
|
||||||
@ -496,9 +496,9 @@ message ListEntitiesLightResponse {
|
|||||||
float max_mireds = 10;
|
float max_mireds = 10;
|
||||||
repeated string effects = 11;
|
repeated string effects = 11;
|
||||||
bool disabled_by_default = 13;
|
bool disabled_by_default = 13;
|
||||||
string icon = 14;
|
string icon = 14 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
EntityCategory entity_category = 15;
|
EntityCategory entity_category = 15;
|
||||||
uint32 device_id = 16;
|
uint32 device_id = 16 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message LightStateResponse {
|
message LightStateResponse {
|
||||||
option (id) = 24;
|
option (id) = 24;
|
||||||
@ -584,7 +584,7 @@ message ListEntitiesSensorResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
string unit_of_measurement = 6;
|
string unit_of_measurement = 6;
|
||||||
int32 accuracy_decimals = 7;
|
int32 accuracy_decimals = 7;
|
||||||
bool force_update = 8;
|
bool force_update = 8;
|
||||||
@ -623,12 +623,12 @@ message ListEntitiesSwitchResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool assumed_state = 6;
|
bool assumed_state = 6;
|
||||||
bool disabled_by_default = 7;
|
bool disabled_by_default = 7;
|
||||||
EntityCategory entity_category = 8;
|
EntityCategory entity_category = 8;
|
||||||
string device_class = 9;
|
string device_class = 9;
|
||||||
uint32 device_id = 10;
|
uint32 device_id = 10 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message SwitchStateResponse {
|
message SwitchStateResponse {
|
||||||
option (id) = 26;
|
option (id) = 26;
|
||||||
@ -665,11 +665,11 @@ message ListEntitiesTextSensorResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
string device_class = 8;
|
string device_class = 8;
|
||||||
uint32 device_id = 9;
|
uint32 device_id = 9 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message TextSensorStateResponse {
|
message TextSensorStateResponse {
|
||||||
option (id) = 27;
|
option (id) = 27;
|
||||||
@ -855,9 +855,9 @@ message ListEntitiesCameraResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
bool disabled_by_default = 5;
|
bool disabled_by_default = 5;
|
||||||
string icon = 6;
|
string icon = 6 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
uint32 device_id = 8;
|
uint32 device_id = 8 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message CameraImageResponse {
|
message CameraImageResponse {
|
||||||
@ -955,14 +955,14 @@ message ListEntitiesClimateResponse {
|
|||||||
repeated ClimatePreset supported_presets = 16;
|
repeated ClimatePreset supported_presets = 16;
|
||||||
repeated string supported_custom_presets = 17;
|
repeated string supported_custom_presets = 17;
|
||||||
bool disabled_by_default = 18;
|
bool disabled_by_default = 18;
|
||||||
string icon = 19;
|
string icon = 19 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
EntityCategory entity_category = 20;
|
EntityCategory entity_category = 20;
|
||||||
float visual_current_temperature_step = 21;
|
float visual_current_temperature_step = 21;
|
||||||
bool supports_current_humidity = 22;
|
bool supports_current_humidity = 22;
|
||||||
bool supports_target_humidity = 23;
|
bool supports_target_humidity = 23;
|
||||||
float visual_min_humidity = 24;
|
float visual_min_humidity = 24;
|
||||||
float visual_max_humidity = 25;
|
float visual_max_humidity = 25;
|
||||||
uint32 device_id = 26;
|
uint32 device_id = 26 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message ClimateStateResponse {
|
message ClimateStateResponse {
|
||||||
option (id) = 47;
|
option (id) = 47;
|
||||||
@ -987,7 +987,7 @@ message ClimateStateResponse {
|
|||||||
string custom_preset = 13;
|
string custom_preset = 13;
|
||||||
float current_humidity = 14;
|
float current_humidity = 14;
|
||||||
float target_humidity = 15;
|
float target_humidity = 15;
|
||||||
uint32 device_id = 16;
|
uint32 device_id = 16 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message ClimateCommandRequest {
|
message ClimateCommandRequest {
|
||||||
option (id) = 48;
|
option (id) = 48;
|
||||||
@ -1040,7 +1040,7 @@ message ListEntitiesNumberResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
float min_value = 6;
|
float min_value = 6;
|
||||||
float max_value = 7;
|
float max_value = 7;
|
||||||
float step = 8;
|
float step = 8;
|
||||||
@ -1089,11 +1089,11 @@ message ListEntitiesSelectResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
repeated string options = 6;
|
repeated string options = 6;
|
||||||
bool disabled_by_default = 7;
|
bool disabled_by_default = 7;
|
||||||
EntityCategory entity_category = 8;
|
EntityCategory entity_category = 8;
|
||||||
uint32 device_id = 9;
|
uint32 device_id = 9 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message SelectStateResponse {
|
message SelectStateResponse {
|
||||||
option (id) = 53;
|
option (id) = 53;
|
||||||
@ -1133,13 +1133,13 @@ message ListEntitiesSirenResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
repeated string tones = 7;
|
repeated string tones = 7;
|
||||||
bool supports_duration = 8;
|
bool supports_duration = 8;
|
||||||
bool supports_volume = 9;
|
bool supports_volume = 9;
|
||||||
EntityCategory entity_category = 10;
|
EntityCategory entity_category = 10;
|
||||||
uint32 device_id = 11;
|
uint32 device_id = 11 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message SirenStateResponse {
|
message SirenStateResponse {
|
||||||
option (id) = 56;
|
option (id) = 56;
|
||||||
@ -1168,7 +1168,7 @@ message SirenCommandRequest {
|
|||||||
uint32 duration = 7;
|
uint32 duration = 7;
|
||||||
bool has_volume = 8;
|
bool has_volume = 8;
|
||||||
float volume = 9;
|
float volume = 9;
|
||||||
uint32 device_id = 10;
|
uint32 device_id = 10 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== LOCK ====================
|
// ==================== LOCK ====================
|
||||||
@ -1196,7 +1196,7 @@ message ListEntitiesLockResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
bool assumed_state = 8;
|
bool assumed_state = 8;
|
||||||
@ -1206,7 +1206,7 @@ message ListEntitiesLockResponse {
|
|||||||
|
|
||||||
// Not yet implemented:
|
// Not yet implemented:
|
||||||
string code_format = 11;
|
string code_format = 11;
|
||||||
uint32 device_id = 12;
|
uint32 device_id = 12 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message LockStateResponse {
|
message LockStateResponse {
|
||||||
option (id) = 59;
|
option (id) = 59;
|
||||||
@ -1245,11 +1245,11 @@ message ListEntitiesButtonResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
string device_class = 8;
|
string device_class = 8;
|
||||||
uint32 device_id = 9;
|
uint32 device_id = 9 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message ButtonCommandRequest {
|
message ButtonCommandRequest {
|
||||||
option (id) = 62;
|
option (id) = 62;
|
||||||
@ -1300,7 +1300,7 @@ message ListEntitiesMediaPlayerResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
|
|
||||||
@ -1308,7 +1308,7 @@ message ListEntitiesMediaPlayerResponse {
|
|||||||
|
|
||||||
repeated MediaPlayerSupportedFormat supported_formats = 9;
|
repeated MediaPlayerSupportedFormat supported_formats = 9;
|
||||||
|
|
||||||
uint32 device_id = 10;
|
uint32 device_id = 10 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message MediaPlayerStateResponse {
|
message MediaPlayerStateResponse {
|
||||||
option (id) = 64;
|
option (id) = 64;
|
||||||
@ -1342,7 +1342,7 @@ message MediaPlayerCommandRequest {
|
|||||||
|
|
||||||
bool has_announcement = 8;
|
bool has_announcement = 8;
|
||||||
bool announcement = 9;
|
bool announcement = 9;
|
||||||
uint32 device_id = 10;
|
uint32 device_id = 10 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== BLUETOOTH ====================
|
// ==================== BLUETOOTH ====================
|
||||||
@ -1846,13 +1846,13 @@ message ListEntitiesAlarmControlPanelResponse {
|
|||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
uint32 supported_features = 8;
|
uint32 supported_features = 8;
|
||||||
bool requires_code = 9;
|
bool requires_code = 9;
|
||||||
bool requires_code_to_arm = 10;
|
bool requires_code_to_arm = 10;
|
||||||
uint32 device_id = 11;
|
uint32 device_id = 11 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message AlarmControlPanelStateResponse {
|
message AlarmControlPanelStateResponse {
|
||||||
@ -1893,7 +1893,7 @@ message ListEntitiesTextResponse {
|
|||||||
fixed32 key = 2;
|
fixed32 key = 2;
|
||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
|
|
||||||
@ -1901,7 +1901,7 @@ message ListEntitiesTextResponse {
|
|||||||
uint32 max_length = 9;
|
uint32 max_length = 9;
|
||||||
string pattern = 10;
|
string pattern = 10;
|
||||||
TextMode mode = 11;
|
TextMode mode = 11;
|
||||||
uint32 device_id = 12;
|
uint32 device_id = 12 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message TextStateResponse {
|
message TextStateResponse {
|
||||||
option (id) = 98;
|
option (id) = 98;
|
||||||
@ -1942,10 +1942,10 @@ message ListEntitiesDateResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
uint32 device_id = 8;
|
uint32 device_id = 8 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message DateStateResponse {
|
message DateStateResponse {
|
||||||
option (id) = 101;
|
option (id) = 101;
|
||||||
@ -1989,10 +1989,10 @@ message ListEntitiesTimeResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
uint32 device_id = 8;
|
uint32 device_id = 8 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message TimeStateResponse {
|
message TimeStateResponse {
|
||||||
option (id) = 104;
|
option (id) = 104;
|
||||||
@ -2036,13 +2036,13 @@ message ListEntitiesEventResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
string device_class = 8;
|
string device_class = 8;
|
||||||
|
|
||||||
repeated string event_types = 9;
|
repeated string event_types = 9;
|
||||||
uint32 device_id = 10;
|
uint32 device_id = 10 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message EventResponse {
|
message EventResponse {
|
||||||
option (id) = 108;
|
option (id) = 108;
|
||||||
@ -2067,7 +2067,7 @@ message ListEntitiesValveResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
string device_class = 8;
|
string device_class = 8;
|
||||||
@ -2075,7 +2075,7 @@ message ListEntitiesValveResponse {
|
|||||||
bool assumed_state = 9;
|
bool assumed_state = 9;
|
||||||
bool supports_position = 10;
|
bool supports_position = 10;
|
||||||
bool supports_stop = 11;
|
bool supports_stop = 11;
|
||||||
uint32 device_id = 12;
|
uint32 device_id = 12 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ValveOperation {
|
enum ValveOperation {
|
||||||
@ -2122,10 +2122,10 @@ message ListEntitiesDateTimeResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
uint32 device_id = 8;
|
uint32 device_id = 8 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message DateTimeStateResponse {
|
message DateTimeStateResponse {
|
||||||
option (id) = 113;
|
option (id) = 113;
|
||||||
@ -2165,11 +2165,11 @@ message ListEntitiesUpdateResponse {
|
|||||||
string name = 3;
|
string name = 3;
|
||||||
string unique_id = 4;
|
string unique_id = 4;
|
||||||
|
|
||||||
string icon = 5;
|
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
|
||||||
bool disabled_by_default = 6;
|
bool disabled_by_default = 6;
|
||||||
EntityCategory entity_category = 7;
|
EntityCategory entity_category = 7;
|
||||||
string device_class = 8;
|
string device_class = 8;
|
||||||
uint32 device_id = 9;
|
uint32 device_id = 9 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
message UpdateStateResponse {
|
message UpdateStateResponse {
|
||||||
option (id) = 117;
|
option (id) = 117;
|
||||||
@ -2188,7 +2188,7 @@ message UpdateStateResponse {
|
|||||||
string title = 8;
|
string title = 8;
|
||||||
string release_summary = 9;
|
string release_summary = 9;
|
||||||
string release_url = 10;
|
string release_url = 10;
|
||||||
uint32 device_id = 11;
|
uint32 device_id = 11 [(field_ifdef) = "USE_DEVICES"];
|
||||||
}
|
}
|
||||||
enum UpdateCommand {
|
enum UpdateCommand {
|
||||||
UPDATE_COMMAND_NONE = 0;
|
UPDATE_COMMAND_NONE = 0;
|
||||||
|
@ -1485,7 +1485,9 @@ DeviceInfoResponse APIConnection::device_info(const DeviceInfoRequest &msg) {
|
|||||||
#endif
|
#endif
|
||||||
resp.name = App.get_name();
|
resp.name = App.get_name();
|
||||||
resp.friendly_name = App.get_friendly_name();
|
resp.friendly_name = App.get_friendly_name();
|
||||||
|
#ifdef USE_AREAS
|
||||||
resp.suggested_area = App.get_area();
|
resp.suggested_area = App.get_area();
|
||||||
|
#endif
|
||||||
resp.mac_address = get_mac_address_pretty();
|
resp.mac_address = get_mac_address_pretty();
|
||||||
resp.esphome_version = ESPHOME_VERSION;
|
resp.esphome_version = ESPHOME_VERSION;
|
||||||
resp.compilation_time = App.get_compilation_time();
|
resp.compilation_time = App.get_compilation_time();
|
||||||
|
@ -282,8 +282,10 @@ class APIConnection : public APIServerConnection {
|
|||||||
if (entity->has_own_name())
|
if (entity->has_own_name())
|
||||||
response.name = entity->get_name();
|
response.name = entity->get_name();
|
||||||
|
|
||||||
// Set common EntityBase properties
|
// Set common EntityBase properties
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
response.icon = entity->get_icon();
|
response.icon = entity->get_icon();
|
||||||
|
#endif
|
||||||
response.disabled_by_default = entity->is_disabled_by_default();
|
response.disabled_by_default = entity->is_disabled_by_default();
|
||||||
response.entity_category = static_cast<enums::EntityCategory>(entity->get_entity_category());
|
response.entity_category = static_cast<enums::EntityCategory>(entity->get_entity_category());
|
||||||
#ifdef USE_DEVICES
|
#ifdef USE_DEVICES
|
||||||
|
@ -23,3 +23,7 @@ extend google.protobuf.MessageOptions {
|
|||||||
optional bool no_delay = 1040 [default=false];
|
optional bool no_delay = 1040 [default=false];
|
||||||
optional string base_class = 1041;
|
optional string base_class = 1041;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extend google.protobuf.FieldOptions {
|
||||||
|
optional string field_ifdef = 1042;
|
||||||
|
}
|
||||||
|
@ -126,26 +126,54 @@ void DeviceInfoResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_string(4, this->esphome_version);
|
buffer.encode_string(4, this->esphome_version);
|
||||||
buffer.encode_string(5, this->compilation_time);
|
buffer.encode_string(5, this->compilation_time);
|
||||||
buffer.encode_string(6, this->model);
|
buffer.encode_string(6, this->model);
|
||||||
|
#ifdef USE_DEEP_SLEEP
|
||||||
buffer.encode_bool(7, this->has_deep_sleep);
|
buffer.encode_bool(7, this->has_deep_sleep);
|
||||||
|
#endif
|
||||||
|
#ifdef ESPHOME_PROJECT_NAME
|
||||||
buffer.encode_string(8, this->project_name);
|
buffer.encode_string(8, this->project_name);
|
||||||
|
#endif
|
||||||
|
#ifdef ESPHOME_PROJECT_NAME
|
||||||
buffer.encode_string(9, this->project_version);
|
buffer.encode_string(9, this->project_version);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_WEBSERVER
|
||||||
buffer.encode_uint32(10, this->webserver_port);
|
buffer.encode_uint32(10, this->webserver_port);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
buffer.encode_uint32(11, this->legacy_bluetooth_proxy_version);
|
buffer.encode_uint32(11, this->legacy_bluetooth_proxy_version);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
buffer.encode_uint32(15, this->bluetooth_proxy_feature_flags);
|
buffer.encode_uint32(15, this->bluetooth_proxy_feature_flags);
|
||||||
|
#endif
|
||||||
buffer.encode_string(12, this->manufacturer);
|
buffer.encode_string(12, this->manufacturer);
|
||||||
buffer.encode_string(13, this->friendly_name);
|
buffer.encode_string(13, this->friendly_name);
|
||||||
|
#ifdef USE_VOICE_ASSISTANT
|
||||||
buffer.encode_uint32(14, this->legacy_voice_assistant_version);
|
buffer.encode_uint32(14, this->legacy_voice_assistant_version);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_VOICE_ASSISTANT
|
||||||
buffer.encode_uint32(17, this->voice_assistant_feature_flags);
|
buffer.encode_uint32(17, this->voice_assistant_feature_flags);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_AREAS
|
||||||
buffer.encode_string(16, this->suggested_area);
|
buffer.encode_string(16, this->suggested_area);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
buffer.encode_string(18, this->bluetooth_mac_address);
|
buffer.encode_string(18, this->bluetooth_mac_address);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_API_NOISE
|
||||||
buffer.encode_bool(19, this->api_encryption_supported);
|
buffer.encode_bool(19, this->api_encryption_supported);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_DEVICES
|
||||||
for (auto &it : this->devices) {
|
for (auto &it : this->devices) {
|
||||||
buffer.encode_message(20, it, true);
|
buffer.encode_message(20, it, true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef USE_AREAS
|
||||||
for (auto &it : this->areas) {
|
for (auto &it : this->areas) {
|
||||||
buffer.encode_message(21, it, true);
|
buffer.encode_message(21, it, true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef USE_AREAS
|
||||||
buffer.encode_message(22, this->area);
|
buffer.encode_message(22, this->area);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void DeviceInfoResponse::calculate_size(uint32_t &total_size) const {
|
void DeviceInfoResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->uses_password);
|
ProtoSize::add_bool_field(total_size, 1, this->uses_password);
|
||||||
@ -154,22 +182,50 @@ void DeviceInfoResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_string_field(total_size, 1, this->esphome_version);
|
ProtoSize::add_string_field(total_size, 1, this->esphome_version);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->compilation_time);
|
ProtoSize::add_string_field(total_size, 1, this->compilation_time);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->model);
|
ProtoSize::add_string_field(total_size, 1, this->model);
|
||||||
|
#ifdef USE_DEEP_SLEEP
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->has_deep_sleep);
|
ProtoSize::add_bool_field(total_size, 1, this->has_deep_sleep);
|
||||||
|
#endif
|
||||||
|
#ifdef ESPHOME_PROJECT_NAME
|
||||||
ProtoSize::add_string_field(total_size, 1, this->project_name);
|
ProtoSize::add_string_field(total_size, 1, this->project_name);
|
||||||
|
#endif
|
||||||
|
#ifdef ESPHOME_PROJECT_NAME
|
||||||
ProtoSize::add_string_field(total_size, 1, this->project_version);
|
ProtoSize::add_string_field(total_size, 1, this->project_version);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_WEBSERVER
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->webserver_port);
|
ProtoSize::add_uint32_field(total_size, 1, this->webserver_port);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->legacy_bluetooth_proxy_version);
|
ProtoSize::add_uint32_field(total_size, 1, this->legacy_bluetooth_proxy_version);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->bluetooth_proxy_feature_flags);
|
ProtoSize::add_uint32_field(total_size, 1, this->bluetooth_proxy_feature_flags);
|
||||||
|
#endif
|
||||||
ProtoSize::add_string_field(total_size, 1, this->manufacturer);
|
ProtoSize::add_string_field(total_size, 1, this->manufacturer);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->friendly_name);
|
ProtoSize::add_string_field(total_size, 1, this->friendly_name);
|
||||||
|
#ifdef USE_VOICE_ASSISTANT
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->legacy_voice_assistant_version);
|
ProtoSize::add_uint32_field(total_size, 1, this->legacy_voice_assistant_version);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_VOICE_ASSISTANT
|
||||||
ProtoSize::add_uint32_field(total_size, 2, this->voice_assistant_feature_flags);
|
ProtoSize::add_uint32_field(total_size, 2, this->voice_assistant_feature_flags);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_AREAS
|
||||||
ProtoSize::add_string_field(total_size, 2, this->suggested_area);
|
ProtoSize::add_string_field(total_size, 2, this->suggested_area);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
ProtoSize::add_string_field(total_size, 2, this->bluetooth_mac_address);
|
ProtoSize::add_string_field(total_size, 2, this->bluetooth_mac_address);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_API_NOISE
|
||||||
ProtoSize::add_bool_field(total_size, 2, this->api_encryption_supported);
|
ProtoSize::add_bool_field(total_size, 2, this->api_encryption_supported);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_repeated_message(total_size, 2, this->devices);
|
ProtoSize::add_repeated_message(total_size, 2, this->devices);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_AREAS
|
||||||
ProtoSize::add_repeated_message(total_size, 2, this->areas);
|
ProtoSize::add_repeated_message(total_size, 2, this->areas);
|
||||||
|
#endif
|
||||||
|
#ifdef USE_AREAS
|
||||||
ProtoSize::add_message_object(total_size, 2, this->area);
|
ProtoSize::add_message_object(total_size, 2, this->area);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef USE_BINARY_SENSOR
|
#ifdef USE_BINARY_SENSOR
|
||||||
void ListEntitiesBinarySensorResponse::encode(ProtoWriteBuffer buffer) const {
|
void ListEntitiesBinarySensorResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
@ -180,9 +236,13 @@ void ListEntitiesBinarySensorResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_string(5, this->device_class);
|
buffer.encode_string(5, this->device_class);
|
||||||
buffer.encode_bool(6, this->is_status_binary_sensor);
|
buffer.encode_bool(6, this->is_status_binary_sensor);
|
||||||
buffer.encode_bool(7, this->disabled_by_default);
|
buffer.encode_bool(7, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(8, this->icon);
|
buffer.encode_string(8, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_uint32(9, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(9, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(10, this->device_id);
|
buffer.encode_uint32(10, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesBinarySensorResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesBinarySensorResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
@ -192,9 +252,13 @@ void ListEntitiesBinarySensorResponse::calculate_size(uint32_t &total_size) cons
|
|||||||
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->is_status_binary_sensor);
|
ProtoSize::add_bool_field(total_size, 1, this->is_status_binary_sensor);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void BinarySensorStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void BinarySensorStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -220,10 +284,14 @@ void ListEntitiesCoverResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_bool(7, this->supports_tilt);
|
buffer.encode_bool(7, this->supports_tilt);
|
||||||
buffer.encode_string(8, this->device_class);
|
buffer.encode_string(8, this->device_class);
|
||||||
buffer.encode_bool(9, this->disabled_by_default);
|
buffer.encode_bool(9, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(10, this->icon);
|
buffer.encode_string(10, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_uint32(11, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(11, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_bool(12, this->supports_stop);
|
buffer.encode_bool(12, this->supports_stop);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(13, this->device_id);
|
buffer.encode_uint32(13, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesCoverResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesCoverResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
@ -235,10 +303,14 @@ void ListEntitiesCoverResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_bool_field(total_size, 1, this->supports_tilt);
|
ProtoSize::add_bool_field(total_size, 1, this->supports_tilt);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->supports_stop);
|
ProtoSize::add_bool_field(total_size, 1, this->supports_stop);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void CoverStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void CoverStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -278,10 +350,12 @@ bool CoverCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
|||||||
this->stop = value.as_bool();
|
this->stop = value.as_bool();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_DEVICES
|
||||||
case 9: {
|
case 9: {
|
||||||
this->device_id = value.as_uint32();
|
this->device_id = value.as_uint32();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -316,12 +390,16 @@ void ListEntitiesFanResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_bool(7, this->supports_direction);
|
buffer.encode_bool(7, this->supports_direction);
|
||||||
buffer.encode_int32(8, this->supported_speed_count);
|
buffer.encode_int32(8, this->supported_speed_count);
|
||||||
buffer.encode_bool(9, this->disabled_by_default);
|
buffer.encode_bool(9, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(10, this->icon);
|
buffer.encode_string(10, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_uint32(11, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(11, static_cast<uint32_t>(this->entity_category));
|
||||||
for (auto &it : this->supported_preset_modes) {
|
for (auto &it : this->supported_preset_modes) {
|
||||||
buffer.encode_string(12, it, true);
|
buffer.encode_string(12, it, true);
|
||||||
}
|
}
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(13, this->device_id);
|
buffer.encode_uint32(13, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesFanResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesFanResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
@ -333,14 +411,18 @@ void ListEntitiesFanResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_bool_field(total_size, 1, this->supports_direction);
|
ProtoSize::add_bool_field(total_size, 1, this->supports_direction);
|
||||||
ProtoSize::add_int32_field(total_size, 1, this->supported_speed_count);
|
ProtoSize::add_int32_field(total_size, 1, this->supported_speed_count);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
if (!this->supported_preset_modes.empty()) {
|
if (!this->supported_preset_modes.empty()) {
|
||||||
for (const auto &it : this->supported_preset_modes) {
|
for (const auto &it : this->supported_preset_modes) {
|
||||||
ProtoSize::add_string_field_repeated(total_size, 1, it);
|
ProtoSize::add_string_field_repeated(total_size, 1, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void FanStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void FanStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -350,7 +432,9 @@ void FanStateResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_uint32(5, static_cast<uint32_t>(this->direction));
|
buffer.encode_uint32(5, static_cast<uint32_t>(this->direction));
|
||||||
buffer.encode_int32(6, this->speed_level);
|
buffer.encode_int32(6, this->speed_level);
|
||||||
buffer.encode_string(7, this->preset_mode);
|
buffer.encode_string(7, this->preset_mode);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(8, this->device_id);
|
buffer.encode_uint32(8, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void FanStateResponse::calculate_size(uint32_t &total_size) const {
|
void FanStateResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
@ -360,7 +444,9 @@ void FanStateResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->direction));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->direction));
|
||||||
ProtoSize::add_int32_field(total_size, 1, this->speed_level);
|
ProtoSize::add_int32_field(total_size, 1, this->speed_level);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->preset_mode);
|
ProtoSize::add_string_field(total_size, 1, this->preset_mode);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||||
switch (field_id) {
|
switch (field_id) {
|
||||||
@ -456,9 +542,13 @@ void ListEntitiesLightResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_string(11, it, true);
|
buffer.encode_string(11, it, true);
|
||||||
}
|
}
|
||||||
buffer.encode_bool(13, this->disabled_by_default);
|
buffer.encode_bool(13, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(14, this->icon);
|
buffer.encode_string(14, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_uint32(15, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(15, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(16, this->device_id);
|
buffer.encode_uint32(16, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesLightResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesLightResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
@ -482,9 +572,13 @@ void ListEntitiesLightResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 2, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 2, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void LightStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void LightStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -655,7 +749,9 @@ void ListEntitiesSensorResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_string(6, this->unit_of_measurement);
|
buffer.encode_string(6, this->unit_of_measurement);
|
||||||
buffer.encode_int32(7, this->accuracy_decimals);
|
buffer.encode_int32(7, this->accuracy_decimals);
|
||||||
buffer.encode_bool(8, this->force_update);
|
buffer.encode_bool(8, this->force_update);
|
||||||
@ -671,7 +767,9 @@ void ListEntitiesSensorResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unit_of_measurement);
|
ProtoSize::add_string_field(total_size, 1, this->unit_of_measurement);
|
||||||
ProtoSize::add_int32_field(total_size, 1, this->accuracy_decimals);
|
ProtoSize::add_int32_field(total_size, 1, this->accuracy_decimals);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->force_update);
|
ProtoSize::add_bool_field(total_size, 1, this->force_update);
|
||||||
@ -701,24 +799,32 @@ void ListEntitiesSwitchResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->assumed_state);
|
buffer.encode_bool(6, this->assumed_state);
|
||||||
buffer.encode_bool(7, this->disabled_by_default);
|
buffer.encode_bool(7, this->disabled_by_default);
|
||||||
buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_string(9, this->device_class);
|
buffer.encode_string(9, this->device_class);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(10, this->device_id);
|
buffer.encode_uint32(10, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesSwitchResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesSwitchResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->assumed_state);
|
ProtoSize::add_bool_field(total_size, 1, this->assumed_state);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void SwitchStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void SwitchStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -761,22 +867,30 @@ void ListEntitiesTextSensorResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_string(8, this->device_class);
|
buffer.encode_string(8, this->device_class);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(9, this->device_id);
|
buffer.encode_uint32(9, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesTextSensorResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesTextSensorResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void TextSensorStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void TextSensorStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -1083,9 +1197,13 @@ void ListEntitiesCameraResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
buffer.encode_bool(5, this->disabled_by_default);
|
buffer.encode_bool(5, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(6, this->icon);
|
buffer.encode_string(6, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(8, this->device_id);
|
buffer.encode_uint32(8, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesCameraResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesCameraResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
@ -1093,9 +1211,13 @@ void ListEntitiesCameraResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void CameraImageResponse::encode(ProtoWriteBuffer buffer) const {
|
void CameraImageResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -1156,14 +1278,18 @@ void ListEntitiesClimateResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_string(17, it, true);
|
buffer.encode_string(17, it, true);
|
||||||
}
|
}
|
||||||
buffer.encode_bool(18, this->disabled_by_default);
|
buffer.encode_bool(18, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(19, this->icon);
|
buffer.encode_string(19, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_uint32(20, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(20, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_float(21, this->visual_current_temperature_step);
|
buffer.encode_float(21, this->visual_current_temperature_step);
|
||||||
buffer.encode_bool(22, this->supports_current_humidity);
|
buffer.encode_bool(22, this->supports_current_humidity);
|
||||||
buffer.encode_bool(23, this->supports_target_humidity);
|
buffer.encode_bool(23, this->supports_target_humidity);
|
||||||
buffer.encode_float(24, this->visual_min_humidity);
|
buffer.encode_float(24, this->visual_min_humidity);
|
||||||
buffer.encode_float(25, this->visual_max_humidity);
|
buffer.encode_float(25, this->visual_max_humidity);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(26, this->device_id);
|
buffer.encode_uint32(26, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesClimateResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesClimateResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
@ -1208,14 +1334,18 @@ void ListEntitiesClimateResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ProtoSize::add_bool_field(total_size, 2, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 2, this->disabled_by_default);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 2, this->icon);
|
ProtoSize::add_string_field(total_size, 2, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_enum_field(total_size, 2, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 2, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 2, this->visual_current_temperature_step != 0.0f);
|
ProtoSize::add_fixed_field<4>(total_size, 2, this->visual_current_temperature_step != 0.0f);
|
||||||
ProtoSize::add_bool_field(total_size, 2, this->supports_current_humidity);
|
ProtoSize::add_bool_field(total_size, 2, this->supports_current_humidity);
|
||||||
ProtoSize::add_bool_field(total_size, 2, this->supports_target_humidity);
|
ProtoSize::add_bool_field(total_size, 2, this->supports_target_humidity);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 2, this->visual_min_humidity != 0.0f);
|
ProtoSize::add_fixed_field<4>(total_size, 2, this->visual_min_humidity != 0.0f);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 2, this->visual_max_humidity != 0.0f);
|
ProtoSize::add_fixed_field<4>(total_size, 2, this->visual_max_humidity != 0.0f);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 2, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 2, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ClimateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void ClimateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -1233,7 +1363,9 @@ void ClimateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_string(13, this->custom_preset);
|
buffer.encode_string(13, this->custom_preset);
|
||||||
buffer.encode_float(14, this->current_humidity);
|
buffer.encode_float(14, this->current_humidity);
|
||||||
buffer.encode_float(15, this->target_humidity);
|
buffer.encode_float(15, this->target_humidity);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(16, this->device_id);
|
buffer.encode_uint32(16, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ClimateStateResponse::calculate_size(uint32_t &total_size) const {
|
void ClimateStateResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
@ -1251,7 +1383,9 @@ void ClimateStateResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_string_field(total_size, 1, this->custom_preset);
|
ProtoSize::add_string_field(total_size, 1, this->custom_preset);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->current_humidity != 0.0f);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->current_humidity != 0.0f);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->target_humidity != 0.0f);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->target_humidity != 0.0f);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 2, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 2, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||||
switch (field_id) {
|
switch (field_id) {
|
||||||
@ -1374,7 +1508,9 @@ void ListEntitiesNumberResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_float(6, this->min_value);
|
buffer.encode_float(6, this->min_value);
|
||||||
buffer.encode_float(7, this->max_value);
|
buffer.encode_float(7, this->max_value);
|
||||||
buffer.encode_float(8, this->step);
|
buffer.encode_float(8, this->step);
|
||||||
@ -1390,7 +1526,9 @@ void ListEntitiesNumberResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->min_value != 0.0f);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->min_value != 0.0f);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->max_value != 0.0f);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->max_value != 0.0f);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->step != 0.0f);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->step != 0.0f);
|
||||||
@ -1444,20 +1582,26 @@ void ListEntitiesSelectResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
for (auto &it : this->options) {
|
for (auto &it : this->options) {
|
||||||
buffer.encode_string(6, it, true);
|
buffer.encode_string(6, it, true);
|
||||||
}
|
}
|
||||||
buffer.encode_bool(7, this->disabled_by_default);
|
buffer.encode_bool(7, this->disabled_by_default);
|
||||||
buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(9, this->device_id);
|
buffer.encode_uint32(9, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesSelectResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesSelectResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
if (!this->options.empty()) {
|
if (!this->options.empty()) {
|
||||||
for (const auto &it : this->options) {
|
for (const auto &it : this->options) {
|
||||||
ProtoSize::add_string_field_repeated(total_size, 1, it);
|
ProtoSize::add_string_field_repeated(total_size, 1, it);
|
||||||
@ -1465,7 +1609,9 @@ void ListEntitiesSelectResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
}
|
}
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void SelectStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void SelectStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -1516,7 +1662,9 @@ void ListEntitiesSirenResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
for (auto &it : this->tones) {
|
for (auto &it : this->tones) {
|
||||||
buffer.encode_string(7, it, true);
|
buffer.encode_string(7, it, true);
|
||||||
@ -1524,14 +1672,18 @@ void ListEntitiesSirenResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_bool(8, this->supports_duration);
|
buffer.encode_bool(8, this->supports_duration);
|
||||||
buffer.encode_bool(9, this->supports_volume);
|
buffer.encode_bool(9, this->supports_volume);
|
||||||
buffer.encode_uint32(10, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(10, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(11, this->device_id);
|
buffer.encode_uint32(11, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesSirenResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesSirenResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
if (!this->tones.empty()) {
|
if (!this->tones.empty()) {
|
||||||
for (const auto &it : this->tones) {
|
for (const auto &it : this->tones) {
|
||||||
@ -1541,7 +1693,9 @@ void ListEntitiesSirenResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_bool_field(total_size, 1, this->supports_duration);
|
ProtoSize::add_bool_field(total_size, 1, this->supports_duration);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->supports_volume);
|
ProtoSize::add_bool_field(total_size, 1, this->supports_volume);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void SirenStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void SirenStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -1579,10 +1733,12 @@ bool SirenCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
|||||||
this->has_volume = value.as_bool();
|
this->has_volume = value.as_bool();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_DEVICES
|
||||||
case 10: {
|
case 10: {
|
||||||
this->device_id = value.as_uint32();
|
this->device_id = value.as_uint32();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1618,28 +1774,36 @@ void ListEntitiesLockResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_bool(8, this->assumed_state);
|
buffer.encode_bool(8, this->assumed_state);
|
||||||
buffer.encode_bool(9, this->supports_open);
|
buffer.encode_bool(9, this->supports_open);
|
||||||
buffer.encode_bool(10, this->requires_code);
|
buffer.encode_bool(10, this->requires_code);
|
||||||
buffer.encode_string(11, this->code_format);
|
buffer.encode_string(11, this->code_format);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(12, this->device_id);
|
buffer.encode_uint32(12, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesLockResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesLockResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->assumed_state);
|
ProtoSize::add_bool_field(total_size, 1, this->assumed_state);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->supports_open);
|
ProtoSize::add_bool_field(total_size, 1, this->supports_open);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->requires_code);
|
ProtoSize::add_bool_field(total_size, 1, this->requires_code);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->code_format);
|
ProtoSize::add_string_field(total_size, 1, this->code_format);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void LockStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void LockStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -1696,22 +1860,30 @@ void ListEntitiesButtonResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_string(8, this->device_class);
|
buffer.encode_string(8, this->device_class);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(9, this->device_id);
|
buffer.encode_uint32(9, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesButtonResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesButtonResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
bool ButtonCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
bool ButtonCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||||
switch (field_id) {
|
switch (field_id) {
|
||||||
@ -1786,26 +1958,34 @@ void ListEntitiesMediaPlayerResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_bool(8, this->supports_pause);
|
buffer.encode_bool(8, this->supports_pause);
|
||||||
for (auto &it : this->supported_formats) {
|
for (auto &it : this->supported_formats) {
|
||||||
buffer.encode_message(9, it, true);
|
buffer.encode_message(9, it, true);
|
||||||
}
|
}
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(10, this->device_id);
|
buffer.encode_uint32(10, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesMediaPlayerResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesMediaPlayerResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->supports_pause);
|
ProtoSize::add_bool_field(total_size, 1, this->supports_pause);
|
||||||
ProtoSize::add_repeated_message(total_size, 1, this->supported_formats);
|
ProtoSize::add_repeated_message(total_size, 1, this->supported_formats);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void MediaPlayerStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void MediaPlayerStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -1847,10 +2027,12 @@ bool MediaPlayerCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt val
|
|||||||
this->announcement = value.as_bool();
|
this->announcement = value.as_bool();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_DEVICES
|
||||||
case 10: {
|
case 10: {
|
||||||
this->device_id = value.as_uint32();
|
this->device_id = value.as_uint32();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2681,26 +2863,34 @@ void ListEntitiesAlarmControlPanelResponse::encode(ProtoWriteBuffer buffer) cons
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_uint32(8, this->supported_features);
|
buffer.encode_uint32(8, this->supported_features);
|
||||||
buffer.encode_bool(9, this->requires_code);
|
buffer.encode_bool(9, this->requires_code);
|
||||||
buffer.encode_bool(10, this->requires_code_to_arm);
|
buffer.encode_bool(10, this->requires_code_to_arm);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(11, this->device_id);
|
buffer.encode_uint32(11, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesAlarmControlPanelResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesAlarmControlPanelResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->supported_features);
|
ProtoSize::add_uint32_field(total_size, 1, this->supported_features);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->requires_code);
|
ProtoSize::add_bool_field(total_size, 1, this->requires_code);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->requires_code_to_arm);
|
ProtoSize::add_bool_field(total_size, 1, this->requires_code_to_arm);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void AlarmControlPanelStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void AlarmControlPanelStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -2753,28 +2943,36 @@ void ListEntitiesTextResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_uint32(8, this->min_length);
|
buffer.encode_uint32(8, this->min_length);
|
||||||
buffer.encode_uint32(9, this->max_length);
|
buffer.encode_uint32(9, this->max_length);
|
||||||
buffer.encode_string(10, this->pattern);
|
buffer.encode_string(10, this->pattern);
|
||||||
buffer.encode_uint32(11, static_cast<uint32_t>(this->mode));
|
buffer.encode_uint32(11, static_cast<uint32_t>(this->mode));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(12, this->device_id);
|
buffer.encode_uint32(12, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesTextResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesTextResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->min_length);
|
ProtoSize::add_uint32_field(total_size, 1, this->min_length);
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->max_length);
|
ProtoSize::add_uint32_field(total_size, 1, this->max_length);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->pattern);
|
ProtoSize::add_string_field(total_size, 1, this->pattern);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->mode));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->mode));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void TextStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void TextStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -2825,20 +3023,28 @@ void ListEntitiesDateResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(8, this->device_id);
|
buffer.encode_uint32(8, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesDateResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesDateResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void DateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void DateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -2895,20 +3101,28 @@ void ListEntitiesTimeResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(8, this->device_id);
|
buffer.encode_uint32(8, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesTimeResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesTimeResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void TimeStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void TimeStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -2965,21 +3179,27 @@ void ListEntitiesEventResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_string(8, this->device_class);
|
buffer.encode_string(8, this->device_class);
|
||||||
for (auto &it : this->event_types) {
|
for (auto &it : this->event_types) {
|
||||||
buffer.encode_string(9, it, true);
|
buffer.encode_string(9, it, true);
|
||||||
}
|
}
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(10, this->device_id);
|
buffer.encode_uint32(10, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesEventResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesEventResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
||||||
@ -2988,7 +3208,9 @@ void ListEntitiesEventResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_string_field_repeated(total_size, 1, it);
|
ProtoSize::add_string_field_repeated(total_size, 1, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void EventResponse::encode(ProtoWriteBuffer buffer) const {
|
void EventResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -3007,28 +3229,36 @@ void ListEntitiesValveResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_string(8, this->device_class);
|
buffer.encode_string(8, this->device_class);
|
||||||
buffer.encode_bool(9, this->assumed_state);
|
buffer.encode_bool(9, this->assumed_state);
|
||||||
buffer.encode_bool(10, this->supports_position);
|
buffer.encode_bool(10, this->supports_position);
|
||||||
buffer.encode_bool(11, this->supports_stop);
|
buffer.encode_bool(11, this->supports_stop);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(12, this->device_id);
|
buffer.encode_uint32(12, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesValveResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesValveResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->assumed_state);
|
ProtoSize::add_bool_field(total_size, 1, this->assumed_state);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->supports_position);
|
ProtoSize::add_bool_field(total_size, 1, this->supports_position);
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->supports_stop);
|
ProtoSize::add_bool_field(total_size, 1, this->supports_stop);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ValveStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void ValveStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -3081,20 +3311,28 @@ void ListEntitiesDateTimeResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(8, this->device_id);
|
buffer.encode_uint32(8, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesDateTimeResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesDateTimeResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void DateTimeStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void DateTimeStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -3139,22 +3377,30 @@ void ListEntitiesUpdateResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_fixed32(2, this->key);
|
buffer.encode_fixed32(2, this->key);
|
||||||
buffer.encode_string(3, this->name);
|
buffer.encode_string(3, this->name);
|
||||||
buffer.encode_string(4, this->unique_id);
|
buffer.encode_string(4, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
buffer.encode_string(5, this->icon);
|
buffer.encode_string(5, this->icon);
|
||||||
|
#endif
|
||||||
buffer.encode_bool(6, this->disabled_by_default);
|
buffer.encode_bool(6, this->disabled_by_default);
|
||||||
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
|
||||||
buffer.encode_string(8, this->device_class);
|
buffer.encode_string(8, this->device_class);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(9, this->device_id);
|
buffer.encode_uint32(9, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void ListEntitiesUpdateResponse::calculate_size(uint32_t &total_size) const {
|
void ListEntitiesUpdateResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
ProtoSize::add_string_field(total_size, 1, this->object_id);
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->name);
|
ProtoSize::add_string_field(total_size, 1, this->name);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
ProtoSize::add_string_field(total_size, 1, this->unique_id);
|
||||||
|
#ifdef USE_ENTITY_ICON
|
||||||
ProtoSize::add_string_field(total_size, 1, this->icon);
|
ProtoSize::add_string_field(total_size, 1, this->icon);
|
||||||
|
#endif
|
||||||
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default);
|
||||||
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category));
|
||||||
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
ProtoSize::add_string_field(total_size, 1, this->device_class);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void UpdateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
void UpdateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_fixed32(1, this->key);
|
buffer.encode_fixed32(1, this->key);
|
||||||
@ -3167,7 +3413,9 @@ void UpdateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
|||||||
buffer.encode_string(8, this->title);
|
buffer.encode_string(8, this->title);
|
||||||
buffer.encode_string(9, this->release_summary);
|
buffer.encode_string(9, this->release_summary);
|
||||||
buffer.encode_string(10, this->release_url);
|
buffer.encode_string(10, this->release_url);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
buffer.encode_uint32(11, this->device_id);
|
buffer.encode_uint32(11, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void UpdateStateResponse::calculate_size(uint32_t &total_size) const {
|
void UpdateStateResponse::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
ProtoSize::add_fixed_field<4>(total_size, 1, this->key != 0);
|
||||||
@ -3180,7 +3428,9 @@ void UpdateStateResponse::calculate_size(uint32_t &total_size) const {
|
|||||||
ProtoSize::add_string_field(total_size, 1, this->title);
|
ProtoSize::add_string_field(total_size, 1, this->title);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->release_summary);
|
ProtoSize::add_string_field(total_size, 1, this->release_summary);
|
||||||
ProtoSize::add_string_field(total_size, 1, this->release_url);
|
ProtoSize::add_string_field(total_size, 1, this->release_url);
|
||||||
|
#ifdef USE_DEVICES
|
||||||
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
bool UpdateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
bool UpdateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||||
switch (field_id) {
|
switch (field_id) {
|
||||||
|
@ -492,22 +492,50 @@ class DeviceInfoResponse : public ProtoMessage {
|
|||||||
std::string esphome_version{};
|
std::string esphome_version{};
|
||||||
std::string compilation_time{};
|
std::string compilation_time{};
|
||||||
std::string model{};
|
std::string model{};
|
||||||
|
#ifdef USE_DEEP_SLEEP
|
||||||
bool has_deep_sleep{false};
|
bool has_deep_sleep{false};
|
||||||
|
#endif
|
||||||
|
#ifdef ESPHOME_PROJECT_NAME
|
||||||
std::string project_name{};
|
std::string project_name{};
|
||||||
|
#endif
|
||||||
|
#ifdef ESPHOME_PROJECT_NAME
|
||||||
std::string project_version{};
|
std::string project_version{};
|
||||||
|
#endif
|
||||||
|
#ifdef USE_WEBSERVER
|
||||||
uint32_t webserver_port{0};
|
uint32_t webserver_port{0};
|
||||||
|
#endif
|
||||||
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
uint32_t legacy_bluetooth_proxy_version{0};
|
uint32_t legacy_bluetooth_proxy_version{0};
|
||||||
|
#endif
|
||||||
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
uint32_t bluetooth_proxy_feature_flags{0};
|
uint32_t bluetooth_proxy_feature_flags{0};
|
||||||
|
#endif
|
||||||
std::string manufacturer{};
|
std::string manufacturer{};
|
||||||
std::string friendly_name{};
|
std::string friendly_name{};
|
||||||
|
#ifdef USE_VOICE_ASSISTANT
|
||||||
uint32_t legacy_voice_assistant_version{0};
|
uint32_t legacy_voice_assistant_version{0};
|
||||||
|
#endif
|
||||||
|
#ifdef USE_VOICE_ASSISTANT
|
||||||
uint32_t voice_assistant_feature_flags{0};
|
uint32_t voice_assistant_feature_flags{0};
|
||||||
|
#endif
|
||||||
|
#ifdef USE_AREAS
|
||||||
std::string suggested_area{};
|
std::string suggested_area{};
|
||||||
|
#endif
|
||||||
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
std::string bluetooth_mac_address{};
|
std::string bluetooth_mac_address{};
|
||||||
|
#endif
|
||||||
|
#ifdef USE_API_NOISE
|
||||||
bool api_encryption_supported{false};
|
bool api_encryption_supported{false};
|
||||||
|
#endif
|
||||||
|
#ifdef USE_DEVICES
|
||||||
std::vector<DeviceInfo> devices{};
|
std::vector<DeviceInfo> devices{};
|
||||||
|
#endif
|
||||||
|
#ifdef USE_AREAS
|
||||||
std::vector<AreaInfo> areas{};
|
std::vector<AreaInfo> areas{};
|
||||||
|
#endif
|
||||||
|
#ifdef USE_AREAS
|
||||||
AreaInfo area{};
|
AreaInfo area{};
|
||||||
|
#endif
|
||||||
void encode(ProtoWriteBuffer buffer) const override;
|
void encode(ProtoWriteBuffer buffer) const override;
|
||||||
void calculate_size(uint32_t &total_size) const override;
|
void calculate_size(uint32_t &total_size) const override;
|
||||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||||
|
@ -76,6 +76,30 @@ def indent(text: str, padding: str = " ") -> str:
|
|||||||
return "\n".join(indent_list(text, padding))
|
return "\n".join(indent_list(text, padding))
|
||||||
|
|
||||||
|
|
||||||
|
def wrap_with_ifdef(content: str | list[str], ifdef: str | None) -> list[str]:
|
||||||
|
"""Wrap content with #ifdef directives if ifdef is provided.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content: Single string or list of strings to wrap
|
||||||
|
ifdef: The ifdef condition, or None to skip wrapping
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
List of strings with ifdef wrapping if needed
|
||||||
|
"""
|
||||||
|
if not ifdef:
|
||||||
|
if isinstance(content, str):
|
||||||
|
return [content]
|
||||||
|
return content
|
||||||
|
|
||||||
|
result = [f"#ifdef {ifdef}"]
|
||||||
|
if isinstance(content, str):
|
||||||
|
result.append(content)
|
||||||
|
else:
|
||||||
|
result.extend(content)
|
||||||
|
result.append("#endif")
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def camel_to_snake(name: str) -> str:
|
def camel_to_snake(name: str) -> str:
|
||||||
# https://stackoverflow.com/a/1176023
|
# https://stackoverflow.com/a/1176023
|
||||||
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)
|
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)
|
||||||
@ -1103,24 +1127,55 @@ def build_message_type(
|
|||||||
# Skip field declarations for fields that are in the base class
|
# Skip field declarations for fields that are in the base class
|
||||||
# but include their encode/decode logic
|
# but include their encode/decode logic
|
||||||
if field.name not in common_field_names:
|
if field.name not in common_field_names:
|
||||||
protected_content.extend(ti.protected_content)
|
# Check for field_ifdef option
|
||||||
public_content.extend(ti.public_content)
|
field_ifdef = None
|
||||||
|
if field.options.HasExtension(pb.field_ifdef):
|
||||||
|
field_ifdef = field.options.Extensions[pb.field_ifdef]
|
||||||
|
|
||||||
|
if ti.protected_content:
|
||||||
|
protected_content.extend(
|
||||||
|
wrap_with_ifdef(ti.protected_content, field_ifdef)
|
||||||
|
)
|
||||||
|
if ti.public_content:
|
||||||
|
public_content.extend(wrap_with_ifdef(ti.public_content, field_ifdef))
|
||||||
|
|
||||||
# Only collect encode logic if this message needs it
|
# Only collect encode logic if this message needs it
|
||||||
if needs_encode:
|
if needs_encode:
|
||||||
encode.append(ti.encode_content)
|
# Check for field_ifdef option
|
||||||
size_calc.append(ti.get_size_calculation(f"this->{ti.field_name}"))
|
field_ifdef = None
|
||||||
|
if field.options.HasExtension(pb.field_ifdef):
|
||||||
|
field_ifdef = field.options.Extensions[pb.field_ifdef]
|
||||||
|
|
||||||
|
encode.extend(wrap_with_ifdef(ti.encode_content, field_ifdef))
|
||||||
|
size_calc.extend(
|
||||||
|
wrap_with_ifdef(
|
||||||
|
ti.get_size_calculation(f"this->{ti.field_name}"), field_ifdef
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# Only collect decode methods if this message needs them
|
# Only collect decode methods if this message needs them
|
||||||
if needs_decode:
|
if needs_decode:
|
||||||
|
# Check for field_ifdef option for decode as well
|
||||||
|
field_ifdef = None
|
||||||
|
if field.options.HasExtension(pb.field_ifdef):
|
||||||
|
field_ifdef = field.options.Extensions[pb.field_ifdef]
|
||||||
|
|
||||||
if ti.decode_varint_content:
|
if ti.decode_varint_content:
|
||||||
decode_varint.append(ti.decode_varint_content)
|
decode_varint.extend(
|
||||||
|
wrap_with_ifdef(ti.decode_varint_content, field_ifdef)
|
||||||
|
)
|
||||||
if ti.decode_length_content:
|
if ti.decode_length_content:
|
||||||
decode_length.append(ti.decode_length_content)
|
decode_length.extend(
|
||||||
|
wrap_with_ifdef(ti.decode_length_content, field_ifdef)
|
||||||
|
)
|
||||||
if ti.decode_32bit_content:
|
if ti.decode_32bit_content:
|
||||||
decode_32bit.append(ti.decode_32bit_content)
|
decode_32bit.extend(
|
||||||
|
wrap_with_ifdef(ti.decode_32bit_content, field_ifdef)
|
||||||
|
)
|
||||||
if ti.decode_64bit_content:
|
if ti.decode_64bit_content:
|
||||||
decode_64bit.append(ti.decode_64bit_content)
|
decode_64bit.extend(
|
||||||
|
wrap_with_ifdef(ti.decode_64bit_content, field_ifdef)
|
||||||
|
)
|
||||||
if ti.dump_content:
|
if ti.dump_content:
|
||||||
dump.append(ti.dump_content)
|
dump.append(ti.dump_content)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user