forked from carlossg/heatmiser-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented network search functionality
If a new neo instance is initialized without a host specified, it will start scanning the network for matching devices. If no host specified, the ‘ready’ event will be called on your neo instance to let you know it is done searching.
- Loading branch information
Showing
7 changed files
with
689 additions
and
679 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,63 @@ | ||
var heatmiser = require("../lib/heatmiser"); | ||
|
||
var neo = new heatmiser.Neo("192.168.1.112"); | ||
|
||
neo.on('success', function(data) { | ||
console.log(data); | ||
}); | ||
neo.on('error', function(data) { | ||
console.log(data); | ||
}); | ||
|
||
neo.info(); | ||
neo.statistics(); | ||
|
||
var devices = ['bathroom', 'livingroom']; | ||
|
||
neo.setAway(false, devices); | ||
neo.setStandby(false, devices); | ||
|
||
var comfortLevels = { | ||
"bathroom": { | ||
"monday": { | ||
"wake": ["07:00", 20], | ||
"leave": ["09:00", 16], | ||
"return": ["24:00", 21], | ||
"sleep": ["24:00", 16] | ||
}, | ||
"sunday": { | ||
"wake": ["09:00", 20], | ||
"leave": ["11:00", 16], | ||
"return": ["24:00", 21], | ||
"sleep": ["24:00", 16] | ||
} | ||
}, | ||
"livingroom": { | ||
"monday": { | ||
"wake": ["07:00", 19], | ||
"leave": ["08:30", 16], | ||
"return": ["16:30", 19], | ||
"sleep": ["23:00", 16] | ||
var heatmiser = require( "../lib/heatmiser" ); | ||
|
||
var neo = new heatmiser.Neo(); | ||
neo.on( 'ready', function () { | ||
|
||
neo.on( 'success', function ( data ) { | ||
console.log( data ); | ||
} ); | ||
neo.on( 'error', function ( data ) { | ||
console.log( data ); | ||
} ); | ||
|
||
neo.info(); | ||
neo.statistics(); | ||
|
||
var devices = [ 'bathroom', 'livingroom' ]; | ||
|
||
neo.setAway( false, devices ); | ||
neo.setStandby( false, devices ); | ||
|
||
var comfortLevels = { | ||
"bathroom": { | ||
"monday": { | ||
"wake": [ "07:00", 20 ], | ||
"leave": [ "09:00", 16 ], | ||
"return": [ "24:00", 21 ], | ||
"sleep": [ "24:00", 16 ] | ||
}, | ||
"sunday": { | ||
"wake": [ "09:00", 20 ], | ||
"leave": [ "11:00", 16 ], | ||
"return": [ "24:00", 21 ], | ||
"sleep": [ "24:00", 16 ] | ||
} | ||
}, | ||
"sunday": { | ||
"wake": ["09:00", 19], | ||
"leave": ["10:00", 16], | ||
"return": ["20:00", 19], | ||
"sleep": ["23:00", 16] | ||
"livingroom": { | ||
"monday": { | ||
"wake": [ "07:00", 19 ], | ||
"leave": [ "08:30", 16 ], | ||
"return": [ "16:30", 19 ], | ||
"sleep": [ "23:00", 16 ] | ||
}, | ||
"sunday": { | ||
"wake": [ "09:00", 19 ], | ||
"leave": [ "10:00", 16 ], | ||
"return": [ "20:00", 19 ], | ||
"sleep": [ "23:00", 16 ] | ||
} | ||
} | ||
} | ||
} | ||
|
||
var keys = Object.keys(comfortLevels); | ||
for (var i=0; i<keys.length; i++) { | ||
var name = keys[i]; | ||
neo.setComfortLevels(comfortLevels[name], [name]); | ||
} | ||
var keys = Object.keys( comfortLevels ); | ||
for ( var i = 0; i < keys.length; i++ ) { | ||
var name = keys[ i ]; | ||
neo.setComfortLevels( comfortLevels[ name ], [ name ] ); | ||
} | ||
|
||
var wait = function () { | ||
console.log( "waiting" ); | ||
} | ||
setTimeout( wait, 1000 ); | ||
} ) | ||
|
||
var wait = function() { | ||
console.log("waiting"); | ||
} | ||
setTimeout(wait, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
"use strict"; | ||
|
||
var Wifi = require('./wifi'); | ||
var Neo = require('./neo'); | ||
var Wifi = require( './wifi' ); | ||
var Neo = require( './neo' ); | ||
|
||
module.exports = {Wifi: Wifi, Neo: Neo}; | ||
module.exports = { Wifi: Wifi, Neo: Neo }; |
Oops, something went wrong.