added check if packs available
This commit is contained in:
1 parent
7904a07e7f
commit
33fe91c2d2
2 files changed
+4
-2
No files matched your search
@@ -182,7 +182,7 @@ class PollingCoordinator(DataUpdateCoordinator):
|
|||||||
|
|
||||||
async with self.polling_lock:
|
async with self.polling_lock:
|
||||||
try:
|
try:
|
||||||
async with async_timeout.timeout(30):
|
async with async_timeout.timeout(45):
|
||||||
|
|
||||||
# Reconnect if not connected
|
# Reconnect if not connected
|
||||||
max_retries = 5
|
max_retries = 5
|
||||||
|
|||||||
@@ -60,11 +60,13 @@ async def async_setup_entry(
|
|||||||
all_fields = NORMAL_DEVICE_FIELDS
|
all_fields = NORMAL_DEVICE_FIELDS
|
||||||
all_fields.update(DC_INPUT_FIELDS)
|
all_fields.update(DC_INPUT_FIELDS)
|
||||||
all_fields.update(ADDITIONAL_DEVICE_FIELDS)
|
all_fields.update(ADDITIONAL_DEVICE_FIELDS)
|
||||||
|
|
||||||
|
if len(bluetti_device.pack_polling_commands) > 0:
|
||||||
# add pack fields for device
|
# add pack fields for device
|
||||||
_LOGGER.info("Device type(%s) pack_num_max(%s)", bluetti_device.type, bluetti_device.pack_num_max)
|
_LOGGER.info("Device type(%s) pack_num_max(%s)", bluetti_device.type, bluetti_device.pack_num_max)
|
||||||
for pack in range (1, bluetti_device.pack_num_max + 1):
|
for pack in range (1, bluetti_device.pack_num_max + 1):
|
||||||
for name, field in battery_pack_fields(pack).items():
|
for name, field in battery_pack_fields(pack).items():
|
||||||
all_fields.update({name+str(pack):field})
|
all_fields.update({name+str(pack): field})
|
||||||
|
|
||||||
for field_key, field_config in all_fields.items():
|
for field_key, field_config in all_fields.items():
|
||||||
if bluetti_device.has_field(field_key) or field_config.id_override is not None:
|
if bluetti_device.has_field(field_key) or field_config.id_override is not None:
|
||||||
|
|||||||
Reference in new issue
Block a user