In this repository you'll find useful files that help you develop info-beamer hosted packages.
dev-mode is a rapid development helper tool that allows you to instantly sync a package that you're developing to an info-beamer device.
hosted.py can be used as part of an info-beamer hosted service. Add this file to your package. Inside your python based service import some of the utility objects provided. Example:
from hosted import config, node, device, api
There are more functions that you can call from your service that allow you to, for example, turn the connected screen on/off or reboot the device:
device.turn_screen_off()
You can access all configuration for the current node made
by the user in the config
object like this:
print(config['timezone'])
# or
print(config.timezone)
You can automatically restart your service by calling
config.restart_on_update()
once. If the system detects that the configuration file changed, your service will be terminated and restarted so it can use the new settings.
Additionally there are certain info-beamer provided APIs that you can call. The APIs are experimental right now and more will be added in the future. Stay tuned.
print(api.list()) # gets list of APIs
# call 'weather' API for a location. Behaves like a `requests`
# get request, except the url is set automatically. It returns
# a dict with the API response.
print(api.weather.get(params={'lat': 50, 'lon': 9}))
hosted.lua can be use in an info-beamer
node that needs easier access to the configurations
made by the user. In your node.lua
file, call
util.init_hosted()
once at the top of your script. info-beamer will
look for hosted.lua
, node.json
and package.json
and will automatically parse config.json
for you.
You can then access the configuration in the global
CONFIG
value:
print(CONIFG.timezone)
The mockup hosted.js
allows you to develop
custom ui pages
without pushing your package to info-beamer hosted.
Instead you can create a mockup environment to test
your code locally. See the linked documentation for
more information how all of that works together.