Skip to content

Commit e32076e

Browse files
committed
The device storage is full when trying to learn new codes eschava#80
1 parent ac4fab3 commit e32076e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mqtt.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,12 @@ def record(device, file):
255255
ir_packet = None
256256
attempt = 0
257257
while ir_packet is None and attempt < 6:
258-
time.sleep(5)
259-
ir_packet = device.check_data()
260258
attempt = attempt + 1
259+
time.sleep(5)
260+
try:
261+
ir_packet = device.check_data()
262+
except (broadlink.exceptions.ReadError, broadlink.exceptions.StorageError):
263+
continue
261264
if ir_packet is not None:
262265
# write to file
263266
directory = os.path.dirname(file)
@@ -267,7 +270,7 @@ def record(device, file):
267270
f.write(binascii.hexlify(ir_packet))
268271
logging.debug("Done")
269272
else:
270-
logging.warn("No command received")
273+
logging.warning("No command received")
271274

272275

273276
def record_rf(device, file):

0 commit comments

Comments
 (0)