mirror of
https://github.com/esphome/esphome.git
synced 2025-11-19 16:25:50 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73bc5252a1 | ||
|
|
f2b10ad132 | ||
|
|
100ea46f03 | ||
|
|
b3ef05e5e1 | ||
|
|
45c994e4de | ||
|
|
a72545639d | ||
|
|
dfd614c00c | ||
|
|
29374837c6 | ||
|
|
2681a14d05 | ||
|
|
f436f6ee2e | ||
|
|
f18bc62690 | ||
|
|
6db73df649 | ||
|
|
93215f1737 | ||
|
|
70aa94b8a4 | ||
|
|
e8998a79c7 | ||
|
|
3b25fdbc5f | ||
|
|
6c8577678c |
@@ -90,8 +90,8 @@ static const int CAMERA_STOP_STREAM = 5000;
|
||||
APIConnection::APIConnection(std::unique_ptr<socket::Socket> sock, APIServer *parent)
|
||||
: parent_(parent), initial_state_iterator_(this), list_entities_iterator_(this) {
|
||||
#if defined(USE_API_PLAINTEXT) && defined(USE_API_NOISE)
|
||||
auto &noise_ctx = parent->get_noise_ctx();
|
||||
if (noise_ctx.has_psk()) {
|
||||
auto noise_ctx = parent->get_noise_ctx();
|
||||
if (noise_ctx->has_psk()) {
|
||||
this->helper_ =
|
||||
std::unique_ptr<APIFrameHelper>{new APINoiseFrameHelper(std::move(sock), noise_ctx, &this->client_info_)};
|
||||
} else {
|
||||
|
||||
@@ -527,7 +527,7 @@ APIError APINoiseFrameHelper::init_handshake_() {
|
||||
if (aerr != APIError::OK)
|
||||
return aerr;
|
||||
|
||||
const auto &psk = this->ctx_.get_psk();
|
||||
const auto &psk = ctx_->get_psk();
|
||||
err = noise_handshakestate_set_pre_shared_key(handshake_, psk.data(), psk.size());
|
||||
aerr = handle_noise_error_(err, LOG_STR("noise_handshakestate_set_pre_shared_key"),
|
||||
APIError::HANDSHAKESTATE_SETUP_FAILED);
|
||||
|
||||
@@ -9,8 +9,9 @@ namespace esphome::api {
|
||||
|
||||
class APINoiseFrameHelper final : public APIFrameHelper {
|
||||
public:
|
||||
APINoiseFrameHelper(std::unique_ptr<socket::Socket> socket, APINoiseContext &ctx, const ClientInfo *client_info)
|
||||
: APIFrameHelper(std::move(socket), client_info), ctx_(ctx) {
|
||||
APINoiseFrameHelper(std::unique_ptr<socket::Socket> socket, std::shared_ptr<APINoiseContext> ctx,
|
||||
const ClientInfo *client_info)
|
||||
: APIFrameHelper(std::move(socket), client_info), ctx_(std::move(ctx)) {
|
||||
// Noise header structure:
|
||||
// Pos 0: indicator (0x01)
|
||||
// Pos 1-2: encrypted payload size (16-bit big-endian)
|
||||
@@ -40,8 +41,8 @@ class APINoiseFrameHelper final : public APIFrameHelper {
|
||||
NoiseCipherState *send_cipher_{nullptr};
|
||||
NoiseCipherState *recv_cipher_{nullptr};
|
||||
|
||||
// Reference to noise context (4 bytes on 32-bit)
|
||||
APINoiseContext &ctx_;
|
||||
// Shared pointer (8 bytes on 32-bit = 4 bytes control block pointer + 4 bytes object pointer)
|
||||
std::shared_ptr<APINoiseContext> ctx_;
|
||||
|
||||
// Vector (12 bytes on 32-bit)
|
||||
std::vector<uint8_t> prologue_;
|
||||
|
||||
@@ -227,8 +227,8 @@ void APIServer::dump_config() {
|
||||
" Max connections: %u",
|
||||
network::get_use_address(), this->port_, this->listen_backlog_, this->max_connections_);
|
||||
#ifdef USE_API_NOISE
|
||||
ESP_LOGCONFIG(TAG, " Noise encryption: %s", YESNO(this->noise_ctx_.has_psk()));
|
||||
if (!this->noise_ctx_.has_psk()) {
|
||||
ESP_LOGCONFIG(TAG, " Noise encryption: %s", YESNO(this->noise_ctx_->has_psk()));
|
||||
if (!this->noise_ctx_->has_psk()) {
|
||||
ESP_LOGCONFIG(TAG, " Supports encryption: YES");
|
||||
}
|
||||
#else
|
||||
@@ -493,7 +493,7 @@ bool APIServer::save_noise_psk(psk_t psk, bool make_active) {
|
||||
ESP_LOGW(TAG, "Key set in YAML");
|
||||
return false;
|
||||
#else
|
||||
auto &old_psk = this->noise_ctx_.get_psk();
|
||||
auto &old_psk = this->noise_ctx_->get_psk();
|
||||
if (std::equal(old_psk.begin(), old_psk.end(), psk.begin())) {
|
||||
ESP_LOGW(TAG, "New PSK matches old");
|
||||
return true;
|
||||
|
||||
@@ -54,8 +54,8 @@ class APIServer : public Component, public Controller {
|
||||
#ifdef USE_API_NOISE
|
||||
bool save_noise_psk(psk_t psk, bool make_active = true);
|
||||
bool clear_noise_psk(bool make_active = true);
|
||||
void set_noise_psk(psk_t psk) { this->noise_ctx_.set_psk(psk); }
|
||||
APINoiseContext &get_noise_ctx() { return this->noise_ctx_; }
|
||||
void set_noise_psk(psk_t psk) { noise_ctx_->set_psk(psk); }
|
||||
std::shared_ptr<APINoiseContext> get_noise_ctx() { return noise_ctx_; }
|
||||
#endif // USE_API_NOISE
|
||||
|
||||
void handle_disconnect(APIConnection *conn);
|
||||
@@ -228,7 +228,7 @@ class APIServer : public Component, public Controller {
|
||||
// 7 bytes used, 1 byte padding
|
||||
|
||||
#ifdef USE_API_NOISE
|
||||
APINoiseContext noise_ctx_;
|
||||
std::shared_ptr<APINoiseContext> noise_ctx_ = std::make_shared<APINoiseContext>();
|
||||
ESPPreferenceObject noise_pref_;
|
||||
#endif // USE_API_NOISE
|
||||
};
|
||||
|
||||
@@ -13,14 +13,16 @@ static const char *const TAG = "captive_portal";
|
||||
void CaptivePortal::handle_config(AsyncWebServerRequest *request) {
|
||||
AsyncResponseStream *stream = request->beginResponseStream(ESPHOME_F("application/json"));
|
||||
stream->addHeader(ESPHOME_F("cache-control"), ESPHOME_F("public, max-age=0, must-revalidate"));
|
||||
char mac_s[18];
|
||||
const char *mac_str = get_mac_address_pretty_into_buffer(mac_s);
|
||||
#ifdef USE_ESP8266
|
||||
stream->print(ESPHOME_F("{\"mac\":\""));
|
||||
stream->print(get_mac_address_pretty().c_str());
|
||||
stream->print(mac_str);
|
||||
stream->print(ESPHOME_F("\",\"name\":\""));
|
||||
stream->print(App.get_name().c_str());
|
||||
stream->print(ESPHOME_F("\",\"aps\":[{}"));
|
||||
#else
|
||||
stream->printf(R"({"mac":"%s","name":"%s","aps":[{})", get_mac_address_pretty().c_str(), App.get_name().c_str());
|
||||
stream->printf(R"({"mac":"%s","name":"%s","aps":[{})", mac_str, App.get_name().c_str());
|
||||
#endif
|
||||
|
||||
for (auto &scan : wifi::global_wifi_component->get_scan_result()) {
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include "esphome/core/component.h"
|
||||
#include "ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
template<typename... Ts> class BluetoothPasswordSetAction : public Action<Ts...> {
|
||||
public:
|
||||
@@ -18,5 +17,4 @@ template<typename... Ts> class BluetoothPasswordSetAction : public Action<Ts...>
|
||||
LD2410Component *ld2410_comp_;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "factory_reset_button.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
void FactoryResetButton::press_action() { this->parent_->factory_reset(); }
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class FactoryResetButton : public button::Button, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class FactoryResetButton : public button::Button, public Parented<LD2410Componen
|
||||
void press_action() override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "query_button.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
void QueryButton::press_action() { this->parent_->read_all_info(); }
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class QueryButton : public button::Button, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class QueryButton : public button::Button, public Parented<LD2410Component> {
|
||||
void press_action() override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "restart_button.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
void RestartButton::press_action() { this->parent_->restart_and_read_all_info(); }
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class RestartButton : public button::Button, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class RestartButton : public button::Button, public Parented<LD2410Component> {
|
||||
void press_action() override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
|
||||
#include "esphome/core/application.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
static const char *const TAG = "ld2410";
|
||||
|
||||
@@ -782,5 +781,4 @@ void LD2410Component::set_gate_still_sensor(uint8_t gate, sensor::Sensor *s) {
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
using namespace ld24xx;
|
||||
|
||||
@@ -133,5 +132,4 @@ class LD2410Component : public Component, public uart::UARTDevice {
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "gate_threshold_number.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
GateThresholdNumber::GateThresholdNumber(uint8_t gate) : gate_(gate) {}
|
||||
|
||||
@@ -10,5 +9,4 @@ void GateThresholdNumber::control(float value) {
|
||||
this->parent_->set_gate_threshold(this->gate_);
|
||||
}
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/number/number.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class GateThresholdNumber : public number::Number, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -15,5 +14,4 @@ class GateThresholdNumber : public number::Number, public Parented<LD2410Compone
|
||||
void control(float value) override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "light_threshold_number.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
void LightThresholdNumber::control(float value) {
|
||||
this->publish_state(value);
|
||||
this->parent_->set_light_out_control();
|
||||
}
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/number/number.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class LightThresholdNumber : public number::Number, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class LightThresholdNumber : public number::Number, public Parented<LD2410Compon
|
||||
void control(float value) override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "max_distance_timeout_number.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
void MaxDistanceTimeoutNumber::control(float value) {
|
||||
this->publish_state(value);
|
||||
this->parent_->set_max_distances_timeout();
|
||||
}
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/number/number.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class MaxDistanceTimeoutNumber : public number::Number, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class MaxDistanceTimeoutNumber : public number::Number, public Parented<LD2410Co
|
||||
void control(float value) override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "baud_rate_select.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
void BaudRateSelect::control(size_t index) {
|
||||
this->publish_state(index);
|
||||
this->parent_->set_baud_rate(this->option_at(index));
|
||||
}
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/select/select.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class BaudRateSelect : public select::Select, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class BaudRateSelect : public select::Select, public Parented<LD2410Component> {
|
||||
void control(size_t index) override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "distance_resolution_select.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
void DistanceResolutionSelect::control(size_t index) {
|
||||
this->publish_state(index);
|
||||
this->parent_->set_distance_resolution(this->option_at(index));
|
||||
}
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/select/select.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class DistanceResolutionSelect : public select::Select, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class DistanceResolutionSelect : public select::Select, public Parented<LD2410Co
|
||||
void control(size_t index) override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "light_out_control_select.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
void LightOutControlSelect::control(size_t index) {
|
||||
this->publish_state(index);
|
||||
this->parent_->set_light_out_control();
|
||||
}
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/select/select.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class LightOutControlSelect : public select::Select, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class LightOutControlSelect : public select::Select, public Parented<LD2410Compo
|
||||
void control(size_t index) override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "bluetooth_switch.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
void BluetoothSwitch::write_state(bool state) {
|
||||
this->publish_state(state);
|
||||
this->parent_->set_bluetooth(state);
|
||||
}
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/switch/switch.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class BluetoothSwitch : public switch_::Switch, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class BluetoothSwitch : public switch_::Switch, public Parented<LD2410Component>
|
||||
void write_state(bool state) override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "engineering_mode_switch.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
void EngineeringModeSwitch::write_state(bool state) {
|
||||
this->publish_state(state);
|
||||
this->parent_->set_engineering_mode(state);
|
||||
}
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/switch/switch.h"
|
||||
#include "../ld2410.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2410 {
|
||||
namespace esphome::ld2410 {
|
||||
|
||||
class EngineeringModeSwitch : public switch_::Switch, public Parented<LD2410Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class EngineeringModeSwitch : public switch_::Switch, public Parented<LD2410Comp
|
||||
void write_state(bool state) override;
|
||||
};
|
||||
|
||||
} // namespace ld2410
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2410
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "factory_reset_button.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void FactoryResetButton::press_action() { this->parent_->factory_reset(); }
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class FactoryResetButton : public button::Button, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class FactoryResetButton : public button::Button, public Parented<LD2412Componen
|
||||
void press_action() override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "query_button.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void QueryButton::press_action() { this->parent_->read_all_info(); }
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class QueryButton : public button::Button, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class QueryButton : public button::Button, public Parented<LD2412Component> {
|
||||
void press_action() override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "restart_button.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void RestartButton::press_action() { this->parent_->restart_and_read_all_info(); }
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class RestartButton : public button::Button, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class RestartButton : public button::Button, public Parented<LD2412Component> {
|
||||
void press_action() override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
#include "restart_button.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void StartDynamicBackgroundCorrectionButton::press_action() { this->parent_->start_dynamic_background_correction(); }
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class StartDynamicBackgroundCorrectionButton : public button::Button, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class StartDynamicBackgroundCorrectionButton : public button::Button, public Par
|
||||
void press_action() override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
#include "esphome/core/application.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
static const char *const TAG = "ld2412";
|
||||
|
||||
@@ -855,5 +854,4 @@ void LD2412Component::set_gate_still_sensor(uint8_t gate, sensor::Sensor *s) {
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
using namespace ld24xx;
|
||||
|
||||
@@ -137,5 +136,4 @@ class LD2412Component : public Component, public uart::UARTDevice {
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "gate_threshold_number.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
GateThresholdNumber::GateThresholdNumber(uint8_t gate) : gate_(gate) {}
|
||||
|
||||
@@ -10,5 +9,4 @@ void GateThresholdNumber::control(float value) {
|
||||
this->parent_->set_gate_threshold();
|
||||
}
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/number/number.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class GateThresholdNumber : public number::Number, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -15,5 +14,4 @@ class GateThresholdNumber : public number::Number, public Parented<LD2412Compone
|
||||
void control(float value) override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "light_threshold_number.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void LightThresholdNumber::control(float value) {
|
||||
this->publish_state(value);
|
||||
this->parent_->set_light_out_control();
|
||||
}
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/number/number.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class LightThresholdNumber : public number::Number, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class LightThresholdNumber : public number::Number, public Parented<LD2412Compon
|
||||
void control(float value) override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "max_distance_timeout_number.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void MaxDistanceTimeoutNumber::control(float value) {
|
||||
this->publish_state(value);
|
||||
this->parent_->set_basic_config();
|
||||
}
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/number/number.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class MaxDistanceTimeoutNumber : public number::Number, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class MaxDistanceTimeoutNumber : public number::Number, public Parented<LD2412Co
|
||||
void control(float value) override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "baud_rate_select.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void BaudRateSelect::control(size_t index) {
|
||||
this->publish_state(index);
|
||||
this->parent_->set_baud_rate(this->option_at(index));
|
||||
}
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/select/select.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class BaudRateSelect : public select::Select, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class BaudRateSelect : public select::Select, public Parented<LD2412Component> {
|
||||
void control(size_t index) override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "distance_resolution_select.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void DistanceResolutionSelect::control(size_t index) {
|
||||
this->publish_state(index);
|
||||
this->parent_->set_distance_resolution(this->option_at(index));
|
||||
}
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/select/select.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class DistanceResolutionSelect : public select::Select, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class DistanceResolutionSelect : public select::Select, public Parented<LD2412Co
|
||||
void control(size_t index) override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "light_out_control_select.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void LightOutControlSelect::control(size_t index) {
|
||||
this->publish_state(index);
|
||||
this->parent_->set_light_out_control();
|
||||
}
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/select/select.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class LightOutControlSelect : public select::Select, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class LightOutControlSelect : public select::Select, public Parented<LD2412Compo
|
||||
void control(size_t index) override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "bluetooth_switch.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void BluetoothSwitch::write_state(bool state) {
|
||||
this->publish_state(state);
|
||||
this->parent_->set_bluetooth(state);
|
||||
}
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/switch/switch.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class BluetoothSwitch : public switch_::Switch, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class BluetoothSwitch : public switch_::Switch, public Parented<LD2412Component>
|
||||
void write_state(bool state) override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "engineering_mode_switch.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
void EngineeringModeSwitch::write_state(bool state) {
|
||||
this->publish_state(state);
|
||||
this->parent_->set_engineering_mode(state);
|
||||
}
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/switch/switch.h"
|
||||
#include "../ld2412.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2412 {
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
class EngineeringModeSwitch : public switch_::Switch, public Parented<LD2412Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class EngineeringModeSwitch : public switch_::Switch, public Parented<LD2412Comp
|
||||
void write_state(bool state) override;
|
||||
};
|
||||
|
||||
} // namespace ld2412
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2412
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
static const char *const TAG = "ld2420.binary_sensor";
|
||||
|
||||
@@ -12,5 +11,4 @@ void LD2420BinarySensor::dump_config() {
|
||||
LOG_BINARY_SENSOR(" ", "Presence", this->presence_bsensor_);
|
||||
}
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "../ld2420.h"
|
||||
#include "esphome/components/binary_sensor/binary_sensor.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
class LD2420BinarySensor : public LD2420Listener, public Component, binary_sensor::BinarySensor {
|
||||
public:
|
||||
@@ -21,5 +20,4 @@ class LD2420BinarySensor : public LD2420Listener, public Component, binary_senso
|
||||
binary_sensor::BinarySensor *presence_bsensor_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
|
||||
static const char *const TAG = "ld2420.button";
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
void LD2420ApplyConfigButton::press_action() { this->parent_->apply_config_action(); }
|
||||
void LD2420RevertConfigButton::press_action() { this->parent_->revert_config_action(); }
|
||||
void LD2420RestartModuleButton::press_action() { this->parent_->restart_module_action(); }
|
||||
void LD2420FactoryResetButton::press_action() { this->parent_->factory_reset_action(); }
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#include "../ld2420.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
class LD2420ApplyConfigButton : public button::Button, public Parented<LD2420Component> {
|
||||
public:
|
||||
@@ -38,5 +37,4 @@ class LD2420FactoryResetButton : public button::Button, public Parented<LD2420Co
|
||||
void press_action() override;
|
||||
};
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -58,8 +58,7 @@ Gate 0 high thresh = 10 00 uint16_t 0x0010, Threshold value = 60 EA 00 00 uint32
|
||||
Gate 0 low thresh = 20 00 uint16_t 0x0020, Threshold value = 60 EA 00 00 uint32_t 0x0000EA60
|
||||
*/
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
static const char *const TAG = "ld2420";
|
||||
|
||||
@@ -880,5 +879,4 @@ void LD2420Component::refresh_gate_config_numbers() {
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#endif
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
static const uint8_t CALIBRATE_SAMPLES = 64;
|
||||
static const uint8_t MAX_LINE_LENGTH = 46; // Max characters for serial buffer
|
||||
@@ -193,5 +192,4 @@ class LD2420Component : public Component, public uart::UARTDevice {
|
||||
std::vector<LD2420Listener *> listeners_{};
|
||||
};
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
static const char *const TAG = "ld2420.number";
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
void LD2420TimeoutNumber::control(float timeout) {
|
||||
this->publish_state(timeout);
|
||||
@@ -69,5 +68,4 @@ void LD2420StillThresholdNumbers::control(float still_threshold) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/number/number.h"
|
||||
#include "../ld2420.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
class LD2420TimeoutNumber : public number::Number, public Parented<LD2420Component> {
|
||||
public:
|
||||
@@ -74,5 +73,4 @@ class LD2420MoveThresholdNumbers : public number::Number, public Parented<LD2420
|
||||
void control(float move_threshold) override;
|
||||
};
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
static const char *const TAG = "ld2420.select";
|
||||
|
||||
@@ -12,5 +11,4 @@ void LD2420Select::control(size_t index) {
|
||||
this->parent_->set_operating_mode(this->option_at(index));
|
||||
}
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "../ld2420.h"
|
||||
#include "esphome/components/select/select.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
class LD2420Select : public Component, public select::Select, public Parented<LD2420Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class LD2420Select : public Component, public select::Select, public Parented<LD
|
||||
void control(size_t index) override;
|
||||
};
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
static const char *const TAG = "ld2420.sensor";
|
||||
|
||||
@@ -12,5 +11,4 @@ void LD2420Sensor::dump_config() {
|
||||
LOG_SENSOR(" ", "Distance", this->distance_sensor_);
|
||||
}
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "../ld2420.h"
|
||||
#include "esphome/components/sensor/sensor.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
class LD2420Sensor : public LD2420Listener, public Component, sensor::Sensor {
|
||||
public:
|
||||
@@ -30,5 +29,4 @@ class LD2420Sensor : public LD2420Listener, public Component, sensor::Sensor {
|
||||
std::vector<sensor::Sensor *> energy_sensors_ = std::vector<sensor::Sensor *>(TOTAL_GATES);
|
||||
};
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
static const char *const TAG = "ld2420.text_sensor";
|
||||
|
||||
@@ -12,5 +11,4 @@ void LD2420TextSensor::dump_config() {
|
||||
LOG_TEXT_SENSOR(" ", "Firmware", this->fw_version_text_sensor_);
|
||||
}
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "../ld2420.h"
|
||||
#include "esphome/components/text_sensor/text_sensor.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2420 {
|
||||
namespace esphome::ld2420 {
|
||||
|
||||
class LD2420TextSensor : public LD2420Listener, public Component, text_sensor::TextSensor {
|
||||
public:
|
||||
@@ -20,5 +19,4 @@ class LD2420TextSensor : public LD2420Listener, public Component, text_sensor::T
|
||||
text_sensor::TextSensor *fw_version_text_sensor_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace ld2420
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2420
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "factory_reset_button.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
void FactoryResetButton::press_action() { this->parent_->factory_reset(); }
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#include "../ld2450.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
class FactoryResetButton : public button::Button, public Parented<LD2450Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class FactoryResetButton : public button::Button, public Parented<LD2450Componen
|
||||
void press_action() override;
|
||||
};
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "restart_button.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
void RestartButton::press_action() { this->parent_->restart_and_read_all_info(); }
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/button/button.h"
|
||||
#include "../ld2450.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
class RestartButton : public button::Button, public Parented<LD2450Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class RestartButton : public button::Button, public Parented<LD2450Component> {
|
||||
void press_action() override;
|
||||
};
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
#include <cmath>
|
||||
#include <numbers>
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
static const char *const TAG = "ld2450";
|
||||
|
||||
@@ -939,5 +938,4 @@ float LD2450Component::restore_from_flash_() {
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
using namespace ld24xx;
|
||||
|
||||
@@ -193,5 +192,4 @@ class LD2450Component : public Component, public uart::UARTDevice {
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "presence_timeout_number.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
void PresenceTimeoutNumber::control(float value) {
|
||||
this->publish_state(value);
|
||||
this->parent_->set_presence_timeout();
|
||||
}
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/number/number.h"
|
||||
#include "../ld2450.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
class PresenceTimeoutNumber : public number::Number, public Parented<LD2450Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class PresenceTimeoutNumber : public number::Number, public Parented<LD2450Compo
|
||||
void control(float value) override;
|
||||
};
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "zone_coordinate_number.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
ZoneCoordinateNumber::ZoneCoordinateNumber(uint8_t zone) : zone_(zone) {}
|
||||
|
||||
@@ -10,5 +9,4 @@ void ZoneCoordinateNumber::control(float value) {
|
||||
this->parent_->set_zone_coordinate(this->zone_);
|
||||
}
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/number/number.h"
|
||||
#include "../ld2450.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
class ZoneCoordinateNumber : public number::Number, public Parented<LD2450Component> {
|
||||
public:
|
||||
@@ -15,5 +14,4 @@ class ZoneCoordinateNumber : public number::Number, public Parented<LD2450Compon
|
||||
void control(float value) override;
|
||||
};
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "baud_rate_select.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
void BaudRateSelect::control(size_t index) {
|
||||
this->publish_state(index);
|
||||
this->parent_->set_baud_rate(this->option_at(index));
|
||||
}
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/select/select.h"
|
||||
#include "../ld2450.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
class BaudRateSelect : public select::Select, public Parented<LD2450Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class BaudRateSelect : public select::Select, public Parented<LD2450Component> {
|
||||
void control(size_t index) override;
|
||||
};
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "zone_type_select.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
void ZoneTypeSelect::control(size_t index) {
|
||||
this->publish_state(index);
|
||||
this->parent_->set_zone_type(this->option_at(index));
|
||||
}
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/select/select.h"
|
||||
#include "../ld2450.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
class ZoneTypeSelect : public select::Select, public Parented<LD2450Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class ZoneTypeSelect : public select::Select, public Parented<LD2450Component> {
|
||||
void control(size_t index) override;
|
||||
};
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "bluetooth_switch.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
void BluetoothSwitch::write_state(bool state) {
|
||||
this->publish_state(state);
|
||||
this->parent_->set_bluetooth(state);
|
||||
}
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/switch/switch.h"
|
||||
#include "../ld2450.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
class BluetoothSwitch : public switch_::Switch, public Parented<LD2450Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class BluetoothSwitch : public switch_::Switch, public Parented<LD2450Component>
|
||||
void write_state(bool state) override;
|
||||
};
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "multi_target_switch.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
void MultiTargetSwitch::write_state(bool state) {
|
||||
this->publish_state(state);
|
||||
this->parent_->set_multi_target(state);
|
||||
}
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/components/switch/switch.h"
|
||||
#include "../ld2450.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ld2450 {
|
||||
namespace esphome::ld2450 {
|
||||
|
||||
class MultiTargetSwitch : public switch_::Switch, public Parented<LD2450Component> {
|
||||
public:
|
||||
@@ -14,5 +13,4 @@ class MultiTargetSwitch : public switch_::Switch, public Parented<LD2450Componen
|
||||
void write_state(bool state) override;
|
||||
};
|
||||
|
||||
} // namespace ld2450
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld2450
|
||||
|
||||
@@ -37,8 +37,7 @@
|
||||
#define highbyte(val) (uint8_t)((val) >> 8)
|
||||
#define lowbyte(val) (uint8_t)((val) &0xff)
|
||||
|
||||
namespace esphome {
|
||||
namespace ld24xx {
|
||||
namespace esphome::ld24xx {
|
||||
|
||||
static const char *const UNKNOWN_MAC = "unknown";
|
||||
static const char *const VERSION_FMT = "%u.%02X.%02X%02X%02X%02X";
|
||||
@@ -83,5 +82,4 @@ template<typename T> class SensorWithDedup {
|
||||
Deduplicator<T> publish_dedup;
|
||||
};
|
||||
#endif
|
||||
} // namespace ld24xx
|
||||
} // namespace esphome
|
||||
} // namespace esphome::ld24xx
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#include "addressable_light.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
namespace esphome::light {
|
||||
|
||||
static const char *const TAG = "light.addressable";
|
||||
|
||||
@@ -112,5 +111,4 @@ optional<LightColorValues> AddressableLightTransformer::apply() {
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace light
|
||||
} // namespace esphome
|
||||
} // namespace esphome::light
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
#include "esphome/components/power_supply/power_supply.h"
|
||||
#endif
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
namespace esphome::light {
|
||||
|
||||
/// Convert the color information from a `LightColorValues` object to a `Color` object (does not apply brightness).
|
||||
Color color_from_light_color_values(LightColorValues val);
|
||||
@@ -116,5 +115,4 @@ class AddressableLightTransformer : public LightTransformer {
|
||||
Color target_color_{};
|
||||
};
|
||||
|
||||
} // namespace light
|
||||
} // namespace esphome
|
||||
} // namespace esphome::light
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
#include "esphome/components/light/light_state.h"
|
||||
#include "esphome/components/light/addressable_light.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
namespace esphome::light {
|
||||
|
||||
inline static int16_t sin16_c(uint16_t theta) {
|
||||
static const uint16_t BASE[] = {0, 6393, 12539, 18204, 23170, 27245, 30273, 32137};
|
||||
@@ -371,5 +370,4 @@ class AddressableFlickerEffect : public AddressableLightEffect {
|
||||
uint8_t intensity_{13};
|
||||
};
|
||||
|
||||
} // namespace light
|
||||
} // namespace esphome
|
||||
} // namespace esphome::light
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "esphome/core/component.h"
|
||||
#include "addressable_light.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
namespace esphome::light {
|
||||
|
||||
class AddressableLightWrapper : public light::AddressableLight {
|
||||
public:
|
||||
@@ -123,5 +122,4 @@ class AddressableLightWrapper : public light::AddressableLight {
|
||||
ColorMode color_mode_{ColorMode::UNKNOWN};
|
||||
};
|
||||
|
||||
} // namespace light
|
||||
} // namespace esphome
|
||||
} // namespace esphome::light
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#include "automation.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
namespace esphome::light {
|
||||
|
||||
static const char *const TAG = "light.automation";
|
||||
|
||||
@@ -11,5 +10,4 @@ void addressableset_warn_about_scale(const char *field) {
|
||||
field);
|
||||
}
|
||||
|
||||
} // namespace light
|
||||
} // namespace esphome
|
||||
} // namespace esphome::light
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include "light_state.h"
|
||||
#include "addressable_light.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
namespace esphome::light {
|
||||
|
||||
enum class LimitMode { CLAMP, DO_NOTHING };
|
||||
|
||||
@@ -216,5 +215,4 @@ template<typename... Ts> class AddressableSet : public Action<Ts...> {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace light
|
||||
} // namespace esphome
|
||||
} // namespace esphome::light
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "light_effect.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
namespace esphome::light {
|
||||
|
||||
inline static float random_cubic_float() {
|
||||
const float r = random_float() * 2.0f - 1.0f;
|
||||
@@ -235,5 +234,4 @@ class FlickerLightEffect : public LightEffect {
|
||||
float alpha_{};
|
||||
};
|
||||
|
||||
} // namespace light
|
||||
} // namespace esphome
|
||||
} // namespace esphome::light
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include <cstdint>
|
||||
#include "esphome/core/finite_set_mask.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
namespace esphome::light {
|
||||
|
||||
/// Color capabilities are the various outputs that a light has and that can be independently controlled by the user.
|
||||
enum class ColorCapability : uint8_t {
|
||||
@@ -210,5 +209,4 @@ inline bool has_capability(const ColorModeMask &mask, ColorCapability capability
|
||||
return (mask.get_mask() & CAPABILITY_BITMASKS[capability_to_index(capability)]) != 0;
|
||||
}
|
||||
|
||||
} // namespace light
|
||||
} // namespace esphome
|
||||
} // namespace esphome::light
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "light_color_values.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
namespace esphome::light {
|
||||
|
||||
void ESPColorCorrection::calculate_gamma_table(float gamma) {
|
||||
for (uint16_t i = 0; i < 256; i++) {
|
||||
@@ -23,5 +22,4 @@ void ESPColorCorrection::calculate_gamma_table(float gamma) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace light
|
||||
} // namespace esphome
|
||||
} // namespace esphome::light
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
#include "esphome/core/color.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
namespace esphome::light {
|
||||
|
||||
class ESPColorCorrection {
|
||||
public:
|
||||
@@ -73,5 +72,4 @@ class ESPColorCorrection {
|
||||
uint8_t local_brightness_{255};
|
||||
};
|
||||
|
||||
} // namespace light
|
||||
} // namespace esphome
|
||||
} // namespace esphome::light
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user