mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 07:58:09 +01:00
Remove num handles from configuration
This commit is contained in:
parent
c1ad28368d
commit
e5ba6910de
1 changed files with 2 additions and 6 deletions
|
@ -20,7 +20,6 @@ DEPENDENCIES = ["esp32"]
|
||||||
CONF_MANUFACTURER = "manufacturer"
|
CONF_MANUFACTURER = "manufacturer"
|
||||||
CONF_MANUFACTURER_DATA = "manufacturer_data"
|
CONF_MANUFACTURER_DATA = "manufacturer_data"
|
||||||
CONF_ADVERTISE = "advertise"
|
CONF_ADVERTISE = "advertise"
|
||||||
CONF_NUM_HANDLES = "num_handles"
|
|
||||||
CONF_ON_WRITE = "on_write"
|
CONF_ON_WRITE = "on_write"
|
||||||
CONF_CHARACTERISTICS = "characteristics"
|
CONF_CHARACTERISTICS = "characteristics"
|
||||||
CONF_READ = "read"
|
CONF_READ = "read"
|
||||||
|
@ -168,7 +167,6 @@ SERVICE_SCHEMA = cv.Schema(
|
||||||
cv.GenerateID(): cv.declare_id(BLEService),
|
cv.GenerateID(): cv.declare_id(BLEService),
|
||||||
cv.Required(CONF_UUID): UUID_SCHEMA,
|
cv.Required(CONF_UUID): UUID_SCHEMA,
|
||||||
cv.Optional(CONF_ADVERTISE, default=False): cv.boolean,
|
cv.Optional(CONF_ADVERTISE, default=False): cv.boolean,
|
||||||
cv.Optional(CONF_NUM_HANDLES, default=0): cv.int_,
|
|
||||||
cv.Optional(CONF_CHARACTERISTICS, default=[]): cv.ensure_list(
|
cv.Optional(CONF_CHARACTERISTICS, default=[]): cv.ensure_list(
|
||||||
SERVICE_CHARACTERISTIC_SCHEMA
|
SERVICE_CHARACTERISTIC_SCHEMA
|
||||||
),
|
),
|
||||||
|
@ -285,10 +283,8 @@ async def to_code(config):
|
||||||
if CONF_MODEL in config:
|
if CONF_MODEL in config:
|
||||||
cg.add(var.set_model(config[CONF_MODEL]))
|
cg.add(var.set_model(config[CONF_MODEL]))
|
||||||
for service_config in config[CONF_SERVICES]:
|
for service_config in config[CONF_SERVICES]:
|
||||||
num_handles = service_config[CONF_NUM_HANDLES]
|
# Calculate the optimal number of handles based on the number of characteristics and descriptors
|
||||||
# If num_handles is 0, calculate the optimal number of handles based on the number of characteristics and descriptors
|
num_handles = calculate_num_handles(service_config)
|
||||||
if num_handles == 0:
|
|
||||||
num_handles = calculate_num_handles(service_config)
|
|
||||||
service_var = cg.Pvariable(
|
service_var = cg.Pvariable(
|
||||||
service_config[CONF_ID],
|
service_config[CONF_ID],
|
||||||
var.create_service(
|
var.create_service(
|
||||||
|
|
Loading…
Reference in a new issue