@@ -4280,6 +4280,8 @@ def on_message(client, userdata, msg):
4280
4280
base64_data = ""
4281
4281
rcv_id = 0
4282
4282
4283
+ if ARGS .debug :
4284
+ print ("{}: on_message - payload {}" .format (datetime .now ().strftime ("%Y-%m-%d %H:%M:%S.%f" ), msg .payload .decode (STR_CODING )))
4283
4285
try :
4284
4286
root = json .loads (msg .payload .decode (STR_CODING ))
4285
4287
if root :
@@ -4325,6 +4327,9 @@ def on_message(client, userdata, msg):
4325
4327
except :
4326
4328
pass
4327
4329
4330
+ if ARGS .debug :
4331
+ print ("{}: on_message - use_base64={}, file_id={}, rcv_id={}, file_type={}, file_size={}, file_md5={}, in_hash_md5={}" .format (datetime .now ().strftime ("%Y-%m-%d %H:%M:%S.%f" ), use_base64 , file_id , rcv_id , file_type , file_size , file_md5 , in_hash_md5 .hexdigest ()))
4332
+
4328
4333
if dobj is None and file_id == 0 and rcv_id > 0 and file_size > 0 and file_type > 0 and file_name :
4329
4334
file_id = rcv_id
4330
4335
dobj = bytearray ()
@@ -4422,19 +4427,27 @@ def wait_for_connect():
4422
4427
in_hash_md5 = hashlib .md5 ()
4423
4428
4424
4429
data = {"Password" :tasmota_mqtt_password , "Type" :MQTT_FILETYPE }
4430
+ if ARGS .debug :
4431
+ data_dbg = {"Password" :HIDDEN_PASSWORD , "Type" :MQTT_FILETYPE }
4425
4432
if not use_base64 :
4426
4433
data ["Binary" ] = 1
4427
4434
client .publish (topic_publish , json .dumps (data ))
4435
+ if ARGS .debug :
4436
+ print ("{}: client.publish({}, {})" .format (datetime .now ().strftime ("%Y-%m-%d %H:%M:%S.%f" ), topic_publish , json .dumps (data_dbg )))
4428
4437
4429
4438
ack_flag = True
4430
4439
run_flag = True
4431
4440
while run_flag :
4432
4441
if wait_for_ack (): # We use Ack here
4433
4442
client .publish (topic_publish , "0" ) # Abort any failed download
4443
+ if ARGS .debug :
4444
+ print ('{}: client.publish({}, "0")' .format (datetime .now ().strftime ("%Y-%m-%d %H:%M:%S.%f" ), topic_publish ))
4434
4445
run_flag = False
4435
4446
else :
4436
4447
if file_md5 == "" : # Request chunk
4437
4448
client .publish (topic_publish , "?" )
4449
+ if ARGS .debug :
4450
+ print ('{}: client.publish({}, "?")' .format (datetime .now ().strftime ("%Y-%m-%d %H:%M:%S.%f" ), topic_publish ))
4438
4451
ack_flag = True
4439
4452
else :
4440
4453
run_flag = False
0 commit comments