Posts

Showing posts from October, 2016

Smart Headless RPi - Sends you a direct message in Twitter

Smart headless RPi Tweeting RPi Problem: Ever find your self wondering what the IP address is for your raspberry pi is once its headless and you need to remote into it, or even which network its connected to? I wanted to know which access point my RPi is connected to and its IP address, and so i wrote a little clever program that lets me know just that.  This python program looks up its SSID and IP address then sends you message on twitter. You can use crontab to run this program on start up. on github: https://github.com/sherkon18/SmartHeadlessRPi sys,socket, fcntl, struct, socket, array,os from time import sleep from twython import Twython Device_Name="Your Device Name" time.sleep(30) #get IP address def get_ip(ifname):         s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)         return socket.inet_ntoa(fcntl.ioctl(                 s.fileno(),                 0x8915,                 struct.pack('256s', ifname[:15])