www-ShapeLabs-de / Judo-i-soft-save-plus-to-mqtt-bridge

A small device to write and read settings to Judo i-soft safe+ water softening system with homeassistant
MIT License
20 stars 6 forks source link

MaxRetryError #6

Closed danielegger1 closed 1 year ago

danielegger1 commented 1 year ago

Hi

I receive after some hours a MaxRetryError, which would be good if it is handled to automatically continue the loop:

['Error on line 302', '\n', MaxRetryError("HTTPSConnectionPool(host='myjudo.eu', port=443): Max retries exceeded with url: /interface/?token=" "&group=register&command=get%20error%20messages (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7fa83e0760>, 'Connection to myjudo.eu timed out. (connect timeout=<object object at 0x7faa760810>)'))")]

I guess my internet connection has sometimes issues, and if the request is at that moment it raises an exception. As I am running on AppDaemon in HomeAssistant directly this "ends" my scripts and will not restart it, I think in another environment this was considered to be handled with this idea: "#wait 30sec for script auto restart initiated by systemd:"

I think this could be resolved with adding another loop for the whole try / except, as after the exception it will run another loop, the only problem here is, I changed also the time to 5 Minutes for such behaviour, as otherwise it will rerun the loop after 30 seconds. I need to check how I can send a message to MQTT in such case, as this will be important if it can´t reconnect for several tries

while True: # new added, everything below needs to be shifted ones to the right try:

----- MAIN PROGRAM ----

I believe I should implement an exception counter and post that value to MQTT as well

www-ShapeLabs-de commented 1 year ago

Hey I also noticed a similar behavior, which led me to optimize the error handling with exceptions. I had the same idea as you, to publish the error messages coming from the script via mqtt. I will comit the new version for this shortly. Through this feature some more errors in parsing the data became obvious, which I want to have fixed in the next commit right away. There seem to be a lot of incomplete data packets coming in at "get device data".

I think that in 2-3 days the new version will be ready, which will run much more stable then...

BR Henning

P.S. but i can send you the current status by mail, if you like.

danielegger1 commented 1 year ago

Great :) It‘s very good to have common experience with your code, your code is great. I learned a lot from your code about Python, which helped me when I created a Webinterface Scrape function for my Bayrol Pool Salt System :) If you want you can sent me the code, I can help you at testing, I am also very interested in what changes you did, my username is my mail (@gmail.com) In AppDaemon there are some special differences, the most funny thing is one sentence in the manual „NEVER use time.sleep functionality :D that will be a hard one

www-ShapeLabs-de commented 1 year ago

The Bug is fixed in the actual commit..