ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
lt_component.cpp
Go to the documentation of this file.
1#include "lt_component.h"
2
3#ifdef USE_LIBRETINY
4
5#include <cstring>
6
8#include "esphome/core/log.h"
9
10namespace esphome::libretiny {
11
12ESPHOME_LOG_TAG(TAG, "libretiny");
13
15 ESP_LOGCONFIG(TAG,
16 "LibreTiny:\n"
17 " Version: %s\n"
18 " Loglevel: %u",
19 &LT_BANNER_STR[10], LT_LOGLEVEL);
20#if defined(__OPTIMIZE_SIZE__) && __OPTIMIZE_LEVEL__ > 0 && __OPTIMIZE_LEVEL__ <= 3
21 ESP_LOGCONFIG(TAG, " Optimization: -Os, SDK: -O" STRINGIFY_MACRO(__OPTIMIZE_LEVEL__));
22#endif
23
24#if defined(USE_LN882X) && defined(USE_WIFI)
25 // The SDK falls back to this MAC when the board layout's KV store holds none.
26 static constexpr uint8_t SDK_DEFAULT_MAC[MAC_ADDRESS_SIZE] = {0x00, 0x50, 0xC2, 0x5E, 0x10, 0x88};
27 uint8_t mac[MAC_ADDRESS_SIZE];
29 if (memcmp(mac, SDK_DEFAULT_MAC, MAC_ADDRESS_SIZE) == 0) {
30 ESP_LOGE(TAG, "MAC is the LN882H SDK default 00:50:C2:5E:10:88; only one device with it can be on a network. "
31 "On a Tuya module, set board: to its Tuya board (e.g. wl2s, wl2h-u) and flash over serial");
32 }
33#endif
34
35#ifdef USE_TEXT_SENSOR
36 if (this->version_ != nullptr) {
37 this->version_->publish_state(&LT_BANNER_STR[10]);
38 }
39#endif // USE_TEXT_SENSOR
40}
41
43
44} // namespace esphome::libretiny
45
46#endif // USE_LIBRETINY
text_sensor::TextSensor * version_
float get_setup_priority() const override
void publish_state(const std::string &state)
Definition text_sensor.h:42
ESPHOME_LOG_TAG(TAG, "libretiny.gpio")
constexpr float LATE
For components that should be initialized at the very end of the setup process.
Definition component.h:59
void get_mac_address_raw(uint8_t *mac)
Get the device MAC address as raw bytes, written into the provided byte array (6 bytes).
Definition helpers.cpp:87