diff --git a/esphome/components/optolink/datapoint_component.cpp b/esphome/components/optolink/datapoint_component.cpp index 662aa303be..c059ec68a5 100644 --- a/esphome/components/optolink/datapoint_component.cpp +++ b/esphome/components/optolink/datapoint_component.cpp @@ -259,7 +259,7 @@ void DatapointComponent::set_optolink_state_(const char *format, ...) { std::string DatapointComponent::get_optolink_state_() { return optolink_->get_state(); } -void DatapointComponent::subscribe_hass_(const std::string entity_id, std::function f) { +void DatapointComponent::subscribe_hass_(const std::string &entity_id, const std::function &f) { for (auto &subscription : hass_subscriptions_) { if (subscription.entity_id == entity_id) { subscription.callbacks.push_back(f); diff --git a/esphome/components/optolink/datapoint_component.h b/esphome/components/optolink/datapoint_component.h index 5eb751e10b..acc591738e 100644 --- a/esphome/components/optolink/datapoint_component.h +++ b/esphome/components/optolink/datapoint_component.h @@ -55,7 +55,7 @@ class DatapointComponent { void set_optolink_state_(const char *format, ...); std::string get_optolink_state_(); - void subscribe_hass_(const std::string entity_id, std::function f); + void subscribe_hass_(const std::string &entity_id, const std::function &f); private: const size_t max_retries_until_reset_ = 10; diff --git a/esphome/components/optolink/text_sensor/optolink_text_sensor.cpp b/esphome/components/optolink/text_sensor/optolink_text_sensor.cpp index ed8779132c..d146871e23 100644 --- a/esphome/components/optolink/text_sensor/optolink_text_sensor.cpp +++ b/esphome/components/optolink/text_sensor/optolink_text_sensor.cpp @@ -23,7 +23,7 @@ bool check_time_values(const Time &time) { return (time.hours >= 0 && time.hours <= 23) && (time.minutes >= 0 && time.minutes <= 59); } -uint8_t *encode_time_string(const std::string input) { +uint8_t *encode_time_string(const std::string &input) { char buffer[49]; strncpy(buffer, input.c_str(), sizeof(buffer)); buffer[sizeof(buffer) - 1] = 0x00;