diff --git a/bundles/org.openhab.binding.robonect/README.md b/bundles/org.openhab.binding.robonect/README.md index 4267ae985d020..d411ca988ae32 100644 --- a/bundles/org.openhab.binding.robonect/README.md +++ b/bundles/org.openhab.binding.robonect/README.md @@ -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 | | `status` | Number | Retrieves the current mower status which can be | diff --git a/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/RobonectBindingConstants.java b/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/RobonectBindingConstants.java index 6765feee709ba..fdf7e83a402b6 100644 --- a/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/RobonectBindingConstants.java +++ b/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/RobonectBindingConstants.java @@ -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"; diff --git a/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/handler/RobonectHandler.java b/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/handler/RobonectHandler.java index cbfe2463c8e73..691db3e7c67d8 100644 --- a/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/handler/RobonectHandler.java +++ b/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/handler/RobonectHandler.java @@ -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); diff --git a/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/model/Status.java b/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/model/Status.java index 0487b4f845304..8363736e33d24 100644 --- a/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/model/Status.java +++ b/bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/model/Status.java @@ -14,7 +14,7 @@ /** * 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 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. */ @@ -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; } diff --git a/bundles/org.openhab.binding.robonect/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.robonect/src/main/resources/OH-INF/thing/thing-types.xml index 4b52c88b7b9f9..f296cbed00d62 100644 --- a/bundles/org.openhab.binding.robonect/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.robonect/src/main/resources/OH-INF/thing/thing-types.xml @@ -17,6 +17,7 @@ + @@ -126,6 +127,13 @@ + + Number:Length + + The distance the mower is away from the charging station when searching the remote start. + + + Number:Time