fixed more clang-tidy issues

This commit is contained in:
j0ta29 2024-02-19 22:06:58 +00:00
parent c13d14fcde
commit 8eb6ea2f00
5 changed files with 6 additions and 5 deletions

View file

@ -157,7 +157,7 @@ void DatapointComponent::datapoint_value_changed(uint32_t value) {
ESP_LOGW(TAG, "unused value update by sensor %s", get_component_name().c_str());
}
void DatapointComponent::datapoint_value_changed(std::string value) {
void DatapointComponent::datapoint_value_changed(const std::string &value) {
ESP_LOGW(TAG, "unused value update by sensor %s", get_component_name().c_str());
}
@ -266,7 +266,7 @@ void DatapointComponent::subscribe_hass_(const std::string &entity_id, const std
return;
}
}
HassSubscription subscription{entity_id};
HassSubscription subscription{entity_id, ""};
subscription.callbacks.push_back(f);
hass_subscriptions_.push_back(subscription);

View file

@ -42,7 +42,7 @@ class DatapointComponent {
virtual void datapoint_value_changed(uint8_t value);
virtual void datapoint_value_changed(uint16_t value);
virtual void datapoint_value_changed(uint32_t value);
virtual void datapoint_value_changed(std::string value);
virtual void datapoint_value_changed(const std::string &value);
virtual void datapoint_value_changed(uint8_t *value, size_t length);
void write_datapoint_value_(float value);

View file

@ -23,7 +23,7 @@ void OptolinkSelect::control(const std::string &value) {
}
};
void OptolinkSelect::datapoint_value_changed(std::string value) {
void OptolinkSelect::datapoint_value_changed(const std::string &value) {
auto pos = mapping_->find(value);
if (pos == mapping_->end()) {
set_optolink_state_("value %s not found in select %s", value.c_str(), get_component_name().c_str());

View file

@ -29,7 +29,7 @@ class OptolinkSelect : public DatapointComponent, public esphome::select::Select
void control(const std::string &value) override;
const StringRef &get_component_name() override { return get_name(); }
void datapoint_value_changed(std::string value) override;
void datapoint_value_changed(const std::string &value) override;
void datapoint_value_changed(uint8_t value) override;
void datapoint_value_changed(uint16_t value) override;
void datapoint_value_changed(uint32_t value) override;

View file

@ -34,6 +34,7 @@ uint8_t *encode_time_string(const std::string &input) {
char *token = strtok(buffer, " ");
while (token && time_count < 8) {
Time current_time;
// NOLINTNEXTLINE
if (sscanf(token, "%d:%d", &current_time.hours, &current_time.minutes) == 2) {
if (check_time_values(current_time) && check_time_sequence(prev_time, current_time)) {
time_values[time_count++] = current_time;