Open schurgan opened 11 months ago
Hello,
I noticed the same things! First day or after reboot, the heartbeat is ok : 1 hit every 25s. But the next day, we have 3/4 hits every 25 seconds... And each day that passes increases this phenomenon...
Today, I tried to solve this problem with a rewrite of the heartbeat management. I implemented a parameter to choose the interval.
I also implemented multilingual support with the MELCloud app. My script is based on Nonolk version #27 (https://github.com/gysmo38/domoticz-python-melcloud/issues/27#issuecomment-1046245133) Thanks to him for correcting error code 500 ;)
Save your version and try mine ;)
Now I have to wait a week to be sure this problem is resolved. (you can also uncheck the log info level in the hardware settings to have less log information)
Have fun ;) plugin.py.zip
Dalonsic.
I get the following errors:
No idea why...
2023-11-05 21:10:44.828 Error: MelCloud: Call to function 'onMessage' failed, exception details: 2023-11-05 21:10:44.829 Error: MelCloud: Traceback (most recent call last): 2023-11-05 21:10:44.829 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 639, in onMessage 2023-11-05 21:10:44.829 Error: MelCloud: _plugin.onMessage(Connection, Data) 2023-11-05 21:10:44.829 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 312, in onMessage 2023-11-05 21:10:44.829 Error: MelCloud: self.domoticz_sync_switchs(unit) 2023-11-05 21:10:44.829 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 587, in domoticz_sync_switchs 2023-11-05 21:10:44.829 Error: MelCloud: Devices[self.list_switchs[0]["id"]+unit["idoffset"]].Update(nValue=switch_value, 2023-11-05 21:10:44.829 Error: MelCloud: KeyError: 29 2023-11-05 21:10:44.829 Error: MelCloud: Call to function 'onMessage' failed, exception details: 2023-11-05 21:10:44.829 Error: MelCloud: Traceback (most recent call last): 2023-11-05 21:10:44.829 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 639, in onMessage 2023-11-05 21:10:44.829 Error: MelCloud: _plugin.onMessage(Connection, Data) 2023-11-05 21:10:44.829 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 312, in onMessage 2023-11-05 21:10:44.829 Error: MelCloud: self.domoticz_sync_switchs(unit) 2023-11-05 21:10:44.829 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 587, in domoticz_sync_switchs 2023-11-05 21:10:44.829 Error: MelCloud: Devices[self.list_switchs[0]["id"]+unit["idoffset"]].Update(nValue=switch_value, 2023-11-05 21:10:44.829 Error: MelCloud: KeyError: 29 2023-11-05 21:10:44.830 Error: MelCloud: Call to function 'onMessage' failed, exception details: 2023-11-05 21:10:44.830 Error: MelCloud: Traceback (most recent call last): 2023-11-05 21:10:44.830 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 639, in onMessage 2023-11-05 21:10:44.830 Error: MelCloud: _plugin.onMessage(Connection, Data) 2023-11-05 21:10:44.830 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 312, in onMessage 2023-11-05 21:10:44.830 Error: MelCloud: self.domoticz_sync_switchs(unit) 2023-11-05 21:10:44.830 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 587, in domoticz_sync_switchs 2023-11-05 21:10:44.830 Error: MelCloud: Devices[self.list_switchs[0]["id"]+unit["idoffset"]].Update(nValue=switch_value, 2023-11-05 21:10:44.830 Error: MelCloud: KeyError: 43 2023-11-05 21:10:44.830 Error: MelCloud: Call to function 'onMessage' failed, exception details: 2023-11-05 21:10:44.831 Error: MelCloud: Traceback (most recent call last): 2023-11-05 21:10:44.831 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 639, in onMessage 2023-11-05 21:10:44.831 Error: MelCloud: _plugin.onMessage(Connection, Data) 2023-11-05 21:10:44.831 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 312, in onMessage 2023-11-05 21:10:44.831 Error: MelCloud: self.domoticz_sync_switchs(unit) 2023-11-05 21:10:44.831 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 587, in domoticz_sync_switchs 2023-11-05 21:10:44.831 Error: MelCloud: Devices[self.list_switchs[0]["id"]+unit["idoffset"]].Update(nValue=switch_value, 2023-11-05 21:10:44.831 Error: MelCloud: KeyError: 43
you can try to change line 162 :
actual
domoticz_levels["mode_pic"] = {"0": 9, "10": 15, "20": 16, "30": 7, "40": 11, "50": 11}
to
domoticz_levels["mode_pic"] = {"0": 9, "10": 15, "20": 16, "30": 7, "40": 11}
I try to add a key,value like in #35... maybe it was not a good idea :) EDIT : and can you send your original plugin.py ? I started my script with the #27 version, if you have another version, it can be incompatible EDIT2 : after installing my version, you need to choose values for the 2 new parameters (language and refresh interval) in hardware settings and update
/!\ EDIT3 : today I list 4 deconnexion/reconnexion to MELCloud in log and I have 4 hits every 2min... I think the script dont reset unit lists and every reconnexion to MELCLoud, add clones to units list... I will try to fix this...
I add logs in my local script to check if self.list_units increase after a deconnection/reconnection to MELCloud... If It is right, the fix will be to clear self.list_units.clear() before a reconnection...
...
if (self.melcloud_conn is None or self.melcloud_state == "LOGIN_FAILED" or self.melcloud_state == "Not Ready"):
self.runAgain = self.runAgain - 1
if self.runAgain <= 0:
Domoticz.Status("[MELCloud][onHeartbeat] Reconnection... ("+str(self.melcloud_state)+")")
self.list_units.clear() # FIXME ADD THIS LINE TO FIX THE BUG ?
self.melcloud_conn = Domoticz.Connection(Name="MELCloud", Transport="TCP/IP", Protocol="HTTPS",
Address=self.melcloud_baseurl, Port=self.melcloud_port)
self.melcloud_key = None
self.melcloud_conn.Connect()
self.runAgain = 10
self.runCounter = 0
else:
Domoticz.Debug("MELCloud https failed. Reconnected in "+str(self.runAgain)+" heartbeats.")
...
Tests in progress... EDIT : ok after deconnection/reconnection to MELCloud, self.list_units increase with clone, I have a good log ! time to try the fix... ;)
Hello, thank you for your work. Could you provide me your current plugin.py?
My current plugin.py 0.8.1... But tests are not finish ! I need to wait multiple deconnection/reconnection to MELCloud to be sure π
I still have the same error. I have no idea what I'm doing wrong.
2023-11-07 19:27:54.448 Error: MelCloud: self.domoticz_sync_switchs(unit) 2023-11-07 19:27:54.448 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 586, in domoticz_sync_switchs 2023-11-07 19:27:54.448 Error: MelCloud: Devices[self.list_switchs[0]["id"]+unit["idoffset"]].Update(nValue=switch_value, 2023-11-07 19:27:54.448 Error: MelCloud: KeyError: 29 2023-11-07 19:27:54.448 Error: MelCloud: Call to function 'onMessage' failed, exception details: 2023-11-07 19:27:54.449 Error: MelCloud: Traceback (most recent call last): 2023-11-07 19:27:54.449 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 638, in onMessage 2023-11-07 19:27:54.449 Error: MelCloud: _plugin.onMessage(Connection, Data) 2023-11-07 19:27:54.449 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 311, in onMessage 2023-11-07 19:27:54.449 Error: MelCloud: self.domoticz_sync_switchs(unit) 2023-11-07 19:27:54.449 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 586, in domoticz_sync_switchs 2023-11-07 19:27:54.449 Error: MelCloud: Devices[self.list_switchs[0]["id"]+unit["idoffset"]].Update(nValue=switch_value, 2023-11-07 19:27:54.449 Error: MelCloud: KeyError: 29 2023-11-07 19:27:54.449 Error: MelCloud: Call to function 'onMessage' failed, exception details: 2023-11-07 19:27:54.449 Error: MelCloud: Traceback (most recent call last): 2023-11-07 19:27:54.449 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 638, in onMessage 2023-11-07 19:27:54.449 Error: MelCloud: _plugin.onMessage(Connection, Data) 2023-11-07 19:27:54.449 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 311, in onMessage 2023-11-07 19:27:54.449 Error: MelCloud: self.domoticz_sync_switchs(unit) 2023-11-07 19:27:54.449 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 586, in domoticz_sync_switchs 2023-11-07 19:27:54.449 Error: MelCloud: Devices[self.list_switchs[0]["id"]+unit["idoffset"]].Update(nValue=switch_value, 2023-11-07 19:27:54.449 Error: MelCloud: KeyError: 43 2023-11-07 19:27:54.450 Error: MelCloud: Call to function 'onMessage' failed, exception details: 2023-11-07 19:27:54.450 Error: MelCloud: Traceback (most recent call last): 2023-11-07 19:27:54.450 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 638, in onMessage 2023-11-07 19:27:54.450 Error: MelCloud: _plugin.onMessage(Connection, Data) 2023-11-07 19:27:54.450 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 311, in onMessage 2023-11-07 19:27:54.450 Error: MelCloud: self.domoticz_sync_switchs(unit) 2023-11-07 19:27:54.450 Error: MelCloud: File "/home/pi/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 586, in domoticz_sync_switchs 2023-11-07 19:27:54.450 Error: MelCloud: Devices[self.list_switchs[0]["id"]+unit["idoffset"]].Update(nValue=switch_value, 2023-11-07 19:27:54.450 Error: MelCloud: KeyError: 43
can you send me your original plugin.py ? I can fix the duplicate logs in your version
And it works somewhat. Except that after a day the whole system starts to hang, especially MQTT
Ok, with your version, I maybe found the difference π
2 versions : And dont forget... my tests are in progress... not finished ! π
EDIT : after few fixes... v0.8.2 based on Nonolk version : plugin.py.0.8.2.zip
EDIT : and v0.8.3 based on Mitkodotcom version : plugin.py.0.8.3.zip
Dalonsic.
I still have the error...
with both version ? the forShurganOnly version only contains 1 more line to fix duplicate logs π€
No, with your version. I have started my corrected version and now have to watch whether the logs are duplicated. Thank you first...
Ah ok π Now, we wait for disconnection/reconnection to MELCloud... π
So so far everything is going very well, no duplication and no overload of the system. Good job. Thanks
Good News π !
So for people who need/want to fix the script, add one line with "list_units.clear()" before reset connection :
...
if self.runAgain <= 0:
# WE NEED TO CLEAR list_units BEFORE RESET THE CONNECTION
self.list_units.clear()
self.melcloud_conn = Domoticz.Connection(Name="MELCloud", Transport="TCP/IP", Protocol="HTTPS",
Address=self.melcloud_baseurl, Port=self.melcloud_port)
self.melcloud_key = None
self.melcloud_conn.Connect()
self.runAgain = 10
self.runCounter = 0
else:
Domoticz.Debug("MELCloud https failed. Reconnected in "+str(self.runAgain)+" heartbeats.")
...
And you can try my script : EDIT : after few fixes... v0.8.2 based on Nonolk version : plugin.py.0.8.2.zip
EDIT : and v0.8.3 based on Mitkodotcom version : plugin.py.0.8.3.zip
Dalonsic.
@dalonsic , Thanks for the work.
I just put in your plugin.py 0.8.2 version. (Two units connected.. Language is set to Dutch (12). Refresh = 5 minutes. ) This gives me:
2023-11-11 10:06:16.314 Error: Airco: Call to function 'onMessage' failed, exception details: 2023-11-11 10:06:16.314 Error: Airco: Traceback (most recent call last): 2023-11-11 10:06:16.315 Error: Airco: File "/home/janpep/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 639, in onMessage 2023-11-11 10:06:16.315 Error: Airco: _plugin.onMessage(Connection, Data) 2023-11-11 10:06:16.315 Error: Airco: File "/home/janpep/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 312, in onMessage 2023-11-11 10:06:16.315 Error: Airco: self.domoticz_sync_switchs(unit) 2023-11-11 10:06:16.315 Error: Airco: File "/home/janpep/domoticz/plugins/domoticz-python-melcloud/plugin.py", line 587, in domoticz_sync_switchs 2023-11-11 10:06:16.315 Error: Airco: Devices[self.list_switchs[0]["id"]+unit["idoffset"]].Update(nValue=switch_value, 2023-11-11 10:06:16.315 Error: Airco: KeyError: 15
I honestly have no idea what is causing this.
You have same pb than Schurgan π’ You can try to edit your own script by adding one line "self.list_units.clear()" before reset connection (close to line 395) :
...
if self.runAgain <= 0:
# WE NEED TO CLEAR list_units BEFORE RESET THE CONNECTION
self.list_units.clear()
self.melcloud_conn = Domoticz.Connection(Name="MELCloud", Transport="TCP/IP", Protocol="HTTPS",
Address=self.melcloud_baseurl, Port=self.melcloud_port)
self.melcloud_key = None
self.melcloud_conn.Connect()
self.runAgain = 10
self.runCounter = 0
else:
Domoticz.Debug("MELCloud https failed. Reconnected in "+str(self.runAgain)+" heartbeats.")
...
And make a backup of your script π
I used your latest script. 0.8.2 where this 'self.list_units.clear()' is already present on line 458.
You can try to use the Schurgan version (plugin.py.forSchurganOnly.zip) with the fix ? (mine seems to work with only one inside unit π)
https://github.com/gysmo38/domoticz-python-melcloud/issues/37#issuecomment-1799574751
OK. This seems to work. Thanks! I will keep an eye on it for a while.
I just had to add my '&Language=12' in the login string again to keep the MELCloud app in Dutch. BTW. I did not do a diff between the two scripts yet, but may be later I will try to add the language and interval selection also in this script.
I have upgrade my version... to be based on the Mitkodotcom version (#27) https://github.com/gysmo38/domoticz-python-melcloud/issues/27#issuecomment-1027327927. it works with my single unit, and maybe with yours π
with :
EDIT : v0.8.3 based on Mitkodotcom version : plugin.py.0.8.3.zip
Dalonsic.
I immediately tried and for me it looks very good! Quick test with v0.8.3.
Hello,
I'm not familiar at all with GitHub, but noticed that nonolk proceeded to a brilliant improvement using setpoints instead of multilevel switches to control MELCloud units. https://github.com/nonolk/domoticz-python-melcloud Besides this, as it looks like Mitsubishi Electric servers are now limiting the data traffic. The polling interval is pretty short on this version, this creates logout from MELCloud servers.
On the other hand, tuk90 made a great job extending the features of MELCloud plugin giving the ability to set polling interval, but this version uses the legacy multilevel switches that is not really convenient. https://github.com/tuk90/domoticz-python-melcloud/tree/fixes
Is there a possibility that somebody merges the 2 capabilities?
Thanks
Patrice
I immediately tried and for me it looks very good! Quick test with v0.8.3.
- I still have all the domoticz devices for my two units + Language setting + Interval setting + no errors until now.
- I can switch both units from my advanced dzvents scripts + scenes on and off.
- MELCloud app is reponding with the correct status and remains in language (Dutch) that is set. Great job! Thanks.
For me it seems to be broken since I am on version 2024.4, is it still working for you or did it also break at your side?
I immediately tried and for me it looks very good! Quick test with v0.8.3.
- I still have all the domoticz devices for my two units + Language setting + Interval setting + no errors until now.
- I can switch both units from my advanced dzvents scripts + scenes on and off.
- MELCloud app is reponding with the correct status and remains in language (Dutch) that is set. Great job! Thanks.
For me it seems to be broken since I am on version 2024.4, is it still working for you or did it also break at your side?
My bad, the error code which I got was 429. So I disabled the plugin for a day and after that booted it again and then it worked. I will add more polling interval options to solve this
Hello, Thank you very much for your work with the plugin. I have 4 indoor units and I have a huge problem with the log. If the plugin makes the status query every 25 seconds, the following is written to the log:
2023-10-16 20:17:47.189 MelCloud: Update unit Michael information. 2023-10-16 20:17:50.014 MelCloud: Update unit Valeria information. 2023-10-16 20:17:50.075 MelCloud: Update unit Wohnzimmer information. 2023-10-16 20:17:50.126 MelCloud: Update unit Schlafzimmer information
Everything is going well so far. But every day the text in the log doubles and the next day there are 2 entries for each indoor device. This is what it looks like on the second day:
2023-10-16 20:17:47.189 MelCloud: Update unit Michael information. 2023-10-16 20:17:47.189 MelCloud: Update unit Michael information. 2023-10-16 20:17:50.014 MelCloud: Update unit Valeria information. 2023-10-16 20:17:50.014 MelCloud: Update unit Valeria information. 2023-10-16 20:17:50.075 MelCloud: Update unit Wohnzimmer information. 2023-10-16 20:17:50.075 MelCloud: Update unit Wohnzimmer information. 2023-10-16 20:17:50.126 MelCloud: Update unit Schlafzimmer information 2023-10-16 20:17:50.126 MelCloud: Update unit Schlafzimmer information
And so the messages multiply every day, so that after a week the log becomes so overloaded that the Raspi warms up and eventually crashes.
The problem can be solved temporarily by restarting the plugin. But that's not a good solution if you're not at home for a few days or something like that...
What can cause this? Ask for support. Thanks