Documentation / LemmeSee Hub

Installing hub plugins

A hub plugin adds features to the hub itself: its own pages, feeds, states, and API. A plugin is a single Python file, sometimes with a folder of the same name next to it for extra code and files (for example demo.py and demo/). Installing one means copying it into the hub's plugins directory and starting it as a task.

Plugins run inside the hub with the hub's full access to your machine and data. Only install plugins from people you trust, and read the code if you can.

Hub plugins are different from the plugin packages you install on the phone. See Plugins on your phone in the app guide for those. A hub plugin's page may offer to install a phone part for you.

Where plugins go

The plugins directory is set by plugins_path in the hub's config.json. See Configuration. Every .py file in it is offered as a plugin, named after the file.

Installing a plugin

  • Copy the plugin's .py file into the plugins directory, along with its folder if it has one. Keep the file name as it is: it's the plugin's permanent id, used in its permissions, its addresses, and on phones.
  • If the plugin needs extra Python packages, install them for the Python that runs the hub.
  • On the hub's Tasks page, add a task, choose the type Plugin Script, and pick the plugin from the Script list.
  • Fill in the plugin's settings. Plugins that declare settings get a form; anything else goes in the Config (JSON) box.
  • Save with the task enabled. The plugin starts straight away.

The plugin shows up on phones once it has an enabled task, to the users allowed to see it. A plugin marked private needs a plugins.private.<name> grant; see Permissions and grants. Connected phones refresh their plugin list on their own.

You can create the task through the REST API too:

curl -X POST http://localhost:8765/api/tasks \
  -H "X-Access-Key: YOUR_ACCESS_KEY" -H "X-Username: alice" \
  -H "Content-Type: application/json" \
  -d '{"name": "Demo", "type": "plugin", "enabled": true, "config": {"script": "demo"}}'

See Tasks for more on tasks.

Try the Demo plugin

The Demo plugin is a small, complete example: a feed with its own page, a phone control with an action, and a Delivery Screen with a sound and textures. Download it, unzip it into your plugins directory, and add a Plugin Script task for demo. It's also the starting point for writing your own; see Writing a LemmeSee plugin.

Updating a plugin

Copy the new files over the old ones, then restart the plugin's task: click its run button on the Tasks page, or turn it off and on again. The hub loads the new code when the task starts. Your task settings are kept.

Removing a plugin

Delete or disable its task first, then remove its file and folder from the plugins directory. Feeds, states, and pages the plugin published go away when it stops.

When a plugin doesn't start

  • The task shows its last status and message on the Tasks page.
  • The hub's private Plugin Runner feed records each plugin's loads, starts, crashes, and restarts, with the end of the error.
  • Everything the plugin prints goes to logs/plugins/<name>/output.log in the hub folder.
  • A plugin that crashes 10 times within 10 minutes is left stopped and listed on the Diagnostics page. Starting its task again clears that.

See Troubleshooting.