Skip to content

Commit

Permalink
[robonect] Channel for distance from charging station on remote start (
Browse files Browse the repository at this point in the history
…openhab#11137)

New channel "status-distance" that shows the distance of the robot from
its charging station while it is searching for the remote starting point.

Signed-off-by: Stefan Triller <github@stefantriller.de>
  • Loading branch information
t2000 committed Aug 22, 2021
1 parent c70e9b3 commit 19ebdb5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bundles/org.openhab.binding.robonect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ Thing robonect:mower:automower "Mower" @ "Garden" [ host="192.168.2.1", pollInte
|------------------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | String | Retrieves or sets the name of the mower |
| `battery` | Number | Retrieves the current battery status in percent |
| `status-duration` | Number | Retrieves the duration of the current status (see `status`) of the mower |
| `status-duration` | Number | Retrieves the duration of the current status (see `status`) of the mower |
| `status-distance` | Number | Retrieves the distance of the mower from the charging station when searching for the remote starting point |
| `mowing-hours` | Number | Retrieves the number of hours of mowing operation |
| `mode` | String | Retrieves or sets the mode of the mower. Possible values retrieval values are <ul><li>HOME</li><li>AUTO</li><li>MANUAL</li><li>EOD : triggers the "end of day" mode. The mower will switch in to the HOME mode and stay int this mode for the rest of the day. After midnight it will switch back to the mode which was set previously.</li></ul> |
| `status` | Number | Retrieves the current mower status which can be <ul><li>0 : DETECTING_STATUS</li><li>1 : PARKING</li><li>2 : MOWING</li><li>3 : SEARCH_CHARGING_STATION</li><li>4 : CHARGING</li><li>5 : SEARCHING</li><li>6 : UNKNOWN_6</li><li>7 : ERROR_STATUS</li><li>16 : OFF</li><li>17 : SLEEPING</li><li>98 : OFFLINE (Binding cannot connect to mower)</li><li>99 : UNKNOWN</li></ul> |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class RobonectBindingConstants {
public static final String CHANNEL_MOWER_NAME = "name";
public static final String CHANNEL_STATUS_BATTERY = "battery";
public static final String CHANNEL_STATUS_DURATION = "status-duration";
public static final String CHANNEL_STATUS_DISTANCE = "status-distance";
public static final String CHANNEL_STATUS_HOURS = "mowing-hours";
public static final String CHANNEL_STATUS_MODE = "mode";
public static final String CHANNEL_STATUS = "status";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ private void refreshMowerInfo() {
updateState(CHANNEL_STATUS_BATTERY, new DecimalType(info.getStatus().getBattery()));
updateState(CHANNEL_STATUS, new DecimalType(info.getStatus().getStatus().getStatusCode()));
updateState(CHANNEL_STATUS_DURATION, new QuantityType<>(info.getStatus().getDuration(), Units.SECOND));
updateState(CHANNEL_STATUS_DISTANCE, new QuantityType<>(info.getStatus().getDistance(), SIUnits.METRE));
updateState(CHANNEL_STATUS_HOURS, new QuantityType<>(info.getStatus().getHours(), Units.HOUR));
updateState(CHANNEL_STATUS_MODE, new StringType(info.getStatus().getMode().name()));
updateState(CHANNEL_MOWER_START, info.getStatus().isStopped() ? OnOffType.OFF : OnOffType.ON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
* Object holding information from the status section of the mowers status response.
*
*
* @author Marco Meyer - Initial contribution
*/
public class Status {
Expand All @@ -25,6 +25,7 @@ public class Status {
private MowerStatus status;
private MowerMode mode;
private boolean stopped;
private int distance;

/**
* @return - the battery level in percent. (0-100)
Expand All @@ -40,6 +41,13 @@ public int getDuration() {
return duration;
}

/**
* @return - The distance from the charging station (in case it searches the remote starting point)
*/
public int getDistance() {
return distance;
}

/**
* @return - The hours the mower was in use so far.
*/
Expand Down Expand Up @@ -76,6 +84,10 @@ public void setDuration(int duration) {
this.duration = duration;
}

public void setDistance(int distance) {
this.distance = distance;
}

public void setHours(int hours) {
this.hours = hours;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<channel id="start" typeId="startType"/>
<channel id="status" typeId="mowerStatusType"/>
<channel id="status-duration" typeId="durationType"/>
<channel id="status-distance" typeId="distanceType"/>

<channel id="timer-status" typeId="timerStatusType"/>
<channel id="timer-next" typeId="nextTimerType"/>
Expand Down Expand Up @@ -126,6 +127,13 @@
<state readOnly="true" pattern="%d %unit%"/>
</channel-type>

<channel-type id="distanceType">
<item-type>Number:Length</item-type>
<label>Status Distance</label>
<description>The distance the mower is away from the charging station when searching the remote start.</description>
<state readOnly="true" pattern="%d %unit%"/>
</channel-type>

<channel-type id="hoursType">
<item-type>Number:Time</item-type>
<label>Total Mowing Hours</label>
Expand Down

0 comments on commit 19ebdb5

Please sign in to comment.