[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
5 changed files with 29 additions and 8 deletions

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">