[deconz] add doorlock support (#8965)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K 2020-11-08 00:55:33 +01:00 committed by GitHub
parent 6616353baa
commit fdebb33059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 4 deletions

View File

@ -29,7 +29,7 @@ These sensors are supported:
| Color Controller | ZBT-Remote-ALL-RGBW | `colorcontrol` |
Additionally lights, window coverings (blinds) and thermostats are supported:
Additionally lights, window coverings (blinds), door locks and thermostats are supported:
| Device type | Resource Type | Thing type |
|--------------------------------------|-----------------------------------------------|-------------------------|
@ -41,6 +41,7 @@ Additionally lights, window coverings (blinds) and thermostats are supported:
| Blind / Window Covering | Window covering device | `windowcovering` |
| Thermostat | ZHAThermostat | `thermostat` |
| Warning Device (Siren) | Warning device | `warningdevice` |
| Door Lock | A remotely operatable door lock | `doorlock` |
Currently only light-groups are supported via the thing-type `lightgroup`.
@ -159,7 +160,8 @@ Other devices support
| brightness | Dimmer | R/W | Brightness of the light | `dimmablelight`, `colortemperaturelight` |
| switch | Switch | R/W | State of a ON/OFF device | `onofflight` |
| color | Color | R/W | Color of an multi-color light | `colorlight`, `extendedcolorlight`, `lightgroup`|
| color_temperature | Number | R/W | Color temperature in kelvin. The value range is determined by each individual light | `colortemperaturelight`, `extendedcolorlight`, `lightgroup` |
| color_temperature | Number | R/W | Color temperature in kelvin. The value range is determined by each individual light | `colortemperaturelight`, `extendedcolorlight`, `lightgroup` |
| lock | Switch | R/W | Lock (ON) or unlock (OFF) the doorlock| `doorlock` |
| position | Rollershutter | R/W | Position of the blind | `windowcovering` |
| heatsetpoint | Number:Temperature | R/W | Target Temperature in °C | `thermostat` |
| valve | Number:Dimensionless | R | Valve position in % | `thermostat` |
@ -213,6 +215,7 @@ Bridge deconz:deconz:homeserver [ host="192.168.0.10", apikey="ABCDEFGHIJ" ] {
alarmsensor basement-alarm "Basement Alarm Sensor" [ id="8", lastSeenPolling=5 ]
dimmablelight livingroom-ceiling "Livingroom Ceiling" [ id="1" ]
lightgroup livingroom "Livingroom" [ id="1" ]
doorlock entrance-door "Door Lock" [ id="20" ]
}
```
@ -227,7 +230,8 @@ Contact Livingroom_Window "Window Livingroom [%s]"
Switch Basement_Water_Leakage "Basement Water Leakage [%s]" { channel="deconz:waterleakagesensor:homeserver:basement-water-leakage:waterleakage" }
Switch Basement_Alarm "Basement Alarm Triggered [%s]" { channel="deconz:alarmsensor:homeserver:basement-alarm:alarm" }
Dimmer Livingroom_Ceiling "Livingroom Ceiling [%d]" <light> { channel="deconz:dimmablelight:homeserver:livingroom-ceiling:brightness" }
Color Livingroom "Livingroom Light Control"
Color Livingroom "Livingroom Light Control" { channel="deconz:lightgroup:homeserver:livingroom:color" }
Switch Entrance_Door "Doorlock" { channel="deconz:doorlock:homeserver:entrance-door:lock" }
```
### Events

View File

@ -62,6 +62,7 @@ public class BindingConstants {
"extendedcolorlight");
public static final ThingTypeUID THING_TYPE_WINDOW_COVERING = new ThingTypeUID(BINDING_ID, "windowcovering");
public static final ThingTypeUID THING_TYPE_WARNING_DEVICE = new ThingTypeUID(BINDING_ID, "warningdevice");
public static final ThingTypeUID THING_TYPE_DOORLOCK = new ThingTypeUID(BINDING_ID, "doorlock");
// groups
public static final ThingTypeUID THING_TYPE_LIGHTGROUP = new ThingTypeUID(BINDING_ID, "lightgroup");
@ -110,6 +111,7 @@ public class BindingConstants {
public static final String CHANNEL_ALERT = "alert";
public static final String CHANNEL_ALL_ON = "all_on";
public static final String CHANNEL_ANY_ON = "any_on";
public static final String CHANNEL_LOCK = "lock";
// Thing configuration
public static final String CONFIG_HOST = "host";

View File

@ -196,6 +196,9 @@ public class ThingDiscoveryService extends AbstractDiscoveryService implements D
case WARNING_DEVICE:
thingTypeUID = THING_TYPE_WARNING_DEVICE;
break;
case DOORLOCK:
thingTypeUID = THING_TYPE_DOORLOCK;
break;
case CONFIGURATION_TOOL:
// ignore configuration tool device
return;

View File

@ -63,7 +63,7 @@ import com.google.gson.Gson;
public class LightThingHandler extends DeconzBaseThingHandler<LightMessage> {
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPE_UIDS = Set.of(THING_TYPE_COLOR_TEMPERATURE_LIGHT,
THING_TYPE_DIMMABLE_LIGHT, THING_TYPE_COLOR_LIGHT, THING_TYPE_EXTENDED_COLOR_LIGHT, THING_TYPE_ONOFF_LIGHT,
THING_TYPE_WINDOW_COVERING, THING_TYPE_WARNING_DEVICE);
THING_TYPE_WINDOW_COVERING, THING_TYPE_WARNING_DEVICE, THING_TYPE_DOORLOCK);
private static final long DEFAULT_COMMAND_EXPIRY_TIME = 250; // in ms
private static final int BRIGHTNESS_DIM_STEP = 26; // ~ 10%
@ -137,6 +137,7 @@ public class LightThingHandler extends DeconzBaseThingHandler<LightMessage> {
return;
}
case CHANNEL_SWITCH:
case CHANNEL_LOCK:
if (command instanceof OnOffType) {
newLightState.on = (command == OnOffType.ON);
} else {
@ -290,6 +291,7 @@ public class LightThingHandler extends DeconzBaseThingHandler<LightMessage> {
updateState(channelId, "alert".equals(newState.alert) ? OnOffType.ON : OnOffType.OFF);
break;
case CHANNEL_SWITCH:
case CHANNEL_LOCK:
if (on != null) {
updateState(channelId, OnOffType.from(on));
}

View File

@ -39,6 +39,7 @@ public enum LightType {
WINDOW_COVERING_DEVICE("Window covering device"),
CONFIGURATION_TOOL("Configuration tool"),
WARNING_DEVICE("Warning device"),
DOORLOCK("Door Lock"),
UNKNOWN("");
private static final Map<String, LightType> MAPPING = Arrays.stream(LightType.values())

View File

@ -13,6 +13,10 @@
<channels>
<channel id="alert" typeId="alert"></channel>
</channels>
<representation-property>uid</representation-property>
<config-description-ref uri="thing-type:deconz:sensor"/>
</thing-type>
<thing-type id="windowcovering">
@ -107,6 +111,21 @@
<config-description-ref uri="thing-type:deconz:light"/>
</thing-type>
<thing-type id="doorlock">
<supported-bridge-type-refs>
<bridge-type-ref id="deconz"/>
</supported-bridge-type-refs>
<label>Doorlock</label>
<description>A doorlock that can be locked (ON) or unlocked (OFF).</description>
<channels>
<channel typeId="lock" id="switch"/>
</channels>
<representation-property>uid</representation-property>
<config-description-ref uri="thing-type:deconz:sensor"/>
</thing-type>
<channel-type id="position">
<item-type>Rollershutter</item-type>
<label>Position</label>
@ -140,4 +159,8 @@
<label>Alert</label>
</channel-type>
<channel-type id="lock">
<item-type>Switch</item-type>
<label>Lock</label>
</channel-type>
</thing:thing-descriptions>