Friday, March 10, 2023

Octoprint notifications to Telegram

 For an index to all my stories click this text

 


 

 

 

 

 

 

 

 

 

If you own a 3D printer I really recommend working with Octoprint. Octoprint runs on a Raspberry Pi (Model 2B or higher) and makes lfe a lot easier. You can get Octoprint (called Octopi for the Raspberry) here: https://octoprint.org/download/

Some time ago I posted a filament runout sensor for my 3D printer which you can re-read here: http://lucstechblog.blogspot.com/2020/05/filament-sensor-with-alarm-on-your-phone.html

This was a great help when I was printing with some really old brittle filament. But there was something else I felt lacking.
I often start my print and then go do something else. In the summer I often sit in the garden, reading and enjoying a good book and cold drinks. However I frequently go inside to my mancave to check if the printer has finished.
Obviously I can check that using Octoprints website and looking at the webcam picture. But I found a better option.

Sometime ago I started using Telegram as my main information system. I can use it as a whatapp replacement. However Telegram can do so much more. I connected it to my home automation system, Domoticz, and have several ESP's sending data and alarms to Telegram when needed.

And I connected Octoprint to Telegram. So now I get a message on my phone when a print has finished complete with a picture.

Let's do this.

Installing and configuration of the Telegram plugin will only work when your printer is idle. So make sure you are not printing anything when following these steps.

The first step is to go to Octoprints settings page. It is the small wrench at the top right of the page.



Choose Get More until you find the Telegram plugin and click on that to install.



Installing may take a little while depending on which Raspberry you are using.



When the plug-in is installed you need to restart Octoprint. That's another reason why you should not be printing whenn installing.



When installation has finished click on the plug-in to configurate it. You will need to have Telegram installed on your phone and have made a bot. Not sure how to do that ? Read this story http://lucstechblog.blogspot.com/2023/01/telegram-messenger-for-iot.html

Open Octoprint and Telegram on your PC

Fill in the bot's token and click Test this token. Octoprint will send a test message to your Telegram bot to see if everything works as planned. Copying the token from your phone into Octoprint is almost impossible. You will have to retype a looooonnnnggg string. So best practice is to open Octoprints webpage on your PC and open Telegram on your PC. Then you can simply copy the token from one window into the other.

If you have not yet tried Telegram on your PC you can find a tutorial here:
http://lucstechblog.blogspot.com/2023/02/convenient-working-with-telegram.html



In the Octoprint Settings you can find the plugins at the bottom of the settings. Click on the notify icon (the small blue cloud)



Now you can chose which notifications Octoprint should send to Telegram. I chose only one being PrintDone. Alter this to your own liking.



Scrolling down in the settings you can alter each notification which you might have chosen. If a button is green it is activated. A red button is not. You can even alter the text that is being send. and the {file} parameter makes sure that the filename is incorporated into the text.



Now start a small test print. I printed a shopping cart coin which just takes 2 minutes to print. And after these two minutes I got a notification on my phone complete with a picture of the printed item.

This makes life a lot more comfortable !!!

Till next time
Have fun

Luc Volders