[robonect] Channel for distance from charging station on remote start (#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>
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -236,6 +236,7 @@ public class RobonectHandler extends BaseThingHandler {
|
||||
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);
|
||||
|
||||
@@ -14,7 +14,7 @@ package org.openhab.binding.robonect.internal.model;
|
||||
|
||||
/**
|
||||
* Object holding information from the status section of the mowers status response.
|
||||
*
|
||||
*
|
||||
* @author Marco Meyer - Initial contribution
|
||||
*/
|
||||
public class Status {
|
||||
@@ -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)
|
||||
@@ -40,6 +41,13 @@ public class Status {
|
||||
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.
|
||||
*/
|
||||
@@ -76,6 +84,10 @@ public class Status {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public void setDistance(int distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public void setHours(int hours) {
|
||||
this.hours = hours;
|
||||
}
|
||||
|
||||
@@ -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"/>
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user