Fix linting

This commit is contained in:
Rapsssito 2024-08-19 17:30:37 +02:00
parent 93f30a0798
commit 6bc1b0b5a8
2 changed files with 8 additions and 4 deletions

View File

@ -104,7 +104,9 @@ def validate_notify_action(action_char_id):
CORE.data[_KEY_NOTIFY_REQUIRED] = set()
CORE.data[_KEY_NOTIFY_REQUIRED].add(action_char_id)
# 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:
raise cv.Invalid(
"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,
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
),
}
),
)

View File

@ -47,7 +47,7 @@ void BLEServer::loop() {
for (unsigned i = 0; i < this->services_to_start_.size(); i++) {
BLEService *service = this->services_to_start_[i];
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 {
index_to_remove = i + 1;
}
@ -126,7 +126,7 @@ bool BLEServer::create_device_characteristics_() {
BLECharacteristic *manufacturer =
this->device_information_service_->create_characteristic(MANUFACTURER_UUID, BLECharacteristic::PROPERTY_READ);
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;
}