mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	no real good option but to disable them all manually
This commit is contained in:
		| @@ -40,6 +40,7 @@ const EntityBase *MQTTNumberComponent::get_entity() const { return this->number_ | |||||||
| void MQTTNumberComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | void MQTTNumberComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | ||||||
|   const auto &traits = number_->traits; |   const auto &traits = number_->traits; | ||||||
|   // https://www.home-assistant.io/integrations/number.mqtt/ |   // https://www.home-assistant.io/integrations/number.mqtt/ | ||||||
|  |   // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson | ||||||
|   root[MQTT_MIN] = traits.get_min_value(); |   root[MQTT_MIN] = traits.get_min_value(); | ||||||
|   root[MQTT_MAX] = traits.get_max_value(); |   root[MQTT_MAX] = traits.get_max_value(); | ||||||
|   root[MQTT_STEP] = traits.get_step(); |   root[MQTT_STEP] = traits.get_step(); | ||||||
|   | |||||||
| @@ -35,6 +35,7 @@ const EntityBase *MQTTSelectComponent::get_entity() const { return this->select_ | |||||||
| void MQTTSelectComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | void MQTTSelectComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | ||||||
|   const auto &traits = select_->traits; |   const auto &traits = select_->traits; | ||||||
|   // https://www.home-assistant.io/integrations/select.mqtt/ |   // https://www.home-assistant.io/integrations/select.mqtt/ | ||||||
|  |   // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson | ||||||
|   JsonArray options = root[MQTT_OPTIONS].to<JsonArray>(); |   JsonArray options = root[MQTT_OPTIONS].to<JsonArray>(); | ||||||
|   for (const auto &option : traits.get_options()) |   for (const auto &option : traits.get_options()) | ||||||
|     options.add(option); |     options.add(option); | ||||||
|   | |||||||
| @@ -45,6 +45,7 @@ void MQTTSensorComponent::disable_expire_after() { this->expire_after_ = 0; } | |||||||
|  |  | ||||||
| void MQTTSensorComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | void MQTTSensorComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | ||||||
|   if (!this->sensor_->get_device_class().empty()) |   if (!this->sensor_->get_device_class().empty()) | ||||||
|  |     // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson | ||||||
|     root[MQTT_DEVICE_CLASS] = this->sensor_->get_device_class(); |     root[MQTT_DEVICE_CLASS] = this->sensor_->get_device_class(); | ||||||
|  |  | ||||||
|   if (!this->sensor_->get_unit_of_measurement().empty()) |   if (!this->sensor_->get_unit_of_measurement().empty()) | ||||||
|   | |||||||
| @@ -46,6 +46,7 @@ std::string MQTTSwitchComponent::component_type() const { return "switch"; } | |||||||
| const EntityBase *MQTTSwitchComponent::get_entity() const { return this->switch_; } | const EntityBase *MQTTSwitchComponent::get_entity() const { return this->switch_; } | ||||||
| void MQTTSwitchComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | void MQTTSwitchComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | ||||||
|   if (this->switch_->assumed_state()) |   if (this->switch_->assumed_state()) | ||||||
|  |     // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson | ||||||
|     root[MQTT_OPTIMISTIC] = true; |     root[MQTT_OPTIMISTIC] = true; | ||||||
| } | } | ||||||
| bool MQTTSwitchComponent::send_initial_state() { return this->publish_state(this->switch_->state); } | bool MQTTSwitchComponent::send_initial_state() { return this->publish_state(this->switch_->state); } | ||||||
|   | |||||||
| @@ -39,6 +39,7 @@ void MQTTTextComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfi | |||||||
|       root[MQTT_MODE] = "text"; |       root[MQTT_MODE] = "text"; | ||||||
|       break; |       break; | ||||||
|     case TEXT_MODE_PASSWORD: |     case TEXT_MODE_PASSWORD: | ||||||
|  |       // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson | ||||||
|       root[MQTT_MODE] = "password"; |       root[MQTT_MODE] = "password"; | ||||||
|       break; |       break; | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ using namespace esphome::text_sensor; | |||||||
| MQTTTextSensor::MQTTTextSensor(TextSensor *sensor) : sensor_(sensor) {} | MQTTTextSensor::MQTTTextSensor(TextSensor *sensor) : sensor_(sensor) {} | ||||||
| void MQTTTextSensor::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | void MQTTTextSensor::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | ||||||
|   if (!this->sensor_->get_device_class().empty()) |   if (!this->sensor_->get_device_class().empty()) | ||||||
|  |     // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson | ||||||
|     root[MQTT_DEVICE_CLASS] = this->sensor_->get_device_class(); |     root[MQTT_DEVICE_CLASS] = this->sensor_->get_device_class(); | ||||||
|   config.command_topic = false; |   config.command_topic = false; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -55,6 +55,7 @@ bool MQTTTimeComponent::send_initial_state() { | |||||||
| } | } | ||||||
| bool MQTTTimeComponent::publish_state(uint8_t hour, uint8_t minute, uint8_t second) { | bool MQTTTimeComponent::publish_state(uint8_t hour, uint8_t minute, uint8_t second) { | ||||||
|   return this->publish_json(this->get_state_topic_(), [hour, minute, second](JsonObject root) { |   return this->publish_json(this->get_state_topic_(), [hour, minute, second](JsonObject root) { | ||||||
|  |     // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson | ||||||
|     root["hour"] = hour; |     root["hour"] = hour; | ||||||
|     root["minute"] = minute; |     root["minute"] = minute; | ||||||
|     root["second"] = second; |     root["second"] = second; | ||||||
|   | |||||||
| @@ -41,6 +41,7 @@ bool MQTTUpdateComponent::publish_state() { | |||||||
| } | } | ||||||
|  |  | ||||||
| void MQTTUpdateComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | void MQTTUpdateComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | ||||||
|  |   // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson | ||||||
|   root["schema"] = "json"; |   root["schema"] = "json"; | ||||||
|   root[MQTT_PAYLOAD_INSTALL] = "INSTALL"; |   root[MQTT_PAYLOAD_INSTALL] = "INSTALL"; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -50,6 +50,7 @@ void MQTTValveComponent::dump_config() { | |||||||
| } | } | ||||||
| void MQTTValveComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | void MQTTValveComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) { | ||||||
|   if (!this->valve_->get_device_class().empty()) |   if (!this->valve_->get_device_class().empty()) | ||||||
|  |     // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) false positive with ArduinoJson | ||||||
|     root[MQTT_DEVICE_CLASS] = this->valve_->get_device_class(); |     root[MQTT_DEVICE_CLASS] = this->valve_->get_device_class(); | ||||||
|  |  | ||||||
|   auto traits = this->valve_->get_traits(); |   auto traits = this->valve_->get_traits(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user