Thunderbird mail notification flag via USB

Last Updated or created 2023-10-20

In 2021 I made a MQTT notification Flag using a Servo and python code and webhooks to get notifications.
Webhook was used for Mattermost.

Now i’ve changed the notification flag for Email using Thunderbird.
Just connect the wemos to a USB on your computer, no mqtt/wifi needed. (On the road solution)

Steps:

Install FiltaQuilla Add-on in thunderbird
select run program in config.

Next create a filter

Create two bash files (i’ve got mine in ~/bin/ )
Change ttyUSB0 if needed

::::::::::::::
flagoff.sh
::::::::::::::
#!/bin/bash
stty -F /dev/ttyUSB0 ispeed 9600 ospeed 9600 -ignpar cs8 -cstopb -echo
echo 0 > /dev/ttyUSB0

::::::::::::::
flagon.sh
::::::::::::::
#!/bin/bash
stty -F /dev/ttyUSB0 ispeed 9600 ospeed 9600 -ignpar cs8 -cstopb -echo
echo 1 > /dev/ttyUSB0

Install YAD and a autostart icon to make the systemtray to pull the flag down.

henri@zspot:~$ cat .config/autostart/servoflag.desktop 
[Desktop Entry]
Type=Application
Version=1.0.0
Name=flag-off
Comment=
Icon=
Exec=yad --notification --image="gtk-execute" --command="bash /home/henri/bin/flagoff.sh" --image="mail-app"
Terminal=false

Arduino Code

#include <Servo.h> 

Servo flag; 
char val;
 
void setup() {
  Serial.begin(9600);
  flag.attach(D5);
  }

void loop () {
  val = Serial.read(); 
  if (val == '0') {
     flag.write(180); 
  } 
  if (val == '1') {
     flag.write(0); 
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *