Maintenance reminder
-
Dear Duet,
I'm just starting with using meta-commands, but I was wondering if you could for example add a maintenance reminder that would pop up once a month (to regrease parts / adjust belt tensions etc). Let's say the first of the 1st month and use some sort of timestamp to check if the date equals the maintenance date. I think it should be feasible to do via a plugin, but I'm afraid that if I did not use the duet on that specific date, no message would be sent. I'm therefore looking to set some sort of state that it was checked during that month and if not, redisplay the message. I could of course put it on my own agenda, however, I think it would be a nice feature.
I did see this thread:https://forum.duet3d.com/topic/24880/does-rrf-have-maintenance-counters-timers/23?_=1694165106840
But I would prefer to use a time stamp, what I was thinking of is the following,
have a variable with a timestamp that sends an alert or pop-up if no maintenance has been performed for 30 days
have a macro that is run during maintenance for example while greasing linear rails it spreads out the oil by moving along the axis after completion it updates the timestamp
Do you think this could be a feasible approach and do we have direct access to a timestamp? Or would it be better to do it via a custom-written plugin in Vue, if so I"ll have to find a way to access and edit the config file via vue else I don't know where to permanently store a variable that is not erased when rebooting the system.
Kind regards
-
@Tricep-terry
You can use the object model valuestate.time
to obtain a time stamp.
You could easily then use the echo command to store that in a file which could later be used to populate a variable at startup.So something like this macro can be called when you want to update the value
;store/update timestamp var DaysTillNextService = 30 ; set this to whatever you want var SecondsTillService = var.DaysTillNextService * 60 * 60 * 24 ; converts the days to seconds if !exists(global.myTimeStamp) global myTimeStamp = state.time + var.SecondsTillService else set global.myTimeStamp = state.time + var.SecondsTillService echo >"0:/sys/maintenanceLog.g" "global myTimeStamp = datetime" ^ "(""" ^ global.myTimeStamp ^ """)" echo >>"0:/sys/maintenanceLog.g" "echo ""Next maintenance due at "" ^ datetime(" ^ """" ^ global.myTimeStamp ^ """)"
Would create a file with something like this
global myTimeStamp = datetime("2023-10-09T07:42:31") echo "Next maintenance due at " ^ datetime("2023-10-09T07:42:31")
If you then call that file from your config.g using M98, it will reset the global to the stored value at startup.
if !exists(global.myTimeStamp) M98 P"0:/sys/maintenanceLog.g"
You can then check if the current time is greater than the maintenance time
if global.myTimeStamp < state.Time M291 P"Maintenance is due!" S3
However,
state.Time
isn't set until after the network/wifi has connected so you can't do the comparison in config.g most likely as the network won't yet be connected.
You could use daemon.g to automate the check with something like thisif state.time != null if !exists(global.NotificationDone) global NotificationDone = false if (global.myTimeStamp < state.Time) && (global.NotificationDone = false) M291 P"Maintenance is due!" S3 global.NotificationDone = true
You'll have to test and revise to suit your own requirements of course.
You can also use the excellent BtnCmd plugin to display the time stamp where it's easy to check
-
@OwenD many thanks for the clearly written explanation with examples, definitely going to give this a shot in the next few days!