zwave 0.9.0

A Dart Library for interacting with Z-Wave devices on Linux.


import 'dart:async';

import 'package:logging/logging.dart';
import 'package:zwave/port/rpi_zw_port.dart';
import 'package:zwave/zw_manager.dart';
import 'package:zwave/port/zw_port.dart';

import 'wall_switch.dart';

Future<void> main() async {
  final example = new Example(new RpiZwPort());
  await example.start();
  await example.turnLampOn();
  await new Future.delayed(const Duration(seconds: 2));
  await example.turnLampOff();
  await example.stop();

class Example {
  final ZwPort port;
  final ZwManager manager;

  // Change `9` to the node id of your wall switch or switched outlet
  final lamp = new WallSwitch(9, 'living room', 'lamp');

  Example(this.port) : manager = new ZwManager(port.driver) {

  Future<void> start() async {

    // Update this line with the path to your Z-Wave controller

    final version = await manager.apiLibraryVersion();;

  Future<void> turnLampOn() => lamp.setState(true);
  Future<void> turnLampOff() => lamp.setState(false);

  Future<void> stop() async {
    await port.close();

Logger logger = new Logger('Example');