Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[irobot] Fix password discovery and command sending for Roomba I-Models. (using gson) #10860

Merged
merged 3 commits into from
Jun 18, 2021
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
30 changes: 18 additions & 12 deletions bundles/org.openhab.binding.irobot/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
# iRobot Binding

This binding provides integration of products by iRobot company (https://www.irobot.com/). It is currently developed to support Roomba 900
series robotic vacuum cleaner with built-in Wi-Fi module. The binding interfaces to the robot directly without any need for a dedicated MQTT server.
This binding provides integration of products by iRobot company (https://www.irobot.com/). It is currently developed
to support Roomba vacuum cleaner/mopping robots with built-in Wi-Fi module. The binding interfaces to the robot directly
without any need for a dedicated MQTT server.

## Supported Things

- iRobot Roomba robotic vacuum cleaner (https://www.irobot.com/roomba). The binding has been developed and tested with Roomba 930.
- iRobot Braava has also been reported to (partially) work. Automatic configuration and password retrieval does not work. Add the robot manually as Roomba and use external tools (like Dorita980) in order to retrieve the password.
- iRobot Roomba robotic vacuum cleaner (https://www.irobot.com/roomba).
- iRobot Braava has also been reported to (partially) work.
- In general, the channel list is far from complete. There is a lot to do now.

## Discovery

Roombas on the same network will be discovered automatically, however in order to connect to them a password is needed. The
password is a machine-generated string, which is unfortunately not exposed by the original iRobot smartphone application, but
it can be downloaded from the robot itself. If no password is configured, the Thing enters "CONFIGURATION PENDING" state.
password is a machine-generated string, which is unfortunately not exposed by the original iRobot smartphone application,
but it can be downloaded from the robot itself. If no password is configured, the Thing enters "CONFIGURATION PENDING" state.
Now you need to perform authorization by pressing and holding the HOME button on your robot until it plays series of tones
(approximately 2 seconds). The Wi-Fi indicator on the robot will flash for 30 seconds, the binding should automatically
receive the password and go ONLINE.

After you've done this procedure you can write the password somewhere in case if you need to reconfigure your binding. It's not
known, however, whether the password is eternal or can change during factory reset.
After you've done this procedure you can write the password somewhere in case if you need to reconfigure your binding. It's
not known, however, whether the password is eternal or can change during factory reset.

## Thing Configuration

| Parameter | Type | Required | Default | Description |
| --------- | :-----: | :-------: | :------: | ----------------- |
| ipaddress | String | Yes | | Robot IP address |
| blid | String | No | | Robot ID |
| password | String | No | | Robot Password |

| Parameter | Meaning |
|-----------|----------------------------------------|
| ipaddress | IP address (or hostname) of your robot |
| password | Password for the robot |
All parameters will be autodiscovered. If using textual configuration, then `ipaddress` shall be specified.

## Channels

Expand Down Expand Up @@ -140,11 +144,13 @@ Error codes. Data type is string in order to be able to utilize mapping to human
| 76 | Hardware problem detected |

## Cleaning specific regions

You can clean one or many specific regions of a given map by sending the following String to the command channel:

```
cleanRegions:<pmapId>;<region_id1>,<region_id2>,..
```

The easiest way to determine the pmapId and region_ids is to monitor the last_command channel while starting a new mission for the specific region with the iRobot-App.

## Known Problems / Caveats
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
*/
package org.openhab.binding.irobot.internal;

import javax.net.ssl.TrustManager;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.io.net.http.TrustAllTrustManager;
import org.openhab.core.thing.ThingTypeUID;

/**
Expand All @@ -21,6 +24,7 @@
*
* @author hkuhn42 - Initial contribution
* @author Pavel Fedin - rename and update
* @author Alexander Falkenstern - Add support for I7 series
*/
@NonNullByDefault
public class IRobotBindingConstants {
Expand All @@ -30,6 +34,9 @@ public class IRobotBindingConstants {
// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_ROOMBA = new ThingTypeUID(BINDING_ID, "roomba");

// Something goes wrong...
public static final String UNKNOWN = "UNKNOWN";

// List of all Channel ids
public static final String CHANNEL_COMMAND = "command";
public static final String CHANNEL_CYCLE = "cycle";
Expand Down Expand Up @@ -69,4 +76,12 @@ public class IRobotBindingConstants {
public static final String PASSES_AUTO = "auto";
public static final String PASSES_1 = "1";
public static final String PASSES_2 = "2";

// Connection and config constants
public static final int MQTT_PORT = 8883;
public static final int UDP_PORT = 5678;
public static final TrustManager[] TRUST_MANAGERS = { TrustAllTrustManager.getInstance() };

public static final String ROBOT_BLID = "blid";
public static final String ROBOT_PASSWORD = "password";
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Copyright (c) 2010-2021 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.irobot.internal.config;

import static org.openhab.binding.irobot.internal.IRobotBindingConstants.UNKNOWN;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* The {@link IRobotConfiguration} is a class for IRobot thing configuration
*
* @author Pavel Fedin - Initial contribution
* @author Alexander Falkenstern - Add supported robot type
*/
@NonNullByDefault
public class IRobotConfiguration {
private String ipaddress = UNKNOWN;
private String password = UNKNOWN;
private String blid = UNKNOWN;

public String getIpAddress() {
return ipaddress;
}

public void setIpAddress(final String ipaddress) {
this.ipaddress = ipaddress.trim();
}

public String getPassword() {
return password.isBlank() ? UNKNOWN : password;
}

public void setPassword(final String password) {
this.password = password;
}

public String getBlid() {
return blid.isBlank() ? UNKNOWN : blid;
}

public void setBlid(final String blid) {
this.blid = blid;
}
}
Loading