Compare commits
4 Commits
c72ca2daf9
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ce969f637c | |||
| 71d7b4ba19 | |||
| 0860e6d023 | |||
| 1bc736cd01 |
@@ -2,11 +2,36 @@
|
|||||||
|
|
||||||
Controls the welcome room Vestaboard directly, bypassing their cloud.
|
Controls the welcome room Vestaboard directly, bypassing their cloud.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Theory
|
||||||
|
|
||||||
|
Polls URL (https://api.my.protospace.ca/stats/) continuously and looks for
|
||||||
|
changes to the `vestaboard` key. When updated, it replaces any special
|
||||||
|
characters and then displays the message on the sign via serial.
|
||||||
|
|
||||||
|
If you want to use this, just call `send_sign(text)` in protoflap.py directly.
|
||||||
|
|
||||||
|
The split flap controller is connected to serial at `/dev/ttyAMA0`, 38400 baud.
|
||||||
|
|
||||||
|
### See Also
|
||||||
|
|
||||||
|
@Benno1308's reverse engineering:
|
||||||
|
|
||||||
|
https://github.com/EngineOwningSoftware/Vestaboard-Reverse-Engineering
|
||||||
|
|
||||||
|
https://www.reddit.com/r/Vestaboard/comments/tjm93n/local_device_api/
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
|
Download the Vestaboard root private key. It should be the same for all
|
||||||
|
Vestaboards:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ curl https://files.catbox.moe/kvibj6 > ~/.ssh/vestaboard
|
||||||
|
$ chmod 600 ~/.ssh/vestaboard
|
||||||
|
```
|
||||||
|
|
||||||
SSH into the Vestaboard using the root key, ie:
|
SSH into the Vestaboard using the root key, ie:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -44,7 +69,7 @@ Set config to:
|
|||||||
[program:protoflap]
|
[program:protoflap]
|
||||||
user=root
|
user=root
|
||||||
directory=/root/protoflap
|
directory=/root/protoflap
|
||||||
command=/usr/bin/python /root/protoflap/protoflap.py
|
command=/usr/bin/python -u /root/protoflap/protoflap.py
|
||||||
stopsignal=INT
|
stopsignal=INT
|
||||||
stopasgroup=true
|
stopasgroup=true
|
||||||
killasgroup=true
|
killasgroup=true
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 109 KiB |
+13
-4
@@ -1,12 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
print "Boot up..."
|
||||||
|
|
||||||
from vestactrl import setup_digits, board_init_uart
|
from vestactrl import setup_digits, board_init_uart
|
||||||
import textwrap
|
import textwrap
|
||||||
import urllib2
|
import urllib2
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
print "Importing complete."
|
||||||
|
|
||||||
def send_sign(text):
|
def send_sign(text):
|
||||||
"""
|
"""
|
||||||
Wraps and sends text to the Vestaboard.
|
Wraps and sends text to the Vestaboard.
|
||||||
@@ -53,8 +57,10 @@ def poll_and_display():
|
|||||||
url = 'https://api.my.protospace.ca/stats/'
|
url = 'https://api.my.protospace.ca/stats/'
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = urllib2.urlopen(url)
|
response = urllib2.urlopen(url, timeout=5)
|
||||||
data = json.load(response)
|
data = json.load(response)
|
||||||
message = data.get('vestaboard')
|
message = data.get('vestaboard')
|
||||||
|
|
||||||
@@ -63,13 +69,16 @@ def poll_and_display():
|
|||||||
send_sign(message.encode('utf-8'))
|
send_sign(message.encode('utf-8'))
|
||||||
last_message = message
|
last_message = message
|
||||||
|
|
||||||
except (urllib2.URLError, ValueError, KeyError) as e:
|
except KeyboardInterrupt:
|
||||||
|
break
|
||||||
|
except BaseException as e:
|
||||||
print "Error: {}".format(e)
|
print "Error: {}".format(e)
|
||||||
|
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Initialize communication with the board.
|
# Initialize communication with the board.
|
||||||
|
print "Initializing uart..."
|
||||||
board_init_uart()
|
board_init_uart()
|
||||||
|
|
||||||
|
print "Starting polling loop..."
|
||||||
poll_and_display()
|
poll_and_display()
|
||||||
|
|||||||
Reference in New Issue
Block a user