Telegram plugin control GPIO

Hello, can the GPIO be checked with the Telegram plugin? I use an led connected to the relay, and when I send the /status command, I want it to turn on the light before taking a picture. How can I do that?

If you set it to system command, then you can write a script that controls the LEDs. Or with plugins such as WS281x LED Status it also has gcode commands. The script is probably the best for you, since you say it is connected via a relay.

I don't have a WS281X LED. I have a 12v powered LED. How should gcode be? What should i write?

You are looking to create a script on your Raspberry Pi that can control the GPIO - not a gcode command, since you stated you don't have those LEDs.

You can read about command line control of the LEDs here:
https://raspberrypi-aa.github.io/session2/bash.html

1 Like

In the octoprint, under Telegram plugin, scrolled down to
"Action pre image could be none, a gcode or a system command (script name with full path)" and added "gpio -g write 23 0"
Worth to mention, I'm connecting my light to a power socket which is controlled by GPIO 23
I also added "gpio -g write 23 1" for the post image action.
The issue I am having is that the picture taken is almost immediately while the light is still turning on, hence dark with not much details compared to when the light is on.
photo_2021-04-13_23-36-17
photo_2021-04-13_23-36-36.
I managed to delay "light off" post image action but was not able to find something to delay taking the image allowing for the light to turn on properly.

Really appreciate ideas to solve the issue

1 Like

Hello I have the same problem.

Have you find any solution to delay the light on command before take the photo?

Thanks in advance.

Hi, to solve your issue I put a sleep separated by ";" in the command pre-image. My pre-image command is this:
gpio -g write 4 0; sleep 3
Now octoprint waits a few seconds before taking the picture.

Thanks for sharing, I'll post details once I try it.

Cheers

Hello, I have a led connected to the raspberry gpio 22 pin, I do not understand which of the options I should choose. Is it my system commands or gcode?