This is the JavaScript scripting documentation for automating your home with the Z-Bus smart home Interface.
The documentation of this API is split into modules:
- the main api for coding in JavaScript
- the api/operators for reactive coding with RxJS
The sources of this API are available on github.com/z-bus/api
The package is available on NPM via @z-bus/api
- You'll need your home to be equipped and hard-wired with a Z-Bus smart home system installation available on z-bus.com.
- You require the Interface smart home server and IoT gateway up and running at your home. It will receive the script and run your automations locally on the device, even without connection to the internet.
- Internet connectivity is however recommended for scripting (albeit it is also possible offline)
- Open the
script
from the menu in Z-Bus Home or refer to home.z-bus.com/script directly. - Enter a "hello world program"
zBus.receive((event) => {
console.log('Hello, device', event.address);
});
- Press the
▶︎
arrow in the upper right. - Press one of your Z-Bus wall buttons. The console will acknowledge each button press:
14.03.2021, 16:09:21 [script] Hello, device 0
- To start scripting your automations, refer to the API documentation – start from the global zBus object
Z-Bus Home supports scripting home automations in standard JavaScript
. This is outstandingly documented and supported by the community, an excellent primer into the scripting language can be found in Mozilla's MDN Web Docs.
Z-Bus Interface runs the JavaScript runtime Node.js 15.3
internally, you'll find a detailed reference in the Node.js Documentation.
The scripting runtime features our open-source library specifically built for Z-Bus smart home system usage via the global variable zBus
. Please refer to the Z-Bus API Documentation for:
- Receiving events from and transmitting commands to the Z-Bus smart home system
- Dimming lights and setting lighting scenes
- Creating central or conditional control flows
- Creating timers, schedules, and presence simulations.