Bugfixes and changes in periodic refresh
* periodic refresh is now optional (minimum 60s) * refresh while cleaning is now 30s * fixed a bug where the robot starts to drive home after some minutes of cleaning
This commit is contained in:
parent
8cb6ecf8a5
commit
e01fb8df28
@ -17,7 +17,8 @@
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* Added periodic refresh of robot state
|
||||
* Added periodic refresh of robot state while cleaning
|
||||
* Added optional periodic refresh of robot state while not cleaning
|
||||
* Improved go to dock switch to be enabled as soon as possible without manual refresh
|
||||
* Improved switches to indicate the time an action lasts
|
||||
* Improved eco mode to not be overwritten by robot state
|
||||
* Improved switches to indicate the time an action needs to complete
|
||||
* Improved eco mode to not be overwritten by robot state update
|
@ -12,6 +12,7 @@ Feel free to leave any feedback [here](https://github.com/naofireblade/homebridg
|
||||
- Enable and disable eco mode
|
||||
- Get battery info
|
||||
- Get dock info
|
||||
- Periodic refresh of robot state
|
||||
|
||||
\* The robot needs to clean for some seconds before he knows where his dock is. After this time the switch to send him home will be automatically available.
|
||||
|
||||
@ -28,7 +29,7 @@ Feel free to leave any feedback [here](https://github.com/naofireblade/homebridg
|
||||
|
||||
Add the following information to your config file. Change the values for name, email and password.
|
||||
|
||||
The parameter **refresh** is optional (default 120 seconds) and adjusts in what interval changes in the robot state will be pushed to homekit (e.g. when starting the robot with the neato app). The minimum is 60 seconds. You can disable this by entering 0.
|
||||
The parameter **refresh** is optional (default off) and adjusts in what interval changes in the robot state will be pushed to homekit (e.g. when starting the robot with the neato app). The minimum refresh time is 60 seconds.
|
||||
|
||||
```json
|
||||
"accessories": [
|
||||
|
16
index.js
16
index.js
@ -27,12 +27,12 @@ function NeatoVacuumRobot(log, config) {
|
||||
this.email = config['email'];
|
||||
this.password = config['password'];
|
||||
|
||||
// default 120s
|
||||
this.refresh = ('refresh' in config ? parseInt(config['refresh']) : 120);
|
||||
// default off
|
||||
this.refresh = ('refresh' in config ? parseInt(config['refresh']) : 0);
|
||||
// must be integer and positive
|
||||
this.refresh = (typeof this.refresh !=='number' || (this.refresh%1)!==0 || this.refresh < 0) ? 0 : this.refresh;
|
||||
// minimum 60s
|
||||
this.refresh = (this.refresh != 0 && this.refresh < 60) ? 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");
|
||||
@ -141,11 +141,7 @@ NeatoVacuumRobot.prototype = {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
// dont allow manual setting the switch to off
|
||||
setTimeout(function() {
|
||||
that.vacuumRobotGoToDockService.setCharacteristic(Characteristic.On, true);
|
||||
callback();
|
||||
},1000);
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -279,8 +275,8 @@ NeatoVacuumRobot.prototype = {
|
||||
// dont update eco, because we cant write that value onto the robot and dont want it to be overwritten in our plugin
|
||||
|
||||
if (that.robot.canPause) {
|
||||
debug("Short timer set: 10s");
|
||||
that.timer = setTimeout(that.getStateTimer.bind(that), 10 * 1000);
|
||||
debug("Short timer set: 30s");
|
||||
that.timer = setTimeout(that.getStateTimer.bind(that), 30 * 1000);
|
||||
}
|
||||
else if (that.refresh != 0) {
|
||||
debug("Long timer set: " + that.refresh + "s");
|
||||
|
Loading…
Reference in New Issue
Block a user