[deconz] Added channel to enable / disable motion sensor (#9686)

* Added channel to enable / disable motion sensor

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp 2021-01-09 22:53:23 +01:00 committed by GitHub
parent ef87af3712
commit 382ce10a0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 173 additions and 113 deletions

View File

@ -120,37 +120,38 @@ Bridge deconz:deconz:homeserver [ host="192.168.0.10", apikey="ABCDEFGHIJ" ]
The sensor devices support some of the following channels:
| Channel Type ID | Item Type | Access Mode | Description | Thing types |
|-----------------|--------------------------|:-----------:|-------------------------------------------------------------------------------------------|----------------------------------------------|
| presence | Switch | R | Status of presence: `ON` = presence; `OFF` = no-presence | presencesensor |
| last_updated | DateTime | R | Timestamp when the sensor was last updated | all, except daylightsensor |
| last_seen | DateTime | R | Timestamp when the sensor was last seen | all, except daylightsensor |
| power | Number:Power | R | Current power usage in Watts | powersensor, sometimes for consumptionsensor |
| consumption | Number:Energy | R | Current power usage in Watts/Hour | consumptionsensor |
| voltage | Number:ElectricPotential | R | Current voltage in V | some powersensors |
| current | Number:ElectricCurrent | R | Current current in mA | some powersensors |
| button | Number | R | Last pressed button id on a switch | switch, colorcontrol |
| gesture | Number | R | A gesture that was performed with the switch | switch |
| lightlux | Number:Illuminance | R | Current light illuminance in Lux | lightsensor |
| light_level | Number | R | Current light level | lightsensor |
| dark | Switch | R | Light level is below the darkness threshold | lightsensor, sometimes for presencesensor |
| daylight | Switch | R | Light level is above the daylight threshold | lightsensor |
| temperature | Number:Temperature | R | Current temperature in ˚C | temperaturesensor, some Xiaomi sensors,thermostat|
| humidity | Number:Dimensionless | R | Current humidity in % | humiditysensor |
| pressure | Number:Pressure | R | Current pressure in hPa | pressuresensor |
| open | Contact | R | Status of contacts: `OPEN`; `CLOSED` | openclosesensor |
| waterleakage | Switch | R | Status of water leakage: `ON` = water leakage detected; `OFF` = no water leakage detected | waterleakagesensor |
| fire | Switch | R | Status of a fire: `ON` = fire was detected; `OFF` = no fire detected | firesensor |
| alarm | Switch | R | Status of an alarm: `ON` = alarm was triggered; `OFF` = no alarm | alarmsensor |
| tampered | Switch | R | Status of a zone: `ON` = zone is being tampered; `OFF` = zone is not tampered | any IAS sensor |
| vibration | Switch | R | Status of vibration: `ON` = vibration was detected; `OFF` = no vibration | alarmsensor |
| light | String | R | Light level: `Daylight`; `Sunset`; `Dark` | daylightsensor |
| value | Number | R | Sun position: `130` = dawn; `140` = sunrise; `190` = sunset; `210` = dusk | daylightsensor |
| battery_level | Number | R | Battery level (in %) | any battery-powered sensor |
| battery_low | Switch | R | Battery level low: `ON`; `OFF` | any battery-powered sensor |
| carbonmonoxide | Switch | R | `ON` = carbon monoxide detected | carbonmonoxide |
| color | Color | R | Color set by remote | colorcontrol |
| windowopen | Contact | R | `windowopen` status is reported by some thermostats | thermostat |
| Channel Type ID | Item Type | Access Mode | Description | Thing types |
|-----------------|--------------------------|-------------|-------------------------------------------------------------------------------------------|---------------------------------------------------|
| presence | Switch | R | Status of presence: `ON` = presence; `OFF` = no-presence | presencesensor |
| enabled | Switch | R/W | This channel activates or deactivates the sensor | presencesensor |
| last_updated | DateTime | R | Timestamp when the sensor was last updated | all, except daylightsensor |
| last_seen | DateTime | R | Timestamp when the sensor was last seen | all, except daylightsensor |
| power | Number:Power | R | Current power usage in Watts | powersensor, sometimes for consumptionsensor |
| consumption | Number:Energy | R | Current power usage in Watts/Hour | consumptionsensor |
| voltage | Number:ElectricPotential | R | Current voltage in V | some powersensors |
| current | Number:ElectricCurrent | R | Current current in mA | some powersensors |
| button | Number | R | Last pressed button id on a switch | switch, colorcontrol |
| gesture | Number | R | A gesture that was performed with the switch | switch |
| lightlux | Number:Illuminance | R | Current light illuminance in Lux | lightsensor |
| light_level | Number | R | Current light level | lightsensor |
| dark | Switch | R | Light level is below the darkness threshold | lightsensor, sometimes for presencesensor |
| daylight | Switch | R | Light level is above the daylight threshold | lightsensor |
| temperature | Number:Temperature | R | Current temperature in ˚C | temperaturesensor, some Xiaomi sensors,thermostat |
| humidity | Number:Dimensionless | R | Current humidity in % | humiditysensor |
| pressure | Number:Pressure | R | Current pressure in hPa | pressuresensor |
| open | Contact | R | Status of contacts: `OPEN`; `CLOSED` | openclosesensor |
| waterleakage | Switch | R | Status of water leakage: `ON` = water leakage detected; `OFF` = no water leakage detected | waterleakagesensor |
| fire | Switch | R | Status of a fire: `ON` = fire was detected; `OFF` = no fire detected | firesensor |
| alarm | Switch | R | Status of an alarm: `ON` = alarm was triggered; `OFF` = no alarm | alarmsensor |
| tampered | Switch | R | Status of a zone: `ON` = zone is being tampered; `OFF` = zone is not tampered | any IAS sensor |
| vibration | Switch | R | Status of vibration: `ON` = vibration was detected; `OFF` = no vibration | alarmsensor |
| light | String | R | Light level: `Daylight`; `Sunset`; `Dark` | daylightsensor |
| value | Number | R | Sun position: `130` = dawn; `140` = sunrise; `190` = sunset; `210` = dusk | daylightsensor |
| battery_level | Number | R | Battery level (in %) | any battery-powered sensor |
| battery_low | Switch | R | Battery level low: `ON`; `OFF` | any battery-powered sensor |
| carbonmonoxide | Switch | R | `ON` = carbon monoxide detected | carbonmonoxide |
| color | Color | R | Color set by remote | colorcontrol |
| windowopen | Contact | R | `windowopen` status is reported by some thermostats | thermostat |
**NOTE:** Beside other non mandatory channels, the `battery_level` and `battery_low` channels will be added to the Thing during runtime if the sensor is battery-powered.
The specification of your sensor depends on the deCONZ capabilities.

View File

@ -70,6 +70,7 @@ public class BindingConstants {
// sensor channel ids
public static final String CHANNEL_PRESENCE = "presence";
public static final String CHANNEL_ENABLED = "enabled";
public static final String CHANNEL_LAST_UPDATED = "last_updated";
public static final String CHANNEL_LAST_SEEN = "last_seen";
public static final String CHANNEL_POWER = "power";

View File

@ -39,6 +39,6 @@ public class SensorConfig {
@Override
public String toString() {
return "SensorConfig{" + "on=" + on + ", reachable=" + reachable + ", battery=" + battery + ", temperature="
+ temperature + ", heatsetpoint=" + heatsetpoint + ", mode=" + mode + ", offset=" + offset + '}';
+ temperature + ", heatsetpoint=" + heatsetpoint + ", mode=" + mode + ", offset=" + offset + "}";
}
}

View File

@ -0,0 +1,26 @@
/**
* Copyright (c) 2010-2021 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.deconz.internal.dto;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
/**
* The {@link SensorUpdateConfig} is send to the Rest API to configure presence sensors.
*
* @author Christoph Weitkamp - Initial contribution
*/
@NonNullByDefault
public class SensorUpdateConfig {
public @Nullable Boolean on;
}

View File

@ -17,12 +17,12 @@ import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.deconz.internal.types.ThermostatMode;
/**
* The {@link ThermostatConfig} is send to the Rest API to configure Thermostat.
* The {@link ThermostatUpdateConfig} is send to the Rest API to configure Thermostat.
*
* @author Lukas Agethen - Initial contribution
*/
@NonNullByDefault
public class ThermostatConfig {
public class ThermostatUpdateConfig {
public @Nullable Integer heatsetpoint;
public @Nullable ThermostatMode mode;
public @Nullable Integer offset;

View File

@ -24,7 +24,12 @@ import org.openhab.binding.deconz.internal.dto.DeconzBaseMessage;
import org.openhab.binding.deconz.internal.netutils.WebSocketConnection;
import org.openhab.binding.deconz.internal.netutils.WebSocketMessageListener;
import org.openhab.binding.deconz.internal.types.ResourceType;
import org.openhab.core.thing.*;
import org.openhab.core.thing.Bridge;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
import org.openhab.core.thing.ThingStatusDetail;
import org.openhab.core.thing.ThingStatusInfo;
import org.openhab.core.thing.binding.BaseThingHandler;
import org.openhab.core.types.Command;
import org.slf4j.Logger;

View File

@ -121,17 +121,14 @@ public abstract class SensorBaseThingHandler extends DeconzBaseThingHandler {
return;
}
if (!sensorConfig.on) {
updateStatus(ThingStatus.OFFLINE);
return;
}
Map<String, String> editProperties = editProperties();
editProperties.put(UNIQUE_ID, sensorMessage.uniqueid);
editProperties.put(Thing.PROPERTY_FIRMWARE_VERSION, sensorMessage.swversion);
editProperties.put(Thing.PROPERTY_VENDOR, sensorMessage.manufacturername);
editProperties.put(Thing.PROPERTY_MODEL_ID, sensorMessage.modelid);
ignoreConfigurationUpdate = true;
updateProperties(editProperties);
// Some sensors support optional channels
@ -228,16 +225,16 @@ public abstract class SensorBaseThingHandler extends DeconzBaseThingHandler {
/**
* Update channel value from {@link SensorState} object - override to include further channels
*
* @param channelID
* @param channelUID
* @param newState
* @param initializing
*/
protected void valueUpdated(String channelID, SensorState newState, boolean initializing) {
switch (channelID) {
protected void valueUpdated(ChannelUID channelUID, SensorState newState, boolean initializing) {
switch (channelUID.getId()) {
case CHANNEL_LAST_UPDATED:
String lastUpdated = newState.lastupdated;
if (lastUpdated != null && !"none".equals(lastUpdated)) {
updateState(channelID, Util.convertTimestampToDateTime(lastUpdated));
updateState(channelUID, Util.convertTimestampToDateTime(lastUpdated));
}
break;
default:
@ -271,31 +268,32 @@ public abstract class SensorBaseThingHandler extends DeconzBaseThingHandler {
protected void updateChannels(SensorState newState, boolean initializing) {
sensorState = newState;
thing.getChannels().forEach(channel -> valueUpdated(channel.getUID().getId(), newState, initializing));
thing.getChannels().forEach(channel -> valueUpdated(channel.getUID(), newState, initializing));
}
protected void updateSwitchChannel(String channelID, @Nullable Boolean value) {
protected void updateSwitchChannel(ChannelUID channelUID, @Nullable Boolean value) {
if (value == null) {
return;
}
updateState(channelID, OnOffType.from(value));
updateState(channelUID, OnOffType.from(value));
}
protected void updateDecimalTypeChannel(String channelID, @Nullable Number value) {
protected void updateDecimalTypeChannel(ChannelUID channelUID, @Nullable Number value) {
if (value == null) {
return;
}
updateState(channelID, new DecimalType(value.longValue()));
updateState(channelUID, new DecimalType(value.longValue()));
}
protected void updateQuantityTypeChannel(String channelID, @Nullable Number value, Unit<?> unit) {
updateQuantityTypeChannel(channelID, value, unit, 1.0);
protected void updateQuantityTypeChannel(ChannelUID channelUID, @Nullable Number value, Unit<?> unit) {
updateQuantityTypeChannel(channelUID, value, unit, 1.0);
}
protected void updateQuantityTypeChannel(String channelID, @Nullable Number value, Unit<?> unit, double scaling) {
protected void updateQuantityTypeChannel(ChannelUID channelUID, @Nullable Number value, Unit<?> unit,
double scaling) {
if (value == null) {
return;
}
updateState(channelID, new QuantityType<>(value.doubleValue() * scaling, unit));
updateState(channelUID, new QuantityType<>(value.doubleValue() * scaling, unit));
}
}

View File

@ -26,7 +26,11 @@ import javax.measure.quantity.Temperature;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.deconz.internal.dto.*;
import org.openhab.binding.deconz.internal.dto.DeconzBaseMessage;
import org.openhab.binding.deconz.internal.dto.SensorConfig;
import org.openhab.binding.deconz.internal.dto.SensorMessage;
import org.openhab.binding.deconz.internal.dto.SensorState;
import org.openhab.binding.deconz.internal.dto.ThermostatUpdateConfig;
import org.openhab.binding.deconz.internal.types.ThermostatMode;
import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.OpenClosedType;
@ -76,12 +80,11 @@ public class SensorThermostatThingHandler extends SensorBaseThingHandler {
public void handleCommand(ChannelUID channelUID, Command command) {
if (command instanceof RefreshType) {
sensorState.buttonevent = null;
valueUpdated(channelUID.getId(), sensorState, false);
valueUpdated(channelUID, sensorState, false);
return;
}
ThermostatConfig newConfig = new ThermostatConfig();
String channelId = channelUID.getId();
switch (channelId) {
ThermostatUpdateConfig newConfig = new ThermostatUpdateConfig();
switch (channelUID.getId()) {
case CHANNEL_HEATSETPOINT:
Integer newHeatsetpoint = getTemperatureFromCommand(command);
if (newHeatsetpoint == null) {
@ -131,13 +134,12 @@ public class SensorThermostatThingHandler extends SensorBaseThingHandler {
super.valueUpdated(channelUID, newConfig);
ThermostatMode thermostatMode = newConfig.mode;
String mode = thermostatMode != null ? thermostatMode.name() : ThermostatMode.UNKNOWN.name();
String channelID = channelUID.getId();
switch (channelID) {
switch (channelUID.getId()) {
case CHANNEL_HEATSETPOINT:
updateQuantityTypeChannel(channelID, newConfig.heatsetpoint, CELSIUS, 1.0 / 100);
updateQuantityTypeChannel(channelUID, newConfig.heatsetpoint, CELSIUS, 1.0 / 100);
break;
case CHANNEL_TEMPERATURE_OFFSET:
updateQuantityTypeChannel(channelID, newConfig.offset, CELSIUS, 1.0 / 100);
updateQuantityTypeChannel(channelUID, newConfig.offset, CELSIUS, 1.0 / 100);
break;
case CHANNEL_THERMOSTAT_MODE:
updateState(channelUID, new StringType(mode));
@ -146,19 +148,19 @@ public class SensorThermostatThingHandler extends SensorBaseThingHandler {
}
@Override
protected void valueUpdated(String channelID, SensorState newState, boolean initializing) {
super.valueUpdated(channelID, newState, initializing);
switch (channelID) {
protected void valueUpdated(ChannelUID channelUID, SensorState newState, boolean initializing) {
super.valueUpdated(channelUID, newState, initializing);
switch (channelUID.getId()) {
case CHANNEL_TEMPERATURE:
updateQuantityTypeChannel(channelID, newState.temperature, CELSIUS, 1.0 / 100);
updateQuantityTypeChannel(channelUID, newState.temperature, CELSIUS, 1.0 / 100);
break;
case CHANNEL_VALVE_POSITION:
updateQuantityTypeChannel(channelID, newState.valve, PERCENT, 100.0 / 255);
updateQuantityTypeChannel(channelUID, newState.valve, PERCENT, 100.0 / 255);
break;
case CHANNEL_WINDOWOPEN:
String open = newState.windowopen;
if (open != null) {
updateState(channelID, "Closed".equals(open) ? OpenClosedType.CLOSED : OpenClosedType.OPEN);
updateState(channelUID, "Closed".equals(open) ? OpenClosedType.CLOSED : OpenClosedType.OPEN);
}
break;
}

View File

@ -17,14 +17,16 @@ import static org.openhab.core.library.unit.MetricPrefix.*;
import static org.openhab.core.library.unit.SIUnits.*;
import static org.openhab.core.library.unit.Units.*;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.deconz.internal.dto.*;
import org.openhab.binding.deconz.internal.dto.SensorConfig;
import org.openhab.binding.deconz.internal.dto.SensorState;
import org.openhab.binding.deconz.internal.dto.SensorUpdateConfig;
import org.openhab.core.library.types.HSBType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.OpenClosedType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.types.StringType;
@ -60,8 +62,8 @@ public class SensorThingHandler extends SensorBaseThingHandler {
THING_TYPE_ALARM_SENSOR, THING_TYPE_VIBRATION_SENSOR, THING_TYPE_BATTERY_SENSOR,
THING_TYPE_CARBONMONOXIDE_SENSOR, THING_TYPE_COLOR_CONTROL);
private static final List<String> CONFIG_CHANNELS = Arrays.asList(CHANNEL_BATTERY_LEVEL, CHANNEL_BATTERY_LOW,
CHANNEL_TEMPERATURE);
private static final List<String> CONFIG_CHANNELS = List.of(CHANNEL_BATTERY_LEVEL, CHANNEL_BATTERY_LOW,
CHANNEL_ENABLED, CHANNEL_TEMPERATURE);
public SensorThingHandler(Thing thing, Gson gson) {
super(thing, gson);
@ -69,21 +71,31 @@ public class SensorThingHandler extends SensorBaseThingHandler {
@Override
public void handleCommand(ChannelUID channelUID, Command command) {
if (!(command instanceof RefreshType)) {
if (command instanceof RefreshType) {
sensorState.buttonevent = null;
valueUpdated(channelUID, sensorState, false);
return;
}
sensorState.buttonevent = null;
valueUpdated(channelUID.getId(), sensorState, false);
switch (channelUID.getId()) {
case CHANNEL_ENABLED:
if (command instanceof OnOffType) {
SensorUpdateConfig newConfig = new SensorUpdateConfig();
newConfig.on = OnOffType.ON.equals(command);
sendCommand(newConfig, command, channelUID, null);
}
break;
}
}
@Override
protected void valueUpdated(ChannelUID channelUID, SensorConfig newConfig) {
super.valueUpdated(channelUID, newConfig);
Float temperature = newConfig.temperature;
switch (channelUID.getId()) {
case CHANNEL_ENABLED:
updateState(channelUID, OnOffType.from(newConfig.on));
break;
case CHANNEL_TEMPERATURE:
Float temperature = newConfig.temperature;
if (temperature != null) {
updateState(channelUID, new QuantityType<>(temperature / 100, CELSIUS));
}
@ -92,114 +104,114 @@ public class SensorThingHandler extends SensorBaseThingHandler {
}
@Override
protected void valueUpdated(String channelID, SensorState newState, boolean initializing) {
super.valueUpdated(channelID, newState, initializing);
switch (channelID) {
protected void valueUpdated(ChannelUID channelUID, SensorState newState, boolean initializing) {
super.valueUpdated(channelUID, newState, initializing);
switch (channelUID.getId()) {
case CHANNEL_BATTERY_LEVEL:
updateDecimalTypeChannel(channelID, newState.battery);
updateDecimalTypeChannel(channelUID, newState.battery);
break;
case CHANNEL_LIGHT:
Boolean dark = newState.dark;
if (dark != null) {
Boolean daylight = newState.daylight;
if (dark) { // if it's dark, it's dark ;)
updateState(channelID, new StringType("Dark"));
updateState(channelUID, new StringType("Dark"));
} else if (daylight != null) { // if its not dark, it might be between darkness and daylight
if (daylight) {
updateState(channelID, new StringType("Daylight"));
updateState(channelUID, new StringType("Daylight"));
} else {
updateState(channelID, new StringType("Sunset"));
updateState(channelUID, new StringType("Sunset"));
}
} else { // if no daylight value is known, we assume !dark means daylight
updateState(channelID, new StringType("Daylight"));
updateState(channelUID, new StringType("Daylight"));
}
}
break;
case CHANNEL_POWER:
updateQuantityTypeChannel(channelID, newState.power, WATT);
updateQuantityTypeChannel(channelUID, newState.power, WATT);
break;
case CHANNEL_CONSUMPTION:
updateQuantityTypeChannel(channelID, newState.consumption, WATT_HOUR);
updateQuantityTypeChannel(channelUID, newState.consumption, WATT_HOUR);
break;
case CHANNEL_VOLTAGE:
updateQuantityTypeChannel(channelID, newState.voltage, VOLT);
updateQuantityTypeChannel(channelUID, newState.voltage, VOLT);
break;
case CHANNEL_CURRENT:
updateQuantityTypeChannel(channelID, newState.current, MILLI(AMPERE));
updateQuantityTypeChannel(channelUID, newState.current, MILLI(AMPERE));
break;
case CHANNEL_LIGHT_LUX:
updateQuantityTypeChannel(channelID, newState.lux, LUX);
updateQuantityTypeChannel(channelUID, newState.lux, LUX);
break;
case CHANNEL_COLOR:
final double @Nullable [] xy = newState.xy;
if (xy != null && xy.length == 2) {
updateState(channelID, HSBType.fromXY((float) xy[0], (float) xy[1]));
updateState(channelUID, HSBType.fromXY((float) xy[0], (float) xy[1]));
}
break;
case CHANNEL_LIGHT_LEVEL:
updateDecimalTypeChannel(channelID, newState.lightlevel);
updateDecimalTypeChannel(channelUID, newState.lightlevel);
break;
case CHANNEL_DARK:
updateSwitchChannel(channelID, newState.dark);
updateSwitchChannel(channelUID, newState.dark);
break;
case CHANNEL_DAYLIGHT:
updateSwitchChannel(channelID, newState.daylight);
updateSwitchChannel(channelUID, newState.daylight);
break;
case CHANNEL_TEMPERATURE:
updateQuantityTypeChannel(channelID, newState.temperature, CELSIUS, 1.0 / 100);
updateQuantityTypeChannel(channelUID, newState.temperature, CELSIUS, 1.0 / 100);
break;
case CHANNEL_HUMIDITY:
updateQuantityTypeChannel(channelID, newState.humidity, PERCENT, 1.0 / 100);
updateQuantityTypeChannel(channelUID, newState.humidity, PERCENT, 1.0 / 100);
break;
case CHANNEL_PRESSURE:
updateQuantityTypeChannel(channelID, newState.pressure, HECTO(PASCAL));
updateQuantityTypeChannel(channelUID, newState.pressure, HECTO(PASCAL));
break;
case CHANNEL_PRESENCE:
updateSwitchChannel(channelID, newState.presence);
updateSwitchChannel(channelUID, newState.presence);
break;
case CHANNEL_VALUE:
updateDecimalTypeChannel(channelID, newState.status);
updateDecimalTypeChannel(channelUID, newState.status);
break;
case CHANNEL_OPENCLOSE:
Boolean open = newState.open;
if (open != null) {
updateState(channelID, open ? OpenClosedType.OPEN : OpenClosedType.CLOSED);
updateState(channelUID, open ? OpenClosedType.OPEN : OpenClosedType.CLOSED);
}
break;
case CHANNEL_WATERLEAKAGE:
updateSwitchChannel(channelID, newState.water);
updateSwitchChannel(channelUID, newState.water);
break;
case CHANNEL_FIRE:
updateSwitchChannel(channelID, newState.fire);
updateSwitchChannel(channelUID, newState.fire);
break;
case CHANNEL_ALARM:
updateSwitchChannel(channelID, newState.alarm);
updateSwitchChannel(channelUID, newState.alarm);
break;
case CHANNEL_TAMPERED:
updateSwitchChannel(channelID, newState.tampered);
updateSwitchChannel(channelUID, newState.tampered);
break;
case CHANNEL_VIBRATION:
updateSwitchChannel(channelID, newState.vibration);
updateSwitchChannel(channelUID, newState.vibration);
break;
case CHANNEL_CARBONMONOXIDE:
updateSwitchChannel(channelID, newState.carbonmonoxide);
updateSwitchChannel(channelUID, newState.carbonmonoxide);
break;
case CHANNEL_BUTTON:
updateDecimalTypeChannel(channelID, newState.buttonevent);
updateDecimalTypeChannel(channelUID, newState.buttonevent);
break;
case CHANNEL_BUTTONEVENT:
Integer buttonevent = newState.buttonevent;
if (buttonevent != null && !initializing) {
triggerChannel(channelID, String.valueOf(buttonevent));
triggerChannel(channelUID, String.valueOf(buttonevent));
}
break;
case CHANNEL_GESTURE:
updateDecimalTypeChannel(channelID, newState.gesture);
updateDecimalTypeChannel(channelUID, newState.gesture);
break;
case CHANNEL_GESTUREEVENT:
Integer gesture = newState.gesture;
if (gesture != null && !initializing) {
triggerChannel(channelID, String.valueOf(gesture));
triggerChannel(channelUID, String.valueOf(gesture));
}
break;
}

View File

@ -41,8 +41,8 @@
</parameter>
<parameter name="lastSeenPolling" type="integer" min="0" unit="min">
<label>LastSeen Poll Interval</label>
<description>Interval to poll the deCONZ Gateway for this sensor's "lastSeen" channel. Polling is disabled when set
to 1440 (once per day).</description>
<description>Interval to poll the deCONZ Gateway for this sensor's "last_seen" channel. Polling is disabled when set
to 0 (default: 1440, once per day).</description>
<default>1440</default>
</parameter>
</config-description>

View File

@ -2,3 +2,17 @@
binding.deconz.name = Dresden Elektronik deCONZ Binding
binding.deconz.description = Unterstützt die Raspbee und Conbee Zigbee Dongles via deCONZ
thing-type.deconz.presencesensor.label = Bewegungsmelder
thing-type.deconz.presencesensor.description = Bewegungsmelder mit einstellbarer Sensitivität.
thing-type.config.deconz.sensor.id.label = ID des Sensors
thing-type.config.deconz.sensor.id.description = ID zur Identifikation des Sensors.
thing-type.config.deconz.sensor.lastSeenPolling.label = Abfrageintervall
thing-type.config.deconz.sensor.lastSeenPolling.description = Intervall zur Abfrage des deCONZ-Gateways nach dem "last_seen" Channel dieses Sensors. Polling wird deaktiviert, wenn der Wert auf 0 eingestellt wird (Standard: 1440, einmal pro Tag).
channel-type.deconz.last_updated.label = Letzte Aktualisierung
channel-type.deconz.last_updated.description = Zeit, zu der sich dieser Wert geändert hat.
channel-type.deconz.last_updated.options.pattern = %1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS
channel-type.deconz.last_seen.label = Zuletzt Gesehen
channel-type.deconz.last_seen.description = Zeit, zu der sich dieser Wert geändert hat.
channel-type.deconz.last_seen.options.pattern = %1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS

View File

@ -13,6 +13,7 @@
<channels>
<channel typeId="system.motion" id="presence"/>
<channel typeId="last_updated" id="last_updated"/>
<channel typeId="system.power" id="enabled"/>
</channels>
<representation-property>uid</representation-property>