mirror of
https://github.com/esphome/esphome.git
synced 2025-11-19 16:25:50 +00:00
ESP-IDF support and generic target platforms (#2303)
* Socket refactor and SSL * esp-idf temp * Fixes * Echo component and noise * Add noise API transport support * Updates * ESP-IDF * Complete * Fixes * Fixes * Versions update * New i2c APIs * Complete i2c refactor * SPI migration * Revert ESP Preferences migration, too complex for now * OTA support * Remove echo again * Remove ssl again * GPIOFlags updates * Rename esphal and ICACHE_RAM_ATTR * Make ESP32 arduino compilable again * Fix GPIO flags * Complete pin registry refactor and fixes * Fixes to make test1 compile * Remove sdkconfig file * Ignore sdkconfig file * Fixes in reviewing * Make test2 compile * Make test4 compile * Make test5 compile * Run clang-format * Fix lint errors * Use esp-idf APIs instead of btStart * Another round of fixes * Start implementing ESP8266 * Make test3 compile * Guard esp8266 code * Lint * Reformat * Fixes * Fixes v2 * more fixes * ESP-IDF tidy target * Convert ARDUINO_ARCH_ESPxx * Update WiFiSignalSensor * Update time ifdefs * OTA needs millis from hal * RestartSwitch needs delay from hal * ESP-IDF Uart * Fix OTA blank password * Allow setting sdkconfig * Fix idf partitions and allow setting sdkconfig from yaml * Re-add read/write compat APIs and fix esp8266 uart * Fix esp8266 store log strings in flash * Fix ESP32 arduino preferences not initialized * Update ifdefs * Change how sdkconfig change is detected * Add checks to ci-custom and fix them * Run clang-format * Add esp-idf clang-tidy target and fix errors * Fixes from clang-tidy idf round 2 * Fixes from compiling tests with esp-idf * Run clang-format * Switch test5.yaml to esp-idf * Implement ESP8266 Preferences * Lint * Re-do PIO package version selection a bit * Fix arduinoespressif32 package version * Fix unit tests * Lint * Lint fixes * Fix readv/writev not defined * Fix graphing component * Re-add all old options from core/config.py Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -192,6 +192,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
}
|
||||
),
|
||||
validate_config,
|
||||
cv.only_with_arduino,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "custom_mqtt_device.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
@@ -28,3 +31,5 @@ bool CustomMQTTDevice::is_connected() { return global_mqtt_client != nullptr &&
|
||||
|
||||
} // namespace mqtt
|
||||
} // namespace esphome
|
||||
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
#ifdef USE_MQTT
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "mqtt_client.h"
|
||||
|
||||
@@ -215,3 +218,5 @@ void CustomMQTTDevice::subscribe_json(const std::string &topic, void (T::*callba
|
||||
|
||||
} // namespace mqtt
|
||||
} // namespace esphome
|
||||
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "mqtt_binary_sensor.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_BINARY_SENSOR
|
||||
|
||||
namespace esphome {
|
||||
@@ -55,3 +56,4 @@ bool MQTTBinarySensorComponent::publish_state(bool state) {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_BINARY_SENSOR
|
||||
|
||||
#include "mqtt_component.h"
|
||||
@@ -41,3 +41,4 @@ class MQTTBinarySensorComponent : public mqtt::MQTTComponent {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "mqtt_client.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
|
||||
#include "esphome/core/application.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/util.h"
|
||||
#include "esphome/components/network/util.h"
|
||||
#include <utility>
|
||||
#ifdef USE_LOGGER
|
||||
#include "esphome/components/logger/logger.h"
|
||||
@@ -60,7 +62,7 @@ void MQTTClientComponent::setup() {
|
||||
void MQTTClientComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MQTT:");
|
||||
ESP_LOGCONFIG(TAG, " Server Address: %s:%u (%s)", this->credentials_.address.c_str(), this->credentials_.port,
|
||||
this->ip_.toString().c_str());
|
||||
this->ip_.str().c_str());
|
||||
ESP_LOGCONFIG(TAG, " Username: " LOG_SECRET("'%s'"), this->credentials_.username.c_str());
|
||||
ESP_LOGCONFIG(TAG, " Client ID: " LOG_SECRET("'%s'"), this->credentials_.client_id.c_str());
|
||||
if (!this->discovery_info_.prefix.empty()) {
|
||||
@@ -87,11 +89,11 @@ void MQTTClientComponent::start_dnslookup_() {
|
||||
this->dns_resolve_error_ = false;
|
||||
this->dns_resolved_ = false;
|
||||
ip_addr_t addr;
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#ifdef USE_ESP32
|
||||
err_t err = dns_gethostbyname_addrtype(this->credentials_.address.c_str(), &addr,
|
||||
MQTTClientComponent::dns_found_callback, this, LWIP_DNS_ADDRTYPE_IPV4);
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
#ifdef USE_ESP8266
|
||||
err_t err = dns_gethostbyname(this->credentials_.address.c_str(), &addr,
|
||||
esphome::mqtt::MQTTClientComponent::dns_found_callback, this);
|
||||
#endif
|
||||
@@ -99,11 +101,11 @@ void MQTTClientComponent::start_dnslookup_() {
|
||||
case ERR_OK: {
|
||||
// Got IP immediately
|
||||
this->dns_resolved_ = true;
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
this->ip_ = IPAddress(addr.u_addr.ip4.addr);
|
||||
#ifdef USE_ESP32
|
||||
this->ip_ = addr.u_addr.ip4.addr;
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
this->ip_ = IPAddress(addr.addr);
|
||||
#ifdef USE_ESP8266
|
||||
this->ip_ = addr.addr;
|
||||
#endif
|
||||
this->start_connect_();
|
||||
return;
|
||||
@@ -116,7 +118,7 @@ void MQTTClientComponent::start_dnslookup_() {
|
||||
default:
|
||||
case ERR_ARG: {
|
||||
// error
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#if defined(USE_ESP8266)
|
||||
ESP_LOGW(TAG, "Error resolving MQTT broker IP address: %ld", err);
|
||||
#else
|
||||
ESP_LOGW(TAG, "Error resolving MQTT broker IP address: %d", err);
|
||||
@@ -143,10 +145,10 @@ void MQTTClientComponent::check_dnslookup_() {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Resolved broker IP address to %s", this->ip_.toString().c_str());
|
||||
ESP_LOGD(TAG, "Resolved broker IP address to %s", this->ip_.str().c_str());
|
||||
this->start_connect_();
|
||||
}
|
||||
#if defined(ARDUINO_ARCH_ESP8266) && LWIP_VERSION_MAJOR == 1
|
||||
#if defined(USE_ESP8266) && LWIP_VERSION_MAJOR == 1
|
||||
void MQTTClientComponent::dns_found_callback(const char *name, ip_addr_t *ipaddr, void *callback_arg) {
|
||||
#else
|
||||
void MQTTClientComponent::dns_found_callback(const char *name, const ip_addr_t *ipaddr, void *callback_arg) {
|
||||
@@ -155,18 +157,18 @@ void MQTTClientComponent::dns_found_callback(const char *name, const ip_addr_t *
|
||||
if (ipaddr == nullptr) {
|
||||
a_this->dns_resolve_error_ = true;
|
||||
} else {
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
a_this->ip_ = IPAddress(ipaddr->u_addr.ip4.addr);
|
||||
#ifdef USE_ESP32
|
||||
a_this->ip_ = ipaddr->u_addr.ip4.addr;
|
||||
#endif
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
a_this->ip_ = IPAddress(ipaddr->addr);
|
||||
#ifdef USE_ESP8266
|
||||
a_this->ip_ = ipaddr->addr;
|
||||
#endif
|
||||
a_this->dns_resolved_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MQTTClientComponent::start_connect_() {
|
||||
if (!network_is_connected())
|
||||
if (!network::is_connected())
|
||||
return;
|
||||
|
||||
ESP_LOGI(TAG, "Connecting to MQTT...");
|
||||
@@ -183,7 +185,7 @@ void MQTTClientComponent::start_connect_() {
|
||||
|
||||
this->mqtt_client_.setCredentials(username, password);
|
||||
|
||||
this->mqtt_client_.setServer(this->ip_, this->credentials_.port);
|
||||
this->mqtt_client_.setServer((uint32_t) this->ip_, this->credentials_.port);
|
||||
if (!this->last_will_.topic.empty()) {
|
||||
this->mqtt_client_.setWill(this->last_will_.topic.c_str(), this->last_will_.qos, this->last_will_.retain,
|
||||
this->last_will_.payload.c_str(), this->last_will_.payload.length());
|
||||
@@ -251,7 +253,7 @@ void MQTTClientComponent::loop() {
|
||||
reason_s = LOG_STR("Unknown");
|
||||
break;
|
||||
}
|
||||
if (!network_is_connected()) {
|
||||
if (!network::is_connected()) {
|
||||
reason_s = LOG_STR("WiFi disconnected");
|
||||
}
|
||||
ESP_LOGW(TAG, "MQTT Disconnected: %s.", LOG_STR_ARG(reason_s));
|
||||
@@ -477,7 +479,7 @@ static bool topic_match(const char *message, const char *subscription) {
|
||||
}
|
||||
|
||||
void MQTTClientComponent::on_message(const std::string &topic, const std::string &payload) {
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
#ifdef USE_ESP8266
|
||||
// on ESP8266, this is called in LWiP thread; some components do not like running
|
||||
// in an ISR.
|
||||
this->defer([this, topic, payload]() {
|
||||
@@ -485,7 +487,7 @@ void MQTTClientComponent::on_message(const std::string &topic, const std::string
|
||||
for (auto &subscription : this->subscriptions_)
|
||||
if (topic_match(topic.c_str(), subscription.topic.c_str()))
|
||||
subscription.callback(topic, payload);
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
#ifdef USE_ESP8266
|
||||
});
|
||||
#endif
|
||||
}
|
||||
@@ -587,3 +589,5 @@ float MQTTMessageTrigger::get_setup_priority() const { return setup_priority::AF
|
||||
|
||||
} // namespace mqtt
|
||||
} // namespace esphome
|
||||
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/automation.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/components/json/json_util.h"
|
||||
#include "esphome/components/network/ip_address.h"
|
||||
#include <AsyncMqttClient.h>
|
||||
#include "lwip/ip_addr.h"
|
||||
|
||||
@@ -226,7 +230,7 @@ class MQTTClientComponent : public Component {
|
||||
void start_connect_();
|
||||
void start_dnslookup_();
|
||||
void check_dnslookup_();
|
||||
#if defined(ARDUINO_ARCH_ESP8266) && LWIP_VERSION_MAJOR == 1
|
||||
#if defined(USE_ESP8266) && LWIP_VERSION_MAJOR == 1
|
||||
static void dns_found_callback(const char *name, ip_addr_t *ipaddr, void *callback_arg);
|
||||
#else
|
||||
static void dns_found_callback(const char *name, const ip_addr_t *ipaddr, void *callback_arg);
|
||||
@@ -265,7 +269,7 @@ class MQTTClientComponent : public Component {
|
||||
std::vector<MQTTSubscription> subscriptions_;
|
||||
AsyncMqttClient mqtt_client_;
|
||||
MQTTClientState state_{MQTT_CLIENT_DISCONNECTED};
|
||||
IPAddress ip_;
|
||||
network::IPAddress ip_;
|
||||
bool dns_resolved_{false};
|
||||
bool dns_resolve_error_{false};
|
||||
std::vector<MQTTComponent *> children_;
|
||||
@@ -352,3 +356,5 @@ template<typename... Ts> class MQTTConnectedCondition : public Condition<Ts...>
|
||||
|
||||
} // namespace mqtt
|
||||
} // namespace esphome
|
||||
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "mqtt_climate.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_CLIMATE
|
||||
|
||||
namespace esphome {
|
||||
@@ -245,7 +246,7 @@ bool MQTTClimateComponent::publish_state_() {
|
||||
if (!this->publish(this->get_mode_state_topic(), mode_s))
|
||||
success = false;
|
||||
int8_t accuracy = traits.get_temperature_accuracy_decimals();
|
||||
if (traits.get_supports_current_temperature() && !isnan(this->device_->current_temperature)) {
|
||||
if (traits.get_supports_current_temperature() && !std::isnan(this->device_->current_temperature)) {
|
||||
std::string payload = value_accuracy_to_string(this->device_->current_temperature, accuracy);
|
||||
if (!this->publish(this->get_current_temperature_state_topic(), payload))
|
||||
success = false;
|
||||
@@ -359,3 +360,4 @@ bool MQTTClimateComponent::publish_state_() {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_CLIMATE
|
||||
|
||||
#include "esphome/components/climate/climate.h"
|
||||
@@ -48,3 +49,4 @@ class MQTTClimateComponent : public mqtt::MQTTComponent {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "mqtt_component.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/application.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
@@ -198,3 +201,5 @@ bool MQTTComponent::is_connected_() const { return global_mqtt_client->is_connec
|
||||
|
||||
} // namespace mqtt
|
||||
} // namespace esphome
|
||||
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
@@ -181,3 +185,5 @@ class MQTTComponent : public Component {
|
||||
|
||||
} // namespace mqtt
|
||||
} // namespace esphome
|
||||
|
||||
#endif // USE_MQTt
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "mqtt_cover.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_COVER
|
||||
|
||||
namespace esphome {
|
||||
@@ -115,3 +116,4 @@ bool MQTTCoverComponent::publish_state() {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "esphome/core/defines.h"
|
||||
#include "mqtt_component.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_COVER
|
||||
|
||||
#include "esphome/components/cover/cover.h"
|
||||
@@ -40,3 +41,4 @@ class MQTTCoverComponent : public mqtt::MQTTComponent {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "mqtt_fan.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_FAN
|
||||
#include "esphome/components/fan/fan_helpers.h"
|
||||
|
||||
@@ -127,3 +128,4 @@ bool MQTTFanComponent::publish_state() {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_FAN
|
||||
|
||||
#include "esphome/components/fan/fan_state.h"
|
||||
@@ -45,3 +46,4 @@ class MQTTFanComponent : public mqtt::MQTTComponent {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "mqtt_light.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_LIGHT
|
||||
|
||||
#include "esphome/components/light/light_json_schema.h"
|
||||
@@ -79,3 +80,4 @@ void MQTTJSONLightComponent::dump_config() {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_LIGHT
|
||||
|
||||
#include "mqtt_component.h"
|
||||
@@ -39,3 +40,4 @@ class MQTTJSONLightComponent : public mqtt::MQTTComponent {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "mqtt_number.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_NUMBER
|
||||
|
||||
namespace esphome {
|
||||
@@ -63,3 +64,4 @@ bool MQTTNumberComponent::publish_state(float value) {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_NUMBER
|
||||
|
||||
#include "esphome/components/number/number.h"
|
||||
@@ -44,3 +45,4 @@ class MQTTNumberComponent : public mqtt::MQTTComponent {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "mqtt_select.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_SELECT
|
||||
|
||||
namespace esphome {
|
||||
@@ -56,3 +57,4 @@ bool MQTTSelectComponent::publish_state(const std::string &value) {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_SELECT
|
||||
|
||||
#include "esphome/components/select/select.h"
|
||||
@@ -44,3 +45,4 @@ class MQTTSelectComponent : public mqtt::MQTTComponent {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "mqtt_sensor.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_SENSOR
|
||||
|
||||
#ifdef USE_DEEP_SLEEP
|
||||
@@ -77,3 +78,4 @@ std::string MQTTSensorComponent::unique_id() { return this->sensor_->unique_id()
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_SENSOR
|
||||
|
||||
#include "esphome/components/sensor/sensor.h"
|
||||
@@ -58,3 +59,4 @@ class MQTTSensorComponent : public mqtt::MQTTComponent {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "mqtt_switch.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_SWITCH
|
||||
|
||||
namespace esphome {
|
||||
@@ -58,3 +59,4 @@ bool MQTTSwitchComponent::publish_state(bool state) {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_SWITCH
|
||||
|
||||
#include "esphome/components/switch/switch.h"
|
||||
@@ -39,3 +40,4 @@ class MQTTSwitchComponent : public mqtt::MQTTComponent {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "mqtt_text_sensor.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_TEXT_SENSOR
|
||||
|
||||
namespace esphome {
|
||||
@@ -43,3 +44,4 @@ std::string MQTTTextSensor::unique_id() { return this->sensor_->unique_id(); }
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_MQTT
|
||||
#ifdef USE_TEXT_SENSOR
|
||||
|
||||
#include "esphome/components/text_sensor/text_sensor.h"
|
||||
@@ -40,3 +41,4 @@ class MQTTTextSensor : public mqtt::MQTTComponent {
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
||||
#endif // USE_MQTT
|
||||
|
||||
Reference in New Issue
Block a user