mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Fix a yaml and C++ linting problems
This commit is contained in:
parent
6674c5d5d4
commit
e18e3fbf5f
2 changed files with 5 additions and 7 deletions
|
@ -9,17 +9,17 @@ namespace esphome {
|
|||
namespace ble_presence {
|
||||
|
||||
static const char *const TAG = "ble_presence";
|
||||
static const int min_rssi = -100;
|
||||
static const int max_rssi = -30;
|
||||
static const int MIN_RSSI = -100;
|
||||
static const int MAX_RSSI = -30;
|
||||
|
||||
void BLEPresenceDevice::dump_config() { LOG_BINARY_SENSOR("", "BLE Presence", this); }
|
||||
|
||||
void BLEPresenceDevice::set_minimum_rssi_input(number::Number *min_rssi_number) {
|
||||
min_rssi_number->add_on_state_callback([this](float state) {
|
||||
int rssi = int(state);
|
||||
if (rssi < min_rssi || rssi > max_rssi) {
|
||||
ESP_LOGW(TAG, "Valid RSSI range is %ddB to %ddB", min_rssi, max_rssi);
|
||||
rssi = std::min(std::max(rssi, min_rssi), max_rssi);
|
||||
if (rssi < MIN_RSSI || rssi > MAX_RSSI) {
|
||||
ESP_LOGW(TAG, "Valid RSSI range is %ddB to %ddB", MIN_RSSI, MAX_RSSI);
|
||||
rssi = std::min(std::max(rssi, MIN_RSSI), MAX_RSSI);
|
||||
}
|
||||
ESP_LOGI(TAG, "Setting minimum rssi to %ddB", rssi);
|
||||
this->set_minimum_rssi_(int(state));
|
||||
|
|
|
@ -38,5 +38,3 @@ binary_sensor:
|
|||
service_uuid: 11223344-5566-7788-99aa-bbccddeeff00
|
||||
name: BLE Test Service Min RSSI
|
||||
min_rssi_number_id: min_rssi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue