From 847ba6424574d3f9c6db86e427bdcf8a61d1787e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 5 Jun 2025 23:09:45 +0100 Subject: [PATCH] tweak --- esphome/components/api/api_connection.cpp | 15 ++------------- esphome/components/api/api_connection.h | 5 ----- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index 4519bd63bd..722f8a02ac 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -286,29 +286,18 @@ void APIConnection::on_disconnect_response(const DisconnectResponse &value) { #ifdef USE_BINARY_SENSOR bool APIConnection::send_binary_sensor_state(binary_sensor::BinarySensor *binary_sensor, bool state) { - return this->send_state_with_value_(binary_sensor, &APIConnection::try_send_binary_sensor_state_, - &APIConnection::try_send_binary_sensor_state_, state); -} -void APIConnection::send_binary_sensor_info(binary_sensor::BinarySensor *binary_sensor) { - this->send_info_(static_cast(binary_sensor), - reinterpret_cast(&APIConnection::try_send_binary_sensor_info_)); -} -bool APIConnection::try_send_binary_sensor_state_(binary_sensor::BinarySensor *binary_sensor) { - return this->try_send_binary_sensor_state_(binary_sensor, binary_sensor->state); -} -bool APIConnection::try_send_binary_sensor_state_(binary_sensor::BinarySensor *binary_sensor, bool state) { BinarySensorStateResponse msg; msg.state = state; msg.missing_state = !binary_sensor->has_state(); msg.key = binary_sensor->get_object_id_hash(); return this->try_send_entity_state(msg); } -bool APIConnection::try_send_binary_sensor_info_(binary_sensor::BinarySensor *binary_sensor) { +void APIConnection::send_binary_sensor_info(binary_sensor::BinarySensor *binary_sensor) { ListEntitiesBinarySensorResponse msg; msg.device_class = binary_sensor->get_device_class(); msg.is_status_binary_sensor = binary_sensor->is_status_binary_sensor(); msg.unique_id = get_default_unique_id("binary_sensor", binary_sensor); - return this->try_send_entity_info_(static_cast(binary_sensor), msg); + this->try_send_entity_info_(static_cast(binary_sensor), msg); } #endif diff --git a/esphome/components/api/api_connection.h b/esphome/components/api/api_connection.h index 727802045d..ca626b5a57 100644 --- a/esphome/components/api/api_connection.h +++ b/esphome/components/api/api_connection.h @@ -75,11 +75,6 @@ class APIConnection : public APIServerConnection { bool send_binary_sensor_state(binary_sensor::BinarySensor *binary_sensor, bool state); void send_binary_sensor_info(binary_sensor::BinarySensor *binary_sensor); - protected: - bool try_send_binary_sensor_state_(binary_sensor::BinarySensor *binary_sensor); - bool try_send_binary_sensor_state_(binary_sensor::BinarySensor *binary_sensor, bool state); - bool try_send_binary_sensor_info_(binary_sensor::BinarySensor *binary_sensor); - public: #endif #ifdef USE_COVER