​ A Raspberry Pi based Steemit Notification Module

After I completed the python-version of LED notification which mimic the LED notification script of SteemPi, I started to work on the eSteem-style notification for Raspbian. That's what I just completed and put on Github.

It makes use of the Piston-Steem python library for capturing of Steemit events. The module will check if the events were related to the user. If yes, extract event information, check if it is an upvote or a comment. Should it be either of them, display the information on the event on the 20x4 LCD.

Currently, I am using the RPLCD python library to drive LCD. It supports both Python2 and Python3. This is important as the Piston-Steem library requires Python3, Therefore, support of python3 in RPLCD makes life much easier.

Tutorial on how to install required libraries csn be found here: A Guide to Setup Raspberry Pi based Steemit Notification Module

How the module works

Basically, it monitors the STEEM Blockchain, when there is any activities on the user's account, it will grab it, check if it is an upvote or a comment. If yes, it will blink the LED as well as display upvote or comment information on the 20x4 LCD. Like this:

3C6BCE45-3626-47B6-BD82-D1DE633C7994.gif


Here is the notification module on Github. Feel free to down it and play with it. Anyway suggestion and comments are welcomed!


from piston.steem import Steem
from piston.account import Account
from RPLCD.i2c import CharLCD
import time
import RPi.GPIO as GPIO
import sys
# initialize Steem
account_name = 'guyverckw'
account = Account(account_name)
steem = Steem()
# initialize LCD
lcd = CharLCD('PCF8574', 0x3f)
# Clear LCD
print('Clear LCD')
# Prepare LED indicator
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT, initial=GPIO.LOW)
# Set user account, no. of history retrieve everytime, transaction ID buffer array of 10 
first = 9999999999limit = 5
History = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
History_ID = 1.0
message = ' '
# keep checking transactions
while True: 
   index = 0 
   print (History, History_ID)
# Get last 5 history, put ID into buffer array 
   for his in account.rawhistory(first, limit): 
      if History_ID == his[0]: 
         break 
      print('History ID: %d10.0' % History_ID) 
      print(his[1]['op']) 
      if his[1]['op'][0] == 'comment':  
         message = 'There is a comment from @' + his[1]['op'][1]['author'] 
      elif his[1]['op'][0] == 'vote': 
         if his[1]['op'][1]['author'] == account_name: 
            message = 'There is a vote from @' + his[1]['op'][1]['voter'] + ' of ' + str(his[1]['op'][1]['weight']/100) +'%' 
         else: 
            History[index] = his[0] 
            index += 1 
            continue 
         History[index] = his[0] 
         index += 1 
         print (message) 
         GPIO.output(11, GPIO.HIGH) lcd.clear() 
         lcd.write_string(message) time.sleep(1) 
         GPIO.output(11, GPIO.LOW)
      History_ID = History[0] 

Roadmap

I am going to expand the devices supported to a few more LCD and LED devices. This would allow users to use it on different hardware application (with different form factor HW designs).
I will in parallel to work on an integration of the module with SteemPi.

Stay tuned!



Posted on Utopian.io - Rewarding Open Source Contributors

H2
H3
H4
3 columns
2 columns
1 column
32 Comments