[deconz] fix alert channel (#9441)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K 2020-12-20 13:22:59 +01:00 committed by GitHub
parent 00c73deabd
commit 4f0caf1a1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 8 deletions

View 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` |

View 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;
}

View 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:

View File

@ -25,9 +25,16 @@
</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">

View 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>
@ -110,6 +113,7 @@
<channels>
<channel typeId="color" id="color"/>
<channel typeId="ct" id="color_temperature"/>
<channel id="alert" typeId="alert"></channel>
</channels>
<representation-property>uid</representation-property>
@ -195,9 +199,16 @@
</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">