ESPHome 2025.5.0
Loading...
Searching...
No Matches
radon_eye_listener.cpp
Go to the documentation of this file.
2#include "esphome/core/log.h"
3#include <algorithm>
4#include <vector>
5
6#ifdef USE_ESP32
7
8namespace esphome {
9namespace radon_eye_ble {
10
11static const char *const TAG = "radon_eye_ble";
12
14 if (not device.get_name().empty()) {
15 // Vector containing the prefixes to search for
16 std::vector<std::string> prefixes = {"FR:R", "FR:I", "FR:H"};
17
18 // Check if the device name starts with any of the prefixes
19 if (std::any_of(prefixes.begin(), prefixes.end(),
20 [&](const std::string &prefix) { return device.get_name().rfind(prefix, 0) == 0; })) {
21 // Device found
22 ESP_LOGD(TAG, "Found Radon Eye device Name: %s (MAC: %s)", device.get_name().c_str(),
23 device.address_str().c_str());
24 }
25 }
26 return false;
27}
28
29} // namespace radon_eye_ble
30} // namespace esphome
31
32#endif
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7