Send emails / txts notifications from gcode.

More
26 Mar 2023 15:25 #267532 by nick.smith
Here is my article on how to send and receive email / txt notifications via M codes inline with your gcode.

tormachtips.com/m101.htm

I am open to any improvements from the experts on this board.

 
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
26 Mar 2023 18:15 #267547 by tommylight
Replied by tommylight on topic Send emails / txts notifications from gcode.
Very nice, thank you.
I have seen something similar quite a while back for LinuxCNC, but i could never find a use for it, besides sending camera pictures in intervals as progress notifications. This i use on 3D printers as i can stop or pause them remotely if something goes wrong. Uses Telegram bot, though.
Doing something similar using Signal (open source) would be nice.

Please Log in or Create an account to join the conversation.

More
27 Mar 2023 06:53 #267585 by Vmax549
Replied by Vmax549 on topic Send emails / txts notifications from gcode.
There is something similar in PathPilot but it was turned off by Tormach. It used a message code to trigger the SMS message.

(;-) TP

Please Log in or Create an account to join the conversation.

More
27 Mar 2023 21:34 #267627 by snowgoer540
Replied by snowgoer540 on topic Send emails / txts notifications from gcode.
Write up looks nice!

I swore I saw something in their files before, so I did some digging.  They have two files in the V2.x.x/python folder that may be of interest to you:
sms.py
sms_test.py

Looks like they used/experimented with twilio in the past to send messages.  It might be an easy integration to skip gmail entirely, and in the words of Andy Dusfresne (Shawshenk Redemption) "if you've come this far, maybe you're wiling to come a little further". :)

One tip - geany exists on PathPilot machines.  If you use it over gedit, you can switch line ending types without having to install anything extra.  Document -> Set Line Endings -> you can choose LF (Unix).  It's more geared toward coding so can make viewing a smidge easier.

I look forward to your future write ups.



 

Please Log in or Create an account to join the conversation.

More
30 Mar 2023 02:59 #267883 by nick.smith
Replied by nick.smith on topic Send emails / txts notifications from gcode.
Dan (I think Dan) Rogge, one of the techs turned CEO, has a blurb on their own forum about using Twilio I think it is to send SMS, but he doesn't go into any detail on it.

Please Log in or Create an account to join the conversation.

More
23 Mar 2025 22:35 #324706 by chrisfischer
Replied by chrisfischer on topic Send emails / txts notifications from gcode.
I am trying to get your method to work and am having trouble.

Launching linuxcnc from terminal i see errors when the m code is called:

/home/kira/linuxcnc/nc_files/m_codes//M101: 4: import: not found
/home/kira/linuxcnc/nc_files/m_codes//M101: 5: import: not found
/home/kira/linuxcnc/nc_files/m_codes//M101: 6: from: not found
/home/kira/linuxcnc/nc_files/m_codes//M101: 7: from: not found
/home/kira/linuxcnc/nc_files/m_codes//M101: 9: arg1: not found
/home/kira/linuxcnc/nc_files/m_codes//M101: 10: arg2: not found
/home/kira/linuxcnc/nc_files/m_codes//M101: 14: Syntax error: "elif" unexpected (expecting "then")

It appears python is not being called despite the magic incantation at the top.
I tried the stock #!/usr/bin/env python
as well as #!/usr/bin/python

Mentioned here as well.
forum.linuxcnc.org/10-advanced-configura...-python-script#57764

Running the M101 file as a python script from terminal does indeed send an email. Pretty sweet.

Any idea what could be prohibiting python from being run?

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
23 Mar 2025 22:41 #324708 by tommylight
Replied by tommylight on topic Send emails / txts notifications from gcode.

I tried the stock #!/usr/bin/env python
as well as #!/usr/bin/python

Just a stab in the dark but try adding 2 or 3 to the python
#!/usr/bin/env python2
or
#!/usr/bin/env python3

Please Log in or Create an account to join the conversation.

More
24 Mar 2025 03:30 #324723 by chrisfischer
Replied by chrisfischer on topic Send emails / txts notifications from gcode.
Thanks for the idea.
Tried it without success.

But it did make me think to try some other stuff i saw in the link above.

I changed the M101 file to a new name sendemail.py
Then i called the file in the bash script of M101 that looks like this:

#!/bin/bash

python3 sendemail.py P1 P2 %

exit 0


That did the trick!
This is a huge step towards automation for me!
Thanks everyone.

ps the python script sendemail.py needed to be in the config folder with the machine.ini despite the mcode file location in my nc_files directory.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

Time to create page: 0.138 seconds
Powered by Kunena Forum