cron.go: adopt standard cron notation

Issue #175 resolved
Saxon Milton created an issue

It has recently come to our attention that the DO and salinity sensor module deployed at Stony Point whyalla makes an unacceptable dent in the power budget when powered on continuously. We’ve concluded that there’s no need to get data at a per minute resolution, and that we can instead get data on a per 15 min, 30 min or even hour basis. This would allow us to turn the device off in the down time and conserve more power. We have discovered however that we don’t really have sophisticated enough cron functionality that can handle this kind of task i.e. to turn the device on at certain intervals, and then turn the device off some offset after turning it on.

Currently, we convert our own cron notation to standard notation using a shim function. This is then given to the robfig/cron package for parsing and scheduling. It turns out that standard cron notion offers features that would allow us to perform the desired tasks. Given that there’s no particular reason why we need to use our custom notation for crons, it’s therefore proposed that we do away with the shim layer entirely and expose the powerful features of the standard notation that is supported by the robfig/cron package.

We do however wish to keep our “solar” notations i.e. sunrise, noon and sunset, so we’ll have a small shim layer to parse these. It’s suggested that these are in the following notation: “@sunrise”, “@noon” and “@sunset”.

Comments (4)

  1. Saxon Milton reporter

    In addition to the above changes, we will now provide the robfig/cron scheduler with the location so that we don’t have to make adjustments to time before providing.

  2. Saxon Milton reporter

    We now also still allow hh:mm notation. This will parsed into a cron spec by iotds.Cron.ParseTime, which will allow us to minimise changes for the time being.

  3. Log in to comment