From ee1655e2270a1f76486248b85d3afce535b1f61a Mon Sep 17 00:00:00 2001 From: Erick Hitter <services@ethitter.com> Date: Fri, 16 Dec 2016 19:34:02 -0800 Subject: [PATCH] Begin converting to Flic API --- config-sample.json | 3 ++- index.js | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/config-sample.json b/config-sample.json index 7da2d29..78c9585 100644 --- a/config-sample.json +++ b/config-sample.json @@ -1,5 +1,6 @@ { - "arp_interface": null, + "flicd_ip": "127.0.0.1", + "flicd_port": 5551, "home_assistant_host": "localhost", "home_assistant_port": 8123, "home_assistant_proto": "http", diff --git a/index.js b/index.js index 0c3fd9c..31657f5 100644 --- a/index.js +++ b/index.js @@ -4,15 +4,23 @@ * LIBRARIES */ - -var request = require( 'request' ); +var fliclib = require( './vendor/fliclib-linux-hci/clientlib/nodejs/fliclibNodeJs' ); +var FlicClient = fliclib.FlicClient; +var FlicConnectionChannel = fliclib.FlicConnectionChannel; +var FlicScanner = fliclib.FlicScanner; +var request = require( 'request' ); /** - * CONFIGURATION & EVENT BINDING + * CONFIGURATION & SETUP */ var config = require( './config.json' ); +var client = new FlicClient( config.flicd_ip, config.flicd_port ); + +/** + * BUTTON BINDING + */ Object.keys( config.buttons ).forEach( function( index ) { var buttonConfig = config.buttons[index]; -- GitLab