]> git.basschouten.com Git - openhab-addons.git/commitdiff
[helioseasycontrols] Range checks for bypass dates + documentation fixes (#9117)
authorBernhard Bauer <bern77@gmail.com>
Tue, 24 Nov 2020 03:05:02 +0000 (04:05 +0100)
committerGitHub <noreply@github.com>
Tue, 24 Nov 2020 03:05:02 +0000 (19:05 -0800)
Signed-off-by: Bernhard Bauer <bern77@gmail.com>
bundles/org.openhab.binding.modbus.helioseasycontrols/README.md
bundles/org.openhab.binding.modbus.helioseasycontrols/src/main/java/org/openhab/binding/modbus/helioseasycontrols/internal/HeliosEasyControlsActions.java
bundles/org.openhab.binding.modbus.helioseasycontrols/src/main/java/org/openhab/binding/modbus/helioseasycontrols/internal/HeliosEasyControlsHandler.java

index 86ef6bbdd8c077886b924c7a6a62ef9dd7e8538b..eaaf7b39321591df53a7587a2ff29e39c4f22feb 100644 (file)
@@ -29,7 +29,7 @@ The following channels are supported:
 | Channel                          | Channel Group   | Description                                                                                                                      | Item Type                | RW | 
 | -------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | -- | 
 | sysdate                          | general         | The KWL's system date and time                                                                                                   | DateTime                 | RW | 
-| summerWinter                     | general         | Indicates if summertime or wintertime is active (OFF = wintertime, ON = summertime)                                              | Switch                   | RW | 
+| summerWinter                     | general         | Indicates if summertime or wintertime is active (0 = wintertime, 1 = summertime)                                                 | Number                   | RW | 
 | autoSwUpdate                     | general         | Indicates if automatic software updates are enable                                                                               | Switch                   | RW | 
 | accessHeliosPortal               | general         | Indicates if access to Helios portal is enabled                                                                                  | Switch                   | RW | 
 | minFanStage                      | unitConfig      | Minimum fan stage (0 or 1) (0, 1)                                                                                                | Number                   | RW | 
@@ -39,7 +39,6 @@ The following channels are supported:
 | humidityStopTime                 | humidityControl | Humidity stop time in hours (0-24) (0 - 24 h)                                                                                    | Number:Time              | RW | 
 | co2ControlSetValue               | co2Control      | CO2 control set value (in ppm) (300 - 2000 ppm)                                                                                  | Number:Dimensionless     | RW | 
 | co2ControlSteps                  | co2Control      | CO2 control steps (in ppm) (50 - 400 ppm)                                                                                        | Number:Dimensionless     | RW | 
-| vocControlStatus                 | vocControl      | VOC control status (0 = off, 1 = stepped, 2 = stepless)                                                                          | Number                   | RW | 
 | vocControlSetValue               | vocControl      | VOC control set value (in ppm) (300 - 2000 ppm)                                                                                  | Number:Dimensionless     | RW | 
 | vocControlSteps                  | vocControl      | VOC control steps (in ppm) (50 - 400 ppm)                                                                                        | Number:Dimensionless     | RW | 
 | comfortTemp                      | unitConfig      | Comfort Temperature (10.0 - 25.0 °C)                                                                                             | Number:Temperature       | RW | 
@@ -51,7 +50,7 @@ The following channels are supported:
 | standbyModeFanStage              | operation       | Standby mode fan stage (0 - 4)                                                                                                   | Number                   | RW | 
 | standbyModeRemainingTime         | operation       | Standby mode remaining time (0 - 180 min)                                                                                        | Number:Time              | R  | 
 | standbyModeStatus                | operation       | Standby mode status                                                                                                              | Switch                   | RW | 
-| operatingMode                    | operation       | Operating mode (automatic/manual) (OFF = automatic, ON = manual)                                                                 | Switch                   | RW | 
+| operatingMode                    | operation       | Operating mode (automatic/manual) (0 = automatic, 1 = manual)                                                                    | Number                   | RW | 
 | fanStage                         | operation       | Fan stage (0 - 4)                                                                                                                | Number                   | RW | 
 | percentageFanStage               | operation       | Fan stage in percent (0 - 100 %)                                                                                                 | Number:Dimensionless     | R  | 
 | temperatureOutsideAir            | general         | Ouside air temperature in °C (-27.0 - 9998.9 °C)                                                                                 | Number:Temperature       | R  | 
@@ -104,7 +103,7 @@ The following channels are supported:
 | holidayProgrammeActivationTime   | operation       | Holiday programme activation time in minutes (5 - 300 min)                                                                       | Number:Time              | RW | 
 | runOnTimeVhzNhz                  | unitConfig      | Stopping time preheater/afterheater in seconds (60 - 120 s)                                                                      | Number:Time              | RW | 
 | errorOutputFunction              | unitConfig      | Error output function (collective error or just error) (1 = collective error, 2 = only error)                                    | Number                   | RW | 
-| filterChange                     | unitConfig      | Filter change                                                                                                                    | Switch                   | RW | 
+| filterChange                     | unitConfig      | Filter change (0 = No, 1 = Yes)                                                                                                  | Number                   | RW | 
 | filterChangeInterval             | unitConfig      | Filter change interval in months (1 - 12)                                                                                        | Number                   | RW | 
 | filterChangeRemainingTime        | general         | Filter change remaining time in minutes (1 - 55000 min)                                                                          | Number:Time              | R  | 
 | bypassRoomTemperature            | unitConfig      | Bypass room temperature in °C (10 - 40 °C)                                                                                       | Number:Temperature       | RW | 
@@ -131,6 +130,7 @@ The following channels are supported:
 | bypassFrom                       | unitConfig      | Bypass active from                                                                                                               | DateTime                 | RW | 
 | bypassTo                         | unitConfig      | Bypass active to                                                                                                                 | DateTime                 | RW | 
 
+
 ## Thing Actions
 
 ### Reset Filter Change Timer
@@ -227,6 +227,7 @@ The binding provides the following properties:
 | kwlFtfConfig7                    | Humidity/temperature sensor configuration 7 (1 = only humidity, 2 = only temperature, 3 = combined)                              | 
 | humidityControlStatus            | Humidity control status (0 = off, 1 = stepped, 2 = stepless)                                                                     | 
 | co2ControlStatus                 | CO2 control status (0 = off, 1 = stepped, 2 = stepless)                                                                          | 
+| vocControlStatus                 | VOC control status (0 = off, 1 = stepped, 2 = stepless)                                                                          | 
 | dateFormat                       | Date format (0 = dd.mm.yyyy, 1 = mm.dd.yyyy, 2 = yyyy.mm.dd)                                                                     | 
 | heatExchangerType                | Heat exchanger type (0 = plastic, 1 = aluminium, 2 = enthalpy)                                                                   | 
 | serNo                            | Serial number                                                                                                                    | 
@@ -276,7 +277,6 @@ The binding provides the following properties:
 | sensorConfigKwlFtf8              | Sensor configuration (installed or not) KWL-FTF 8 (OFF = no sensor, ON = sensor installed)                                       | 
 
 
-
 ## Full Example
 
 ### Thing Configuration
index 8efc8bb174c447a2b1f628a781ee6e8c7c22b419..d944c101fb695ce6e6d49b2bf61d7b6dd4becd98 100644 (file)
@@ -51,7 +51,7 @@ public class HeliosEasyControlsActions implements ThingActions {
                 handler.writeValue(variableName, "1");
             }
         } catch (HeliosException e) {
-            logger.warn("Error executing action 'resetFilterChangeTimer': {}", e.getMessage());
+            logger.warn("Error executing action triggering switch for variable {}: {}", variableName, e.getMessage());
         }
     }
 
