Email on tool change?

Hi, is there a way to have the pocketnc send an email on m01 or m06 when it needs a tool change or has option stopped?
Thanks.

Hi @Matterest,

This is not something that we currently support or have a simple solution to. However, if you are up for some tinkering, it could be done.

If you would like to give it a try, let us know and we can point you in the right direction.

Would a M1xx command work?

Im not sure how you mean? Or what for that matter. Are you able to explain your idea please.
Thanks!

I mean this:
http://www.linuxcnc.org/docs/devel/html/gcode/m-code.html#sec:M100-to-M199

@Matterest, you could create an executable file named M followed by a number from 100 to 199 in ~/mcodes and you would be able to call that executable by using the M code in your G code program. You would have to be familiar enough with programming to implement emailing yourself and would have to modify your G code programs to use your script.

Also, be careful to avoid the M codes defined in /opt/pocketnc/Settings/mcodes

That would definitely work. What language are these scripts written in? I skimmed the section on them but didnt see any language named.
Thanks,
Matt

The only requirement is the script has to be executable, so it could feasibly be any language. Here are some simple examples in Bash, Python and Node that simply output the current time to a file in your home directory:

Bash

#!/bin/bash

# Appends the current date/time to ~/last_run.txt
date >> ~/last_run.txt

Python

#!/usr/bin/env python3
import datetime

with open("/home/pocketnc/last_run.txt", "a") as file:
    file.write(datetime.datetime.now().replace(tzinfo=datetime.timezone.utc).strftime("%a %d %b %Y %I:%M:%S %p %Z\n"))

Node

#!/usr/bin/env node

const fs = require('fs');
const d = new Date();

const file = fs.openSync("/home/pocketnc/last_run.txt", 'a');
const days = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ];
const months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
const hour = d.getUTCHours()%12 == 0 ? 12 : d.getUTCHours()%12;

fs.writeSync(file, `${days[d.getUTCDay()]} ${d.getUTCDate()} ${months[d.getUTCMonth()]} ${d.getUTCFullYear()} ${hour.toString().padStart(2,'0')}:${d.getUTCMinutes().toString().padStart(2,'0')}:${d.getUTCSeconds().toString().padStart(2,'0')} ${d.getUTCHours() >= 12 ? "PM" : "AM"} UTC\n`);