Merge pull request #88 from Patrick762/pack-polling
Check pack_num only once
This commit is contained in:
1 file changed
+4
@@ -110,6 +110,8 @@ class DeviceReader:
|
||||
# We need to wait after switching packs for the data to be available
|
||||
await asyncio.sleep(5)
|
||||
|
||||
pack_ok = False
|
||||
|
||||
for command in pack_commands:
|
||||
# Request & parse result for each pack
|
||||
try:
|
||||
@@ -121,6 +123,7 @@ class DeviceReader:
|
||||
)
|
||||
_LOGGER.debug("Parsed data: %s", parsed)
|
||||
|
||||
if not pack_ok: # Only check this once
|
||||
pack_number = parsed.get("pack_num")
|
||||
if (
|
||||
not isinstance(pack_number, int)
|
||||
@@ -132,6 +135,7 @@ class DeviceReader:
|
||||
pack,
|
||||
)
|
||||
continue
|
||||
pack_ok = True
|
||||
|
||||
for key, value in parsed.items():
|
||||
parsed_data.update({key + str(pack): value})
|
||||
|
||||
Reference in new issue
Block a user