]> git.basschouten.com Git - openhab-addons.git/commitdiff
[OpenUV] Marked the SafeExposure channel as extensible so user can add it via UI...
authorGaël L'hopital <gael@lhopital.org>
Wed, 27 Jan 2021 17:08:29 +0000 (18:08 +0100)
committerGitHub <noreply@github.com>
Wed, 27 Jan 2021 17:08:29 +0000 (09:08 -0800)
Signed-off-by: clinique <gael@lhopital.org>
bundles/org.openhab.binding.openuv/README.md
bundles/org.openhab.binding.openuv/src/main/java/org/openhab/binding/openuv/internal/OpenUVBindingConstants.java
bundles/org.openhab.binding.openuv/src/main/java/org/openhab/binding/openuv/internal/handler/OpenUVReportHandler.java
bundles/org.openhab.binding.openuv/src/main/resources/OH-INF/thing/thing-types.xml

index 7c4ffd6b44762df5f9f866d4b4ccf9ee17adddb2..9887b0bc958cf8ebc1b1beab6a207c3b26065459 100644 (file)
@@ -59,6 +59,8 @@ The OpenUV Report thing that is retrieved has these channels:
 The elevation channel will be used as an input in order to limit API queries to OpenUV. If not used, 
 the binding will not consider it. When value is provided queries will only be issued if the elevation is > 0°.
 
+Thing can be extended with as many SafeExposure channels as needed for each skin type.
+
 ## Examples
 
 demo.things:
index f8ee0fea1e30ef9bdc6f98587f4d6e5694daf988..2bb056ab63f5c2419f1a0909d9562b37476623b5 100644 (file)
@@ -12,9 +12,6 @@
  */
 package org.openhab.binding.openuv.internal;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.Set;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
@@ -50,7 +47,6 @@ public class OpenUVBindingConstants {
     public static final String SAFE_EXPOSURE = "SafeExposure";
     public static final String ELEVATION = "elevation";
 
-    public static final Set<ThingTypeUID> BRIDGE_THING_TYPES_UIDS = Collections.singleton(APIBRIDGE_THING_TYPE);
-    public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<>(
-            Arrays.asList(LOCATION_REPORT_THING_TYPE));
+    public static final Set<ThingTypeUID> BRIDGE_THING_TYPES_UIDS = Set.of(APIBRIDGE_THING_TYPE);
+    public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(LOCATION_REPORT_THING_TYPE);
 }
index af5e68e3b10b0a9d23075f6cb859c140b008f51c..c92d71450519906a3a775555c3f59d687c9e0a6b 100644 (file)
@@ -56,11 +56,11 @@ import org.slf4j.LoggerFactory;
  */
 @NonNullByDefault
 public class OpenUVReportHandler extends BaseThingHandler {
-    private static final DecimalType ALERT_GREEN = DecimalType.ZERO;
-    private static final DecimalType ALERT_YELLOW = new DecimalType(1);
-    private static final DecimalType ALERT_ORANGE = new DecimalType(2);
-    private static final DecimalType ALERT_RED = new DecimalType(3);
-    private static final DecimalType ALERT_PURPLE = new DecimalType(4);
+    private static final State ALERT_GREEN = DecimalType.ZERO;
+    private static final State ALERT_YELLOW = new DecimalType(1);
+    private static final State ALERT_ORANGE = new DecimalType(2);
+    private static final State ALERT_RED = new DecimalType(3);
+    private static final State ALERT_PURPLE = new DecimalType(4);
     private static final State ALERT_UNDEF = HSBType.fromRGB(179, 179, 179);
 
     private static final Map<State, State> ALERT_COLORS = Map.of(ALERT_GREEN, HSBType.fromRGB(85, 139, 47),
index bb0fb87970a693a4b05764aa8a24e3e8a13f3fe9..49b43580e4b28defee026a63f6017644f56ec31a 100644 (file)
        </bridge-type>
 
        <!-- OpenUV Report Thing -->
-       <thing-type id="uvreport">
+       <thing-type id="uvreport" extensible="SafeExposure">
                <supported-bridge-type-refs>
                        <bridge-type-ref id="openuvapi"/>
                </supported-bridge-type-refs>
 
                <label>UV Report</label>
-               <description>
-                       Provides various UV data from the OpenUV Project for a given location.
-               </description>
+               <description>Provides various UV data from the OpenUV Project for a given location.</description>
 
                <channels>
                        <channel id="UVIndex" typeId="UVIndex"/>
                        <channel id="Alert" typeId="Alert"/>
                        <channel id="UVColor" typeId="UVColor"/>
                        <channel id="UVMax" typeId="UVMax"/>
-                       <channel id="UVMaxTime" typeId="UVMaxTime"/>
+                       <channel id="UVMaxTime" typeId="timestamp">
+                               <label>UV Max Time</label>
+                               <description>Max UV Index time (solar noon)</description>
+                       </channel>
                        <channel id="UVMaxEvent" typeId="UVMaxEvent"/>
                        <channel id="Ozone" typeId="Ozone"/>
-                       <channel id="OzoneTime" typeId="OzoneTime"/>
-                       <channel id="UVTime" typeId="UVTime"/>
+                       <channel id="OzoneTime" typeId="timestamp">
+                               <label>Ozone Observation Time</label>
+                               <description>Latest OMI ozone update timestamp.</description>
+                       </channel>
+                       <channel id="UVTime" typeId="timestamp">
+                               <label>Report Timestamp</label>
+                               <description>UV Report timestamp.</description>
+                       </channel>
                        <channel id="SafeExposure" typeId="SafeExposure"/>
                        <channel id="elevation" typeId="elevation"/>
                </channels>
                <state readOnly="true" pattern="%.1f %unit%"/>
        </channel-type>
 
-       <channel-type id="OzoneTime" advanced="true">
-               <item-type>DateTime</item-type>
-               <label>Ozone Observation Time</label>
-               <description>Latest OMI ozone update timestamp.</description>
-               <category>time</category>
-               <state readOnly="true" pattern="%1$tF %1$tR"/>
-       </channel-type>
-
-       <channel-type id="UVMaxTime" advanced="true">
-               <item-type>DateTime</item-type>
-               <label>UV Max Time</label>
-               <description>Max UV Index time (solar noon)</description>
-               <category>time</category>
-               <state readOnly="true" pattern="%1$tF %1$tR"/>
-       </channel-type>
-
-       <channel-type id="UVTime" advanced="true">
+       <channel-type id="timestamp" advanced="true">
                <item-type>DateTime</item-type>
-               <label>Report Timestamp</label>
-               <description>UV Report timestamp.</description>
+               <label>Timestamp</label>
                <category>time</category>
                <state readOnly="true" pattern="%1$tF %1$tR"/>
        </channel-type>