Giter VIP home page Giter VIP logo

vestaboard's Issues

Retreive current layout from board.

Id like to be able to save the text currently displayed on the board.

Im wondering if there is a way to collect and return the data (perhaps in the same format as raw)

Ive checked through the docs, im not sure if theres a way to read back the displayed text. Is there?

Set `Board.raw()` method to validate and add blank lines when necessary

Feature Request

When utilizing the Board.raw() method, the method currently fails when a list of < 6 arrays is provided.

Proposal to add an argument that would allow you to pad the board with the missing rows if a list of length < 6 is provided as an input. Currently developers must plan for this themselves.

Example:

Input (list/array of length 2)

characters = [[69,63,0,69,64,0,69,65,0,69,63,0,69,64,0,69,65,0,69,63,0,69],
[63,0,69,64,0,69,65,0,69,63,0,69,64,0,69,65,0,69,63,0,69,64]]

Suggested update to Board would allow the following:

Board.raw(characters, pad='below') # adds empty lines at the end of the input array
Board.raw(characters, pad='above') # adds empty lines at the beginning of the input array
Board.raw(characters, pad='center') # adds empty lines alternating below => above until length of 6

Changes:

  • Remove lines 54 / 55 in __init__.py where error checking/throwing for this error occurs, and replace with padding logic as above.
  • Add unit tests for padding logic to ensure all edge cases are accounted for

Allow passing in Installable and subscriptionId to Board

I'd like to be able to pass in only Installable and subscriptionId to Board. That would allow me to initialize a Board without having to choose between using self.subscriptionId in Installable or having to provide apiKey, apiSecret and subscriptionId to Board.

String index out of range when converting a line

Describe the bug
When converting a line with vestaboard.Formatter().convertLine() that contains text and bracket-encoded characters exactly the length of the line (22 characters), conversion fails with the message IndexError: string index out of range.

To Reproduce
Steps to reproduce the behavior:

# Create new instance of Formatter:
import vestaboard
fm = vestaboard.Formatter()

# Convert string:
fm.convertLine('THU{0}{0}{0}{0}{0}{0}{63}{64}{65}{66}{67}{68}{69}{0}{0}{0}{0}{0}{0}')
# Fails with 'string index out of range'

Expected behavior
The convertLine() method should convert any input string containing valid characters as long as the string has a length of <= 22. Valid character codes can be found on Vestaboard's Character Code reference page.. convertLine() should return a list of integers once conversion is complete.

Additional context
This bug seems to only affect strings that end with bracket-encoded characters of a single digit. The below line works, for example, and does not throw an error:
fm.convertLine('{0}{0}{0}{0}{0}{0}{63}{64}{65}{66}{67}{68}{69}{0}{0}{0}{0}{0}{0}THU')
Possibility the issue is actually with bracket-encoded characters at the end of the input string, where searching for the closing (matching) bracket would cause an attempted string access at an index which is beyond the length of the string.

Current Workaround
Replace bracket-encoded characters with their actual values - for example, use spaces instead of {0}. Note that when using the vestaboard.Board().post() method, this may not work as Vestaboard's endpoint strips out leading and trailing whitespace when using the .post() method.
Check file vestaboard/formatter.py on line 79 - I believe this is where the error is throwing. There is a check for a closing bracket 2 characters over (a two-digit character code), but when the string ends with a one-digit code, that could cause the error as the formatter will be attempting to access the string at an index beyond the length of the string.

Having a string with a vestaboard char code in brackets breaks .convert()

Describe the bug

Broken
.convert() is broken:

Formatter().convert('{65}N{65}  5 min')

Output:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".venv\lib\site-packages\vestaboard\formatter.py", line 53, in convert
    converted.append(characters[letter])
KeyError: '{'

Working

.convertLine() works:

Formatter().convertLine('{65}N{65}  5 min', justify="left")

Output: '[65, 14, 65, 0, 0, 31, 0, 13, 9, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]'

Creating a board with local ip/key and validateKey=True results in error

Describe the bug
When attempting to create a board with localApi and validateKey, an error message is returned:

.read() is only available when using local API or by using a read/write enabled API key.
Pass "readWrite=True" along with your apiKey to enable readWrite mode.

Steps to reproduce

from vestaboard import Board

try:
    client = Board(localApi={"ip": "10.0.0.100", "key": "someKey"}, validateKey=True)
except Exception as ex:
    print(ex)

Expected behavior
readWrite should not need to be passed for localApi

Update frequency

Hi,
Just a question here… not so much an issue but a question from a potential vestaboard user.
Is it true you can only send out an update to your vestaboard once every 60 seconds?

Vestaboard on Raspian PI OS

Hi Shane again!

I'm still happy with everything and now hanging on the last step to get the simulator work on my raspi with raspian pi os. I didn't get it work in chromium-os or firefox browser. The website comes, the layout of the board is shown but the digits are deep black and do not show anything. The same URL works fine on macOS safari browser.

Did you get it work?

Thanks and take care!
Guenter

Support Local API

Now that Vestaboard has released the Local API, add support to Board class for using the Local API with specialized API key provided by Vestaboard team.

This change should also implement the ability to read messages off the board, now that this is supported, in conjunction with #32.

Local API Docs
Local API Key Request

passing sub_id via vestaboard.Board() is broken

Describe the bug
While attempting to initialize using just vestaboard.Board() and passing in Key, Secret, and SubID, I receive an error.

Calling the installable, and then passing that into the Board() works.

Works:

# Vestaboard
vesta_installable = vestaboard.Installable(VEST_API_KEY, VEST_API_SECRET)
vboard = vestaboard.Board(vesta_installable)
# output
>>> vesta_installable
<vestaboard.Installable object at 0x000002B57EC26970>

Breaks:

# Vestaboard
vboard = vestaboard.Board(VEST_API_KEY, VEST_API_SECRET, VEST_SUB_ID)
Exception has occurred: AttributeError
'str' object has no attribute 'apiKey'
  File "init.py", line 40, in <module>
    vboard = vestaboard.Board(VEST_API_KEY, VEST_API_SECRET, VEST_SUB_ID)

Details
Using VSCode Terminal on windows in a venv w/ Python 3

Remove redundant print statements

Clean up or remove print statements from code - possibly look at switching to an official logging system to allow more verbose calling if needed or desired.

"pad = " format attribute error

The following code has been reliably posting text strings or characters to our vestaboards:

###########################
def postit(payload):
vboard.post(payload)
###########################

process raw characters to Vestaboard

############################
def SendRaw(characters):
vboard.raw(characters, pad='center')

Lately however, the following error is received:

error in SendRaw
vboard.raw(characters, pad = 'center')
TypeError: raw() got an unexpected keyword argument 'pad'

This seemed to occur just about the time Vestaboard launched its VB+ applications. Any related causes here?

Support of vestaboard simulator

Hi SonicRift,

I like your project and the vestaboard at all: Very cool!

And I like to propose to support a way to feed a vestaboard browser based simulator like this: https://simulator.vestaboard.com

Or is that already possible to call that page with or without your API?

Would be very helpful especially for testing.

Many greetings from Germany, we got 50cm of snow....

Thank you for an answer,
best Guenter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.