Open rcoletti116 opened 2 years ago
I will definitely look into this. Additionally you can view your Roomba IP, blid, and password in plugins -> homebridge-iRobot settings -> devices
Nice feature. That definitely makes this request more appealing, and solves the discovery issues of previous plugins.
I have released a beta release with these features. please try it out and let me know if you have any suggestions. PS let me know if you need help installing the beta
Tried the beta. Works at first, but eventually it loses connection to the bot and I get the same flow of errors as in #35. It doesn't recover unless I reboot homebridge. How is the plugin handling local connection to the bot?
It just reconnects after 5 seconds when the Roomba is disconnected which occurs after the Roomba goes offline
async configureRoomba() {
this.roomba = null;
this.accessory.context.connected = false;
this.roomba = new dorita980.Local(this.device.blid, this.device.password, this.device.ip,
this.device.info.ver !== undefined ? parseInt(this.device.info.ver) : 2);
this.roomba.on('connect', () => {
this.accessory.context.connected = true;
this.platform.log.info('Succefully connected to roomba', this.device.name);
}).on('offline', () => {
this.accessory.context.connected = false;
this.platform.log.warn('Roomba', this.device.name, ' went offline, disconnecting...');
this.roomba.end();
//throw new this.platform.api.hap.HapStatusError(this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE);
}).on('close', () => {
this.accessory.context.connected = false;
this.roomba.removeAllListeners();
if (this.shutdown) {
this.platform.log.info('Roomba', this.device.name, 'connection closed');
} else {
this.platform.log.warn('Roomba', this.device.name, ' connection closed, reconnecting in 5 seconds');
setTimeout(() => {
this.platform.log.warn('Attempting To Reconnect To Roomba', this.device.name);
this.configureRoomba();
}, 5000);
//throw new this.platform.api.hap.HapStatusError(this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE);
}
}).on('state', this.updateRoombaState.bind(this));
}
But does it try to hold an open/persistent connection the robot?
From what I see, when it disconnects (reason unknown) it tries to reconnect as seen in the logs, but never actually does. Once you restart homebridge it discovers the device and connects again.
That's the weird part. I'm wondering if it isn't fully disconnecting. I am planning on making it so that if it fails to reconnect it will wait a longer period of time (~5 minutes)
This line is what connects to the robot and connection remains until Roomba goes offline or you call roomba.end()
this.roomba = new dorita980.Local(this.device.blid, this.device.password, this.device.ip,
this.device.info.ver !== undefined ? parseInt(this.device.info.ver) : 2);
I'm still seeing this behavior too and the device isn't really going offline to cause a disconnection. I wonder if the issue here is trying to keep an open connection too long. It shouldn't be necessary.
Older versions of the Roomba plugins offered options for Keep-Alive, time-based polling or on-demand, but those all had their own issues. Keeping an open connection kills the battery. The Roomba2 plugin closes the connection when not in use and utilizes sharing connections when one is already open. Might be worth taking a look. https://github.com/karlvr/homebridge-roomba2/blob/main/src/accessory.ts#L329
Is anyone else using the local mode and have feedback?
I’ve actually been trying to develop a plug-in v3.0 which will only connect to the Roomba’s when requested by HomeKit. It would also take advantage of other Roomba features. Ex. Clean power
The challenge with that approach becomes speed and waiting for the robot to respond. I think there’s a balance to strike.
I’ve toyed with the idea as well of using custom characteristics to get the other features. Then you could use HomeKit as a 100% local replacement.
Is your feature request related to a problem? Please describe:
I think the ability to log in with the iRobot credentials solves a huge usability problem over the other plugin (Roomba2) as users have a hard time using the discovery script to obtain the BLID and Robot password. However, I would like to suggest a hybrid approach that allows for users to be completely disconnected from the cloud account by storing the BLID, Password, and IP in the config.
Describe the solution you'd like:
1) Users who want to rely on cloud sign-in can do so. 2) Perhaps an option in the logs upon discovery can highlight the BLID and Robot Password for users to save. 3) Users who already have the information, or who choose to add it to the config can do so and remove their irobot cloud credentials. 4) If there are config fields for blid, robot password, and ip are blank -> use cloud. If they are present and if cloud credentials are missing, use local only.
A good example of this is the Meross plugin.
Describe alternatives you've considered:
The homebridge-roomba2 plugin is the full-swing alternative. I think there can be a hybrid approach that benefits more users.
Additional context:
Node Version (optional):
No response
NPM Version (optional):
No response
Homebridge Version (optional):
No response
Plugin Version:
2.1.9
Operating System (optional):
No response