this post was submitted on 06 Mar 2024
8 points (100.0% liked)

raspberrypi

3242 readers
1 users here now

Community about the single-board computers, micro-controllers and related projects.

https://www.raspberrypi.com/

Other RaspberryPi communities on Lemmy

founded 4 years ago
MODERATORS
 

I'm sorry if this isn't the place to ask this, I also asked over at [email protected].

So what I want to do is this: Two RasPis are at different locations. They're on different networks but have internet access. Pressing a button on one of the Pis turns on an LED over at the other Pi via GPIO. How can I make the communication work? My first thought was Telegram bots as I'm familiar with those for notifications but you can't have Telegram bots communicate with each other, sadly. Is there a good (and secure) solution to this? Preferably using Python code and without continuous costs like server hosting, etc?

Thanks!

top 4 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 7 points 8 months ago

The general problem your describing is Command and Control, or C2. Tailscale/wireguard/vpn is probably the best solution, but if you want to get weird with it, any site that allows user submitted content can be used.

For example, make one pi post to twitter, and the other pi can poll twitter. Substitute twitter with pastebin/lemmy/signal/instagram.

[โ€“] [email protected] 1 points 8 months ago* (last edited 8 months ago) (1 children)

Tailscale can create a mesh network that works across the internet.

Easy as pie (๐Ÿ˜) to setup on pretty much any device, even RPi. Then just use any LAN-based communication protocol.

https://tailscale.com/download/linux/rpi-bullseye

As for using Telegram bots, can't a bot monitor a chat for keywords, and just have a bot inject the keyword?

I use a bot that injects my SMS messages into Telegram, so I can see them (and reply) using Telegram on my laptop.

[โ€“] [email protected] 3 points 8 months ago

Yeh, tailscale is going to be the easiest and most flexible.
Other than that, its coupling directly to a messaging system that is also the communication system. So you are beholden to API changes and TOS changes.
At least with tailscale you can easily jump to headscale or wireguard with virtually 0 impact. Also allows for using a messaging system that is fit for purpose instead of whats available and free and does NAT traversal

[โ€“] [email protected] 1 points 8 months ago

After you have set up the VPN (tailscale etc.), you could use pigpio.