999LV / SmartVirtualThermostat

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

timeshifts can occur due to re-taking datetime.now in sub procedures #47

Open rrozema opened 3 years ago

rrozema commented 3 years ago

datetime.now() is used in multiple places to determine state changes and also to calculate time periods. Because some subroutines determine a new value for "now", instead of using the same value as it's caller, small errors will occur in the times used. Accumulated these small errors in time result in small errors in the calculated constants.

A fix is to determine "now" only once per "run".

I will post a pull request soon.