​ A Raspberry Pi based Steemit Notification Module

in utopian-io •  7 years ago  (edited)

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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Wow amazing. I gonna need to get me one of those rasberry pi's. This is just to nice!

Hey that's cool. I was just thinking the other day of starting that "Magic Mirror" project for the pi. Implementing this would be a cool feature!

On that note! I've had a couple beers at this point, and am new to the platform. Is there a way to bookmark or favorite posts so I can come back to this?

  ·  7 years ago 

magic mirror project sound cool too.
I don't know a very good "Bookmark" feature, I just put on comments so that I can search my comment to get back to that post.

Ah good call! I guess it's pretty easy to scan through a comment history.

couple of typo:

  1. notificationwhich - missing space
  2. Toturial - Tutorial

Githut >>> Github

Vying for spellchecker championship. :-)

You have to give me credit for trying! 😉

We all must try😎

  ·  7 years ago 

Corrected, thanks a lot.

You're welcome

I have a raspberry pi laying around, now I know what to do with it. My python's a bit rusty but I'll give it a shot!

some days start my new language python, The invention of LED lights is very good. Now I will try. thanks for sharing

wow that's going to be cool never missing an update again :D

Great work ...adding alot to steemit

Thank you for the contribution. It has been approved. That's a great work, bdw I checked the code and find out there is no error handling done. So are you planning to handle the error because if the error happens it will stop, you need to start all over again.

You can contact us on Discord.
[utopian-moderator]

  ·  7 years ago 

Thanks for reminding, will add error handling in later.

wow amazing post really..

it will be such an amazing project! all the best..

Wow a nice steem post.....

Hey @guyverckw I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

This is awesome. I'm interested in raspberry pi and I want to make a bot like this. My idea is different with this. But this will be a good guide for me. Thanks. :)

haha I don't get everything you say but still I like the project!

interesting this is but i have not much how to implement it lolzzz

that's cool....nice steem post.....
very helpful

Nice steem post......

nice article

good post..

I always upvote and resteem your post please give me your huge part of vote

really like your post...

Congratulations @guyverckw! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You published a post every day of the week

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Great works and good update