]> git.basschouten.com Git - openhab-addons.git/commitdiff
[deconz] fix alert channel (#9441)
authorJ-N-K <J-N-K@users.noreply.github.com>
Sun, 20 Dec 2020 12:22:59 +0000 (13:22 +0100)
committerGitHub <noreply@github.com>
Sun, 20 Dec 2020 12:22:59 +0000 (13:22 +0100)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
bundles/org.openhab.binding.deconz/README.md
bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/GroupThingHandler.java
bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/LightThingHandler.java
bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/thing/group-thing-types.xml
bundles/org.openhab.binding.deconz/src/main/resources/OH-INF/thing/light-thing-types.xml

index 62d56d096e93460a781e3238c1b68c1370d4239f..d0a4007e293adfdaba1033b3f848c54cf444ea3a 100644 (file)
@@ -174,7 +174,7 @@ Other devices support
 | valve             | Number:Dimensionless     |     R       | Valve position in %                   | `thermostat`                                    |
 | mode              | String                   |     R/W     | Mode: "auto", "heat" and "off"        | `thermostat`                                    |
 | offset            | Number                   |     R       | Temperature offset for sensor         | `thermostat`                                    |
-| alert             | Switch                   |     R/W     | Turn alerts on/off                    | `warningdevice`, `lightgroup`                   |
+| alert             | String                   |     W       | Turn alerts on. Allowed commands are `none`, `select` (short blinking), `lselect` (long blinking) | `warningdevice`, `lightgroup`, `dimmablelight`, `colorlight`, `extendedcolorlight`, `colortemperaturelight` |
 | all_on            | Switch                   |     R       | All lights in group are on            | `lightgroup`                                    |
 | any_on            | Switch                   |     R       | Any light in group is on              | `lightgroup`                                    |
 | scene             | String                   |     W       | Recall a scene. Allowed commands are set dynamically                                    | `lightgroup`                                    |                  
index bc59ebc3f8473ff8d1a1c6a86295f16f248cef70..1f9386ccaa0311c95f63fdaa6e8054e5fbacabf9 100644 (file)
@@ -76,8 +76,8 @@ public class GroupThingHandler extends DeconzBaseThingHandler {
                 }
                 break;
             case CHANNEL_ALERT:
-                if (command instanceof OnOffType) {
-                    newGroupAction.alert = command == OnOffType.ON ? "alert" : "none";
+                if (command instanceof StringType) {
+                    newGroupAction.alert = command.toString();
                 } else {
                     return;
                 }
index fcacb90fcd372181f830ab16f7a0e184acff2105..d03b4db9bae6045ee181fdff2bbebc0eb2b01445 100644 (file)
@@ -132,8 +132,8 @@ public class LightThingHandler extends DeconzBaseThingHandler {
 
         switch (channelUID.getId()) {
             case CHANNEL_ALERT:
-                if (command instanceof OnOffType) {
-                    newLightState.alert = command == OnOffType.ON ? "alert" : "none";
+                if (command instanceof StringType) {
+                    newLightState.alert = command.toString();
                 } else {
                     return;
                 }
@@ -360,7 +360,10 @@ public class LightThingHandler extends DeconzBaseThingHandler {
 
         switch (channelId) {
             case CHANNEL_ALERT:
-                updateState(channelId, "alert".equals(newState.alert) ? OnOffType.ON : OnOffType.OFF);
+                String alert = newState.alert;
+                if (alert != null) {
+                    updateState(channelId, new StringType(alert));
+                }
                 break;
             case CHANNEL_SWITCH:
             case CHANNEL_LOCK:
index f8b1633f0d5b543601efe90a84de075a27be19d1..f56d300fdc0e65d2a34aee45af95256ee0f60e53 100644 (file)
        </thing-type>
 
        <channel-type id="alert">
-               <item-type>Switch</item-type>
+               <item-type>String</item-type>
                <label>Alert</label>
                <category>Alarm</category>
+               <command>
+                       <options>
+                               <option value="none">No Alarm</option>
+                               <option value="select">Blinking (short time)</option>
+                               <option value="lselect">Blinking (long time)</option>
+                       </options>
+               </command>
        </channel-type>
 
        <channel-type id="all_on">
index 1e576e10f3d7cb47d69756c32463e662397cc868..d9fa43f26efc0bfefcf05c90d3b2b68bb1893331 100644 (file)
@@ -60,6 +60,7 @@
                <category>Lightbulb</category>
                <channels>
                        <channel typeId="brightness" id="brightness"/>
+                       <channel id="alert" typeId="alert"></channel>
                </channels>
 
                <representation-property>uid</representation-property>
@@ -77,6 +78,7 @@
                <channels>
                        <channel typeId="brightness" id="brightness"/>
                        <channel typeId="ct" id="color_temperature"/>
+                       <channel id="alert" typeId="alert"></channel>
                </channels>
 
                <representation-property>uid</representation-property>
@@ -93,6 +95,7 @@
                <category>Lightbulb</category>
                <channels>
                        <channel typeId="color" id="color"/>
+                       <channel id="alert" typeId="alert"></channel>
                </channels>
 
                <representation-property>uid</representation-property>
                <channels>
                        <channel typeId="color" id="color"/>
                        <channel typeId="ct" id="color_temperature"/>
+                       <channel id="alert" typeId="alert"></channel>
                </channels>
 
                <representation-property>uid</representation-property>
        </channel-type>
 
        <channel-type id="alert">
-               <item-type>Switch</item-type>
+               <item-type>String</item-type>
                <label>Alert</label>
                <category>Alarm</category>
+               <command>
+                       <options>
+                               <option value="none">No Alarm</option>
+                               <option value="select">Blinking (short time)</option>
+                               <option value="lselect">Blinking (long time)</option>
+                       </options>
+               </command>
        </channel-type>
 
        <channel-type id="lock">