index 4d0da544e1dd00d38d41d5454b2b3bd274c711cc..f15ba7041888029d7310c52a5fd0f54192cbd79c 100644 (file)
@@ -96,16 +96,44 @@ public class HeliosEasyControlsHandler extends BaseThingHandler {
                                                          // before reading from device
 
     private class BypassDate {
+        private final int[] MONTH_MAX_DAYS = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
         // initialization to avoid issues when updating before all variables were read
         private int month = 1;
         private int day = 1;
 
+        public BypassDate() {
+        }
+
+        public BypassDate(int day, int month) {
+            this.setDay(day);
+            this.setMonth(month);
+        }
+
         public void setMonth(int month) {
-            this.month = month;
+            if (month < 1) {
+                this.month = 1;
+            } else if (month > 12) {
+                this.month = 12;
+            } else {
+                this.month = month;
+            }
+        }
+
+        public int getMonth() {
+            return this.month;
         }
 
         public void setDay(int day) {
-            this.day = day;
+            if (day < 1) {
+                this.day = 1;
+            } else {
+                this.day = Math.min(day, MONTH_MAX_DAYS[month - 1]);
+            }
+        }
+
+        public int getDay() {
+            return this.day;
         }
 
         public DateTimeType toDateTimeType() {
@@ -551,11 +579,14 @@ public class HeliosEasyControlsHandler extends BaseThingHandler {
     }
 
     protected void setBypass(boolean from, int day, int month) {
+        BypassDate bypassDate = new BypassDate(day, month);
         try {
             this.writeValue(from ? HeliosEasyControlsBindingConstants.BYPASS_FROM_DAY
-                    : HeliosEasyControlsBindingConstants.BYPASS_TO_DAY, Integer.toString(day));
-            this.writeValue(from ? HeliosEasyControlsBindingConstants.BYPASS_FROM_MONTH
-                    : HeliosEasyControlsBindingConstants.BYPASS_TO_MONTH, Integer.toString(month));
+                    : HeliosEasyControlsBindingConstants.BYPASS_TO_DAY, Integer.toString(bypassDate.getDay()));
+            this.writeValue(
+                    from ? HeliosEasyControlsBindingConstants.BYPASS_FROM_MONTH
+                            : HeliosEasyControlsBindingConstants.BYPASS_TO_MONTH,
+                    Integer.toString(bypassDate.getMonth()));
         } catch (HeliosException e) {
             logger.warn("{} encountered Exception when trying to set bypass period: {}",
                     HeliosEasyControlsHandler.class.getSimpleName(), e.getMessage());