@gordalina/magic-home
v1.2.0
Published
Magic Home lights controller library with simple API
Downloads
18
Maintainers
Readme
Magic Home
Install
npm install @gordalina/magic-home --save
# or
yarn add @gordalina/magic-home
API
import { Light } from '@gordalina/magic-home'
// this will scan the local network for lights
const devices = await Light.scan();
// this will establish network connection to the light
const light = new Light(devices[0]);
// light methods
await light.on();
await light.off();
await light.color(0xFF, 0, 0); // red
await light.brightness(0xFF, 0, 0, 50); // red with 50% brightness
await light.pattern('red_green_cross_fade', 1);
const patterns = light.patterns();
const state = await light.state();
Debug
You can enable debug environment variable to see what's happening under the hood
by setting the DEBUG
environment variable:
DEBUG=magic-home:*