Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

added network scanning functionality #2

Merged
merged 4 commits into from
Dec 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ results
npm-debug.log
/node_modules/
test/mocha.opts
.idea/*
112 changes: 57 additions & 55 deletions examples/example-neo.js
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);
40 changes: 20 additions & 20 deletions examples/example-wifi.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
var heatmiser = require("../lib/heatmiser");
var heatmiser = require( "../lib/heatmiser" );

var hm = new heatmiser.Wifi("192.168.1.100", 1234);
var hm = new heatmiser.Wifi( "192.168.1.100", 1234 );

hm.on('success', function(data) {
console.log(data);
});
hm.on('error', function(data) {
console.log(data);
});
hm.on( 'success', function ( data ) {
console.log( data );
} );
hm.on( 'error', function ( data ) {
console.log( data );
} );

hm.read_device();

Expand All @@ -17,27 +17,27 @@ var dcb;

// target before hold!
var dcb1 = {
heating: {
target: 20
}
heating: {
target: 20
}
}
var dcb2 = {
heating: {
hold: 5
}
heating: {
hold: 5
}
}

hm.write_device(dcb1);
hm.write_device(dcb2);
hm.write_device( dcb1 );
hm.write_device( dcb2 );

// // set frost mode
dcb = {
runmode: 'frost'
runmode: 'frost'
}
hm.write_device(dcb);
hm.write_device( dcb );

// // set current date and time
dcb = {
time: new Date()
time: new Date()
}
hm.write_device(dcb);
hm.write_device( dcb );
6 changes: 3 additions & 3 deletions lib/heatmiser.js
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 };
Loading