create account

STEEMPI is Talking! + a few possible solutions for blinking the LED on updates (Help needed Curl/Steemsql/Bash script/PHP) by techtek

View this thread on: hive.blogpeakd.comecency.com
· @techtek · (edited)
$99.55
STEEMPI is Talking! + a few possible solutions for blinking the LED on updates (Help needed Curl/Steemsql/Bash script/PHP)
<html>
<h1>Steempi is talking!</h1>
<p>One of the smarthome like features that would be nice to have is that Steempi could talk, once this feature is integrated it can notify "New upvote", "New comment" "New transfer" and it could even read replies for us. and possible do other things in the future.</p>
<p>i have played around a bit with speech to text before on my other Raspberry Pi robotic project, and using and integrating &nbsp;speech to text to a project is not that difficult, and easy to install.</p>
<p>It would be nice if STEEMPI beside blinking the notification LED also can give spoken notifications.</p>
<p>In this update i will share the struggle and results of the past few days to try and make those things work and hope you have some feedback to solve the issues.</p>
<p>(im not a good programmer but have big passion for technology and want to make this work for all of us)</p>
<h2>https://steemitimages.com/DQmPVgFkpCHzCW6o43hRionaWouTiB6i9WYWLoYfTQZwmJE/coding-01.jpg&nbsp;</h2>
<h2>Making Steempi talk</h2>
<p>To make Steempi talk its first few words, sentences &nbsp;and commands &nbsp;i used a program called "<em>festival</em>"</p>
<h2>How does it work</h2>
<p>Instead of echo the results to the screen we can use echo to <em>Festival</em>, and <em>Festival</em> will use text to speech to read the results which can be heard on the connected speakers.&nbsp;</p>
<p>(on TV speakers over HDMI or speakers connected to the 3,5mm jack)<br>
</p>
<p>Installing festival:<strong><br>
</strong><code>sudo apt-get install festival</code></p>
<p>Example command to speak a sentence:<br>
<code>echo Just what do you think youre doing, Dave? | festival --tts</code>&nbsp;</p>
<p>Example command to speak out the IP address of the Pi:<br>
<code>hostname -I | festival --tts</code></p>
<h2>https://steemitimages.com/DQmW4n37BrX94Dv1YNSArxqBVij5zpEeJHr2ssrcuVdZxbf/image.png</h2>
<h2>Progress on blinking the led on new upvotes / replies and transfers</h2>
<p>The best way probably is to use the Steemit api, SteemSQL or Steemdata. i have looked into the tutorials here on Steemit and have asked around and try implement them but i could not adjust the given methods so i searched for &nbsp;a work around.</p>
<p>The first work around i tried to get information from Steemit.com was to use a website called IFTTT to forward the new replies to my email. but this approach updates to slow to be useable for this project.</p>
<p>The other work around i tried is with Curl, Curl can check a website for changes and it should be possible to compare 2 websites.</p>
<p>If the website changes, it could run a command (the LED on command.)</p>
<p>This would be more preferable than the first work around because it is more pure and running on the PI instead of a external website.</p>
<p>Found this Curl Bash script that had good ratings:</p>
<p><code>#!/bin/bash<br>
while [ 1 ];<br>
do<br>
&nbsp;&nbsp;&nbsp;&nbsp;count=`curl -s "www.nba.com" | grep -c "Basketball"`<br>
&nbsp;&nbsp;&nbsp;&nbsp;if [ "$count" != "0" ]<br>
&nbsp;&nbsp;&nbsp;&nbsp;then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "www.nba.com updated!"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit 0 &nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;fi<br>
&nbsp;&nbsp;&nbsp;&nbsp;sleep 600 &nbsp;&nbsp;<br>
done</code></p>
<p><br></p>
<p>And changed it to:</p>
<p><code>#!/bin/bash<br>
while [ 1 ];<br>
do<br>
&nbsp;&nbsp;&nbsp;&nbsp;count=`curl -s "https://steemit.com/@techtek/comments" | grep -c "RE:"`<br>
&nbsp;&nbsp;&nbsp;&nbsp;if [ "$count" != "0" ]<br>
&nbsp;&nbsp;&nbsp;&nbsp;then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "New Reply to your account"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit 0 &nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;fi<br>
&nbsp;&nbsp;&nbsp;&nbsp;sleep 600 &nbsp;&nbsp;<br>
done</code></p>
<p>It runs but i think it doesn't work because of the https://steemit.com/@techtek/comments website doesn't have a preloaded end, and counting "RE:" will always result in the same result for that reason .(?)</p>
<h2>Other options</h2>
<p>Other software beside <em>Curl</em> that can maybe solve the problem and check steemit.com for changes and possibly blink the LED on website changes are: <em>urlwatch, Specto and Newsbeuter</em>. a other and probably more prefurable way would be with <em>SteemSQL</em> and <em>PHP</em>.<br>
<br>
To control the LED from within PHP i made this simple PHP example to blink the LED that is connected to the Raspberry Pi board:</p>
<h3>PHP LED Example:<br>
</h3>
<p><code>&lt;?php<br>
// make pin 0 a output pin<br>
exec('gpio mode 0 out');</code></p>
<p><code>// turn pin 0 on and off (blink x3 with one second interval)<br>
exec('gpio write 0 1');<br>
sleep(1);<br>
exec('gpio write 0 0');<br>
sleep(1);<br>
exec('gpio write 0 1');<br>
sleep(1);<br>
exec('gpio write 0 0');<br>
sleep(1);<br>
exec('gpio write 0 1');<br>
sleep(1);<br>
exec('gpio write 0 0');<br>
?&gt;</code></p>
<p><br></p>
<p>Having automated Steemit LED notification is come closer and a few first options are available to play around with, can you make it work and make it become a reality Do you know how to connect with for example SteemSQL and make the LED blink on new upvotes, replies and transfers ?</p>
<h2>Do you know how to light up this project , (and literally my day)</h2>
<p>it should be possible with some simple but smart solution, and a few lines of code, in a Bash script or from within PHP with SteemSQL.<br>
&nbsp;</p>
<h2>Let's get in touch and work together !</h2>
<p>The Steempi project as well as my other projects are time consuming and I always try to provide some unique things to the community. What keeps me going &nbsp;is your feedback, comments and support. For that reason I would very much like to get some feedback from you, and please feel free to contact me.<br>
<br>
Please help and participate, what solution can you implement or suggest to blink the LED, and make SteemPi (Festival) be more informative and dynamic with her notifications?<br>
<br>
More about this project:<br>
<a href="https://steemit.com/steemit/@techtek/introducing-steempi-steem-notifications-on-your-tv">"Introducing STEEMPI"</a><br>
"<a href="https://steemit.com/steemit/@techtek/diy-steempi-case-with-3d-printed-side-panel-and-steem-logo-that-can-light-up">3d printed case with Steemit logo"</a>&nbsp;<br>
</p>
<p><br>
https://steemitimages.com/0x0/https://steemitimages.com/DQmVBUmEbFwZ9ts6H8HtW2PwBUJdGAEPxc6ARHXU1M9aEEM/intro%20case-2-01.jpg</p>
<p><br></p>
</html>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authortechtek
permlinksteempi-is-talking-a-few-possible-solutions-for-blinking-the-led-on-updates-help-needed-curl-steemsql-bash-script-php
categorysteemdev
json_metadata{"tags":["steemdev","programming","technology","linux","php"],"image":["https://steemitimages.com/DQmPVgFkpCHzCW6o43hRionaWouTiB6i9WYWLoYfTQZwmJE/coding-01.jpg","https://steemitimages.com/DQmW4n37BrX94Dv1YNSArxqBVij5zpEeJHr2ssrcuVdZxbf/image.png","https://steemitimages.com/0x0/https://steemitimages.com/DQmVBUmEbFwZ9ts6H8HtW2PwBUJdGAEPxc6ARHXU1M9aEEM/intro%20case-2-01.jpg"],"links":["https://steemit.com/@techtek/comments","https://steemit.com/steemit/@techtek/introducing-steempi-steem-notifications-on-your-tv","https://steemit.com/steemit/@techtek/diy-steempi-case-with-3d-printed-side-panel-and-steem-logo-that-can-light-up"],"app":"steemit/0.1","format":"html"}
created2017-08-13 18:56:27
last_update2017-08-13 20:34:30
depth0
children13
last_payout2017-08-20 18:56:27
cashout_time1969-12-31 23:59:59
total_payout_value75.008 HBD
curator_payout_value24.541 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length6,499
author_reputation28,283,249,927,543
root_title"STEEMPI is Talking! + a few possible solutions for blinking the LED on updates (Help needed Curl/Steemsql/Bash script/PHP)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id11,712,376
net_rshares30,584,076,027,190
author_curate_reward""
vote details (58)
@booster ·
<p>This post has received a 0.98 % upvote from @booster thanks to: @techtek.</p>
properties (22)
authorbooster
permlinkre-techtek-steempi-is-talking-a-few-possible-solutions-for-blinking-the-led-on-updates-help-needed-curl-steemsql-bash-script-php-20170813t221145664z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"drotto/0.0.1"}
created2017-08-13 22:12:00
last_update2017-08-13 22:12:00
depth1
children0
last_payout2017-08-20 22:12:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length81
author_reputation68,767,115,776,562
root_title"STEEMPI is Talking! + a few possible solutions for blinking the LED on updates (Help needed Curl/Steemsql/Bash script/PHP)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id11,724,994
net_rshares0
@boucaron ·
May be you can have a look to [piston-cli](http://cli.piston.rocks/en/develop/), it will probably help you to prototype a few things. Follows the link to the [commands](http://cli.piston.rocks/en/develop/app.html#available-commands).
👍  
properties (23)
authorboucaron
permlinkre-techtek-steempi-is-talking-a-few-possible-solutions-for-blinking-the-led-on-updates-help-needed-curl-steemsql-bash-script-php-20170813t202819470z
categorysteemdev
json_metadata{"tags":["steemdev"],"links":["http://cli.piston.rocks/en/develop/","http://cli.piston.rocks/en/develop/app.html#available-commands"],"app":"steemit/0.1"}
created2017-08-13 20:28:18
last_update2017-08-13 20:28:18
depth1
children8
last_payout2017-08-20 20:28:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length233
author_reputation3,973,467,197,811
root_title"STEEMPI is Talking! + a few possible solutions for blinking the LED on updates (Help needed Curl/Steemsql/Bash script/PHP)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id11,718,293
net_rshares859,767,171
author_curate_reward""
vote details (1)
@boucaron ·
Example: **piston read "@techtek/steempi-is-talking-a-few-possible-solutions-for-blinking-the-led-on-updates-help-needed-curl-steemsql-bash-script-php" --comments**
👍  
properties (23)
authorboucaron
permlinkre-boucaron-re-techtek-steempi-is-talking-a-few-possible-solutions-for-blinking-the-led-on-updates-help-needed-curl-steemsql-bash-script-php-20170813t203243391z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2017-08-13 20:32:42
last_update2017-08-13 20:32:42
depth2
children7
last_payout2017-08-20 20:32:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length164
author_reputation3,973,467,197,811
root_title"STEEMPI is Talking! + a few possible solutions for blinking the LED on updates (Help needed Curl/Steemsql/Bash script/PHP)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id11,718,572
net_rshares838,272,992
author_curate_reward""
vote details (1)
@techtek · (edited)
Thanks for your reply, installation went ok

"pip3 install --user steem-piston"

but when i try to do "piston addkey" it gives this error

pi@raspberrypi:~ $ piston addkey
Traceback (most recent call last):
  File "/usr/local/bin/piston", line 5, in module
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2876, in module
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 449, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 745, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 639, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pycrypto>=2.6.1


When i check the python version its 2.7.9

When i tr to install python 3 it says latest version already installed
👍  
properties (23)
authortechtek
permlinkre-boucaron-re-boucaron-re-techtek-steempi-is-talking-a-few-possible-solutions-for-blinking-the-led-on-updates-help-needed-curl-steemsql-bash-script-php-20170813t212023672z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2017-08-13 21:20:42
last_update2017-08-13 21:39:30
depth3
children6
last_payout2017-08-20 21:20:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length963
author_reputation28,283,249,927,543
root_title"STEEMPI is Talking! + a few possible solutions for blinking the LED on updates (Help needed Curl/Steemsql/Bash script/PHP)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id11,721,713
net_rshares784,537,544
author_curate_reward""
vote details (1)
@khairulmuammar ·
thank you for information friend
👍  
properties (23)
authorkhairulmuammar
permlinkre-techtek-steempi-is-talking-a-few-possible-solutions-for-blinking-the-led-on-updates-help-needed-curl-steemsql-bash-script-php-20170813t222802792z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2017-08-13 22:28:06
last_update2017-08-13 22:28:06
depth1
children0
last_payout2017-08-20 22:28:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length32
author_reputation39,565,193,840,277
root_title"STEEMPI is Talking! + a few possible solutions for blinking the LED on updates (Help needed Curl/Steemsql/Bash script/PHP)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id11,725,951
net_rshares526,607,392
author_curate_reward""
vote details (1)
@stresskiller ·
my first experience with text to speech was on an amiga 500 :)  back in 1987 i think it was.
it looks like a fun project , good luck
properties (22)
authorstresskiller
permlinkre-techtek-steempi-is-talking-a-few-possible-solutions-for-blinking-the-led-on-updates-help-needed-curl-steemsql-bash-script-php-20170815t162007720z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2017-08-15 16:20:06
last_update2017-08-15 16:20:06
depth1
children0
last_payout2017-08-22 16:20:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length132
author_reputation110,298,241,051,603
root_title"STEEMPI is Talking! + a few possible solutions for blinking the LED on updates (Help needed Curl/Steemsql/Bash script/PHP)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id11,894,485
net_rshares0
@techtek · (edited)
Just found this new tutorial in the Steemit chat "steemsql channel" 

The tutorial has a example code to connect to SteemSQL and this works, now again a bit more close to making the notification work! 

Thanks @magicmonk !

https://steemit.com/cn/@magicmonk/php-steemsql-using-php-to-connect-to-the-steemsql-database
👍  
properties (23)
authortechtek
permlinkre-techtek-steempi-is-talking-a-few-possible-solutions-for-blinking-the-led-on-updates-help-needed-curl-steemsql-bash-script-php-20170814t035314453z
categorysteemdev
json_metadata{"tags":["steemdev"],"users":["magicmonk"],"app":"steemit/0.1","links":["https://steemit.com/cn/@magicmonk/php-steemsql-using-php-to-connect-to-the-steemsql-database"]}
created2017-08-14 03:53:33
last_update2017-08-14 03:54:24
depth1
children0
last_payout2017-08-21 03:53:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length316
author_reputation28,283,249,927,543
root_title"STEEMPI is Talking! + a few possible solutions for blinking the LED on updates (Help needed Curl/Steemsql/Bash script/PHP)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id11,744,571
net_rshares343,906,868
author_curate_reward""
vote details (1)