999LV / SmartVirtualThermostat

Smart Virtual Thermostat python plugin for Domoticz home automation system
MIT License
42 stars 31 forks source link

Plugin crash in the Autocallib routine #26

Closed jjouifi closed 4 years ago

jjouifi commented 4 years ago

Hello,

I'm experiencing crashes with the latest code. Here are the details:

Thanks, and congratulation for the great piece of code. The log extract below. jj

2020-01-07 10:05:10.117 Error: (SVT_Antoine) 'onHeartbeat' failed 'TypeError':''>' not supported between instances of 'float' and 'NoneType''. 2020-01-07 10:05:10.118 Error: (SVT_Antoine) ----> Line 687 in '/home/domoticz/www/plugins/SVT/plugin.py', function onHeartbeat 2020-01-07 10:05:10.118 Error: (SVT_Antoine) ----> Line 370 in '/home/domoticz/www/plugins/SVT/plugin.py', function onHeartbeat 2020-01-07 10:05:10.119 Error: (SVT_Antoine) ----> Line 398 in '/home/domoticz/www/plugins/SVT/plugin.py', function AutoMode 2020-01-07 10:05:10.119 Error: (SVT_Antoine) ----> Line 463 in '/home/domoticz/www/plugins/SVT/plugin.py', function AutoCallib

999LV commented 4 years ago

Thanks for reporting. No way I can check into this for now as deep into my day job. Can you submit a PR for adding error checks on this instance ?

jjouifi commented 4 years ago

Hello,

No idea what you mean. Do you have some documentation on the procedure ?

If you look at the code, you don't think there's something funny with checking a variable and not using it? If you think this is relevant, I can change:

elif self.outtemp is not None and self.Internals['LastSetPoint'] > self.Internals['LastOutT']:

to

elif self.Internals['LastOutT'] is not None and self.Internals['LastSetPoint'] > self.Internals['LastOutT']:

and test myself.

Cheers,

999LV commented 4 years ago

Ok. I did find time to look into this. The line should actually be changed to:

elif (self.outtemp is not None and self.Internals['LastOutT'] is not None) and self.Internals['LastSetPoint'] > self.Internals['LastOutT']:

Can you please try out and let me know if this works ? If so, I’ll incorporate in the next version (coming soon, with some other minor changes)

jjouifi commented 4 years ago

Sure. Will try that across a few days an let you know. Thanks.

jjouifi commented 4 years ago

All good, I got no more crashes, and the plugin still does the job. Thanks,