Over the past week we have began implementing our plugin as a group using git. It has been a bit hectic because my partner has not been in class, and we have had two new people added to our group. At this point, everyone seems to be caught up and we have divided the tasks in order to conquer this plugin with the time that we have left. So far, we have implemented a tab called Safety Timeout under the Settings menu in OctoPrint. This time variable is initialized to zero, but it is user adjustable. When you enter your own amount, it is stored in this variable, and printed to the screen upon server startup (The server prints the last value that Time held, so if you change it during a run, it does not print the same value).

This means that we have access to what the user is entering. The next step is to set off a timer based on the entered amount of time. I have been looking at the octoprint.util library in order to start a timer. It gives the following example:


Instead of having a function that prints hello, perhaps we can have a function that prints the time variable, and updates it as well (subtracting the correct amount of time before printing it again). I believe that this will be fairly easy to implement, but I have not yet done it.  My task was to find a way to implement the timer. I believe what I will do will be something like the following:

  • time = int(self._settings.get([“Time”]))
  • def timer():
    • time = time -1
    • print(“Time Remaining: %s ” % str(Time))
  • t = repeatedTimer(1.0, timer)
  • t.start()

The code above should in theory act like the user has entered a time in seconds and print the updated time every second. For example if the entry was 120, it would treat it as though there were 120 seconds and would print:

Time Remaining: 119, etc.

However, as proves true with all things, implementation is much more difficult than discussion, so stay tuned to find out what will happen.