Skip to content

Developer Guide

Arie J. Godschalk edited this page Nov 15, 2026 · 2 revisions

Developer guide

Home · API · Supported apps

Better Logic Library exposes shared functionality to Homey apps. The betterlogiclibrary npm package is a client/loader; install the BLL Homey app as well. See the package documentation and developer forum.

Install and initialize

npm install betterlogiclibrary

Add the permission to your app manifest, preserving your other permissions:

{
  "permissions": ["homey:app:net.i-dev.betterlogic"]
}

Initialize from your Homey app:

const { BL } = require('betterlogiclibrary');

class ExampleApp extends Homey.App {
  async onInit() {
    await BL.init({ homey: this.homey });
  }
}

To opt a text argument into BLL coding, decode it before using it:

const decodedText = await BL.decode(args.text);

Document which fields you decode and whether BLL is required. In the current client, BL.decode returns the input unchanged when BLL is not ready; BL.express can throw when unavailable. Do not silently assume that an unchanged value was evaluated successfully.

Shared modules

Modules are opt-in. The package documentation demonstrates initializing with modules: ['_', 'math', 'datetime'] to load shared modules, then using BL._ and BL.datetime. The loader also exposes other modules such as number and json. Consult the package documentation and test the version you ship: availability depends on the BLL app and loader versions.

The client supports options including silent, waitTime and required; do not assume that optional decoding and required module loading have the same failure behavior. Handle missing or stopped BLL explicitly for your use case. Only evaluate trusted expressions and be careful with input that will become code. Tell users what happens if BLL is unavailable.

Calling the app API

Homey apps can call BLL through Homey's app API with the permission above. HomeyScript uses a different client interface. Examples and endpoint details are in API. The permission permits communication; it does not automatically decode your app's Flow arguments.

Clone this wiki locally