]> git.basschouten.com Git - openhab-addons.git/commitdiff
[robonect] Channel for distance from charging station on remote start (#11137)
authorStefan Triller <t2000@users.noreply.github.com>
Sun, 22 Aug 2021 09:45:55 +0000 (11:45 +0200)
committerGitHub <noreply@github.com>
Sun, 22 Aug 2021 09:45:55 +0000 (11:45 +0200)
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>
bundles/org.openhab.binding.robonect/README.md
bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/RobonectBindingConstants.java
bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/handler/RobonectHandler.java
bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/model/Status.java
bundles/org.openhab.binding.robonect/src/main/resources/OH-INF/thing/thing-types.xml

index 4267ae985d0205e3a47ff40b8215622b11a7353f..d411ca988ae32839a77c76800cf7d26aa63cae37 100644 (file)
@@ -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>                                                                                                                                                          |
index 6765feee709ba4fe56ce2ab1ad2e9f13c3562bc9..fdf7e83a402b60be06528a45b4ff02cf59433894 100644 (file)
@@ -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";
index cbfe2463c8e73c552ccdaecb66aed03d07c18752..691db3e7c67d843522c67583403b5629d514b7ba 100644 (file)
@@ -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);
index 0487b4f845304fa057ad9e985e6e1faa3f403173..8363736e33d24b91caf81f79083fedd63c6345c1 100644 (file)
@@ -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;
     }
index 4b52c88b7b9f9df1fca0c2a4fa6982bad97d7118..f296cbed00d628c318585c915f91cd511baccfbc 100644 (file)
@@ -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"/>
                <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>