mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 12:46:22 +01:00
Fix linting
This commit is contained in:
parent
93f30a0798
commit
6bc1b0b5a8
@ -104,7 +104,9 @@ def validate_notify_action(action_char_id):
|
|||||||
CORE.data[_KEY_NOTIFY_REQUIRED] = set()
|
CORE.data[_KEY_NOTIFY_REQUIRED] = set()
|
||||||
CORE.data[_KEY_NOTIFY_REQUIRED].add(action_char_id)
|
CORE.data[_KEY_NOTIFY_REQUIRED].add(action_char_id)
|
||||||
# Check if the NOTIFY property is set for the characteristic
|
# Check if the NOTIFY property is set for the characteristic
|
||||||
char_notify_value = CORE.data.get(_KEY_NOTIFY_PROVIDED, {}).get(action_char_id, None)
|
char_notify_value = CORE.data.get(_KEY_NOTIFY_PROVIDED, {}).get(
|
||||||
|
action_char_id, None
|
||||||
|
)
|
||||||
if char_notify_value is not None and not char_notify_value:
|
if char_notify_value is not None and not char_notify_value:
|
||||||
raise cv.Invalid(
|
raise cv.Invalid(
|
||||||
"Missing NOTIFY property for characteristic with notify action"
|
"Missing NOTIFY property for characteristic with notify action"
|
||||||
@ -364,7 +366,9 @@ async def ble_server_characteristic_set_value(config, action_id, template_arg, a
|
|||||||
BLECharacteristicNotifyAction,
|
BLECharacteristicNotifyAction,
|
||||||
cv.Schema(
|
cv.Schema(
|
||||||
{
|
{
|
||||||
cv.Required(CONF_ID): cv.All(cv.use_id(BLECharacteristic), validate_notify_action),
|
cv.Required(CONF_ID): cv.All(
|
||||||
|
cv.use_id(BLECharacteristic), validate_notify_action
|
||||||
|
),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -47,7 +47,7 @@ void BLEServer::loop() {
|
|||||||
for (unsigned i = 0; i < this->services_to_start_.size(); i++) {
|
for (unsigned i = 0; i < this->services_to_start_.size(); i++) {
|
||||||
BLEService *service = this->services_to_start_[i];
|
BLEService *service = this->services_to_start_[i];
|
||||||
if (service->is_created()) {
|
if (service->is_created()) {
|
||||||
service->start(); // Needs to be called once per characteristic in the service
|
service->start(); // Needs to be called once per characteristic in the service
|
||||||
} else {
|
} else {
|
||||||
index_to_remove = i + 1;
|
index_to_remove = i + 1;
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ bool BLEServer::create_device_characteristics_() {
|
|||||||
BLECharacteristic *manufacturer =
|
BLECharacteristic *manufacturer =
|
||||||
this->device_information_service_->create_characteristic(MANUFACTURER_UUID, BLECharacteristic::PROPERTY_READ);
|
this->device_information_service_->create_characteristic(MANUFACTURER_UUID, BLECharacteristic::PROPERTY_READ);
|
||||||
manufacturer->set_value(
|
manufacturer->set_value(
|
||||||
ByteBuffer::wrap(std::vector<uint8_t>(this->manufacturer_.begin(), this->manufacturer_.end())));
|
ByteBuffer::wrap(std::vector<uint8_t>(this->manufacturer_.begin(), this->manufacturer_.end())));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user