Improved refresh parameter
This commit is contained in:
parent
36e8496108
commit
8cb6ecf8a5
9
index.js
9
index.js
@ -27,17 +27,12 @@ function NeatoVacuumRobot(log, config) {
|
||||
this.email = config['email'];
|
||||
this.password = config['password'];
|
||||
|
||||
// load refresh time
|
||||
// default 120s
|
||||
this.refresh = ('refresh' in config ? parseInt(config['refresh']) : 120);
|
||||
// must be integer and positive
|
||||
if (typeof this.refresh !=='number' || (this.refresh%1)!==0 || this.refresh < 0) {
|
||||
this.refresh = 0;
|
||||
}
|
||||
this.refresh = (typeof this.refresh !=='number' || (this.refresh%1)!==0 || this.refresh < 0) ? 0 : this.refresh;
|
||||
// minimum 60s
|
||||
if (this.refresh != 0 && this.refresh < 60) {
|
||||
this.refresh = 60;
|
||||
}
|
||||
this.refresh = (this.refresh != 0 && this.refresh < 60) ? 60 : this.refresh;
|
||||
|
||||
this.vacuumRobotCleanService = new Service.Switch(this.name + " Clean", "clean");
|
||||
this.vacuumRobotGoToDockService = new Service.Switch(this.name + " Go to Dock", "goToDock");
|
||||
|
Loading…
Reference in New Issue
Block a user