This is a Python service that runs on an Onion Omega. As the @DoorbellRinger Twitter account, it watches the user stream and rings a doorbell when @DoorbellNudger tweets something with the #ringit
hashtag. It also auto-updates with the #update
hashtag.
Follow the pivot-overlay section:
https://wiki.onion.io/Tutorials/Using-USB-Storage-as-Rootfs
tl;dr:
opkg update
opkg install e2fsprogs
mkfs.ext4 /dev/sda1
mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1/
mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt
block detect > /etc/config/fstab
Edit /etc/config/fstab:
option target '/overlay'
option enabled '1'
Then reboot your Omega.
opkg update
opkg install python-light python-pip git git-http
Clone this repository (via HTTPS) into the /opt directory:
mkdir /opt
cd /opt
git clone https://github.com/atesgoral/doorbell-ringer.git
cd /opt/doorbell-ringer
pip install -r requirements.txt
Make a copy of config.yml.example as config.yml and fill in your Twitter Application's access settings:
twitter:
consumerKey: ...
consumerSecret: ...
accessTokenKey: ...
accessTokenSecret: ...
Create a symbolic link to the init.d script and enable the service:
ln -s /opt/doorbell-ringer/init.d.sh /etc/init.d/doorbell-ringer
/etc/init.d/doorbell-ringer enable
reboot
After the service is set up to run on boot, just reboot the Omega. Or manually start the service:
/etc/init.d/doorbell-ringer start
python stream.py
To stub out the expled
and ubus
commands available on Omega's OpenWRT, you can copy the contents of the stubs directory to your bin folder or add the stubs folder to your PATH.
python -m unittest discover -s test