gysmo38 / domoticz-python-melcloud

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

Error with onMessage function #3

Open miczmc opened 5 years ago

miczmc commented 5 years ago

2018-12-09 23:34:04.899 (MELCloud) Update unit XXXXXXX information. 2018-12-09 23:34:04.899 Error: (MELCloud) 'onMessage' failed 'UnboundLocalError':'local variable 'setModeLevel' referenced before assignment'. 2018-12-09 23:34:04.899 Error: (MELCloud) ----> Line 444 in /root/domoticz/plugins/Melcloud/plugin.py, function onMessage 2018-12-09 23:34:04.899 Error: (MELCloud) ----> Line 194 in /root/domoticz/plugins/Melcloud/plugin.py, function onMessage 2018-12-09 23:34:04.899 Error: (MELCloud) ----> Line 406 in /root/domoticz/plugins/Melcloud/plugin.py, function domoticz_sync_switchs

CousinsP commented 5 years ago

I don't know Python, but I think I can see the problem, In lines 400-404 it's possible that setModeLevel doesn't get set, and is used later on. I just need to find out how if then else constructs work in Python, then might be able to resolve. The variable probably needs setting to a default at the beginning of the domoticz_sync_switchs function. But what should the default be?