gysmo38 / domoticz-python-melcloud

A plugin in python for Domoticz
12 stars 15 forks source link

Error 401 #2

Open mitkodotcom opened 5 years ago

mitkodotcom commented 5 years ago

Sometimes (possibly when the IP address changes when Domoticz is still runing), the cloud rejects any further messages with HTTP code 401 (Unauthorized). Note that this is a different response than the one in the LOGIN sequence. I suppose melcloud locks the key to the IP address and thus invalidates the key if it is used by another IP address. This could be a problem for users with dynamic IP addresses or (as in my case) dual-homed with more than one internet connection.

Note that the key gets invalidated and doesn't work anymore, even if the IP address is returned back to the previous one.

Suggestion:

add elif (Status == 401): and a proper handling of this situation (may be the same as on disconnect)