false positives

This commit is contained in:
J. Nick Koston
2026-03-04 08:03:02 -10:00
parent 5373412f60
commit b9beb45b91
3 changed files with 6 additions and 0 deletions
@@ -29,10 +29,12 @@ MQTTBinarySensorComponent::MQTTBinarySensorComponent(binary_sensor::BinarySensor
}
void MQTTBinarySensorComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) {
// NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson
if (this->binary_sensor_->is_status_binary_sensor())
root[MQTT_PAYLOAD_ON] = mqtt::global_mqtt_client->get_availability().payload_available;
if (this->binary_sensor_->is_status_binary_sensor())
root[MQTT_PAYLOAD_OFF] = mqtt::global_mqtt_client->get_availability().payload_not_available;
// NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
config.command_topic = false;
}
bool MQTTBinarySensorComponent::send_initial_state() {
+2
View File
@@ -90,6 +90,7 @@ void MQTTCoverComponent::dump_config() {
}
}
void MQTTCoverComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) {
// NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson
auto traits = this->cover_->get_traits();
if (traits.get_is_assumed_state()) {
root[MQTT_OPTIMISTIC] = true;
@@ -122,6 +123,7 @@ void MQTTCoverComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConf
root[MQTT_TILT_COMMAND_TOPIC] = this->get_tilt_command_topic_to(topic_buf);
}
}
// NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
if (traits.get_supports_tilt() && !traits.get_supports_position()) {
config.command_topic = false;
}
+2
View File
@@ -63,6 +63,7 @@ void MQTTValveComponent::dump_config() {
}
}
void MQTTValveComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) {
// NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson
auto traits = this->valve_->get_traits();
if (traits.get_is_assumed_state()) {
root[MQTT_OPTIMISTIC] = true;
@@ -71,6 +72,7 @@ void MQTTValveComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConf
root[MQTT_POSITION_TOPIC] = this->get_position_state_topic();
root[MQTT_SET_POSITION_TOPIC] = this->get_position_command_topic();
}
// NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
}
MQTT_COMPONENT_TYPE(MQTTValveComponent, "valve")