Anyway, I've got that far and I'm ready to actually create the new function. I've created a new branch in my local git repository (water-backup-dev). Within that branch I've created a modified version of controllogic.py with the conditional code at the top of the sumppi_control_logic() function, as suggested by Hamish. During Opening Hours this is ignored but between 1600 UTC and 0900 UTC, the new function water_backup_logic() will be called. However, I have some rooky questions:
- I''m assuming that the new function should be created within controllogic.py. Is that the right approach or should there be a different file.?
- I suspect that once the the new function is executing there will be some time before the levels stabilise. This leads to the possibility that the function won't return before a new tick is due. Also the new function will need access to the readings so that it can know when to exit. How much of the sumppi_control_logic() code should be repeated within the new function?
- Alternatively, I could set a timer so that the new function is exited periodically to update the readings and ticks. Or as another alternative, I could move the conditional code until after the readings have been done, just before the logic starts when the levels are checked. Thoughts?
- When I have some code that I am happy with, I would appreciate it being Peer Reviewed. (Hamish?)
- I don't think it's going to be easy for me to test this code before I deploy it. Hamish will you have time to load it into your simulator?
- What is the best way to deploy the finished code?