diff --git a/bundles/org.openhab.binding.enocean/README.md b/bundles/org.openhab.binding.enocean/README.md index 81b2654e9..788d8e8ed 100644 --- a/bundles/org.openhab.binding.enocean/README.md +++ b/bundles/org.openhab.binding.enocean/README.md @@ -287,6 +287,7 @@ Some channels can be configured with parameters. | teachInCMD | manufacturerId | Id is used for 4BS teach in with EEP | HEX | | | teachInMSG | Use this message if teach in type and/or manufacturer id are unknown | HEX | | totalusage | validateValue | Filter out increases more than 10.0 kWh and decreases less than 1.0 kWh | true / false | +| | tariff | Tariff info or measurement channel to listen to | 0-15 | | contact | inverted | Swap OPEN / CLOSED. Set True for Eltako FPE-2. | true / false. Defaults to false. | Possible declaration in Thing DSL: diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/config/EnOceanChannelTariffInfoConfig.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/config/EnOceanChannelTariffInfoConfig.java new file mode 100644 index 000000000..e142b6361 --- /dev/null +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/config/EnOceanChannelTariffInfoConfig.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2010-2020 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.enocean.internal.config; + +/** + * + * @author Daniel Weber - Initial contribution + */ +public class EnOceanChannelTariffInfoConfig { + public int tariff = 0; +} diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_12/A5_12.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_12/A5_12.java index 4d008e56c..aa2986249 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_12/A5_12.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_12/A5_12.java @@ -16,6 +16,7 @@ import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.*; import java.util.function.Function; +import org.openhab.binding.enocean.internal.config.EnOceanChannelTariffInfoConfig; import org.openhab.binding.enocean.internal.eep.Base._4BSMessage; import org.openhab.binding.enocean.internal.eep.EEPHelper; import org.openhab.binding.enocean.internal.messages.ERP1Message; @@ -112,10 +113,19 @@ public abstract class A5_12 extends _4BSMessage { return UnDefType.UNDEF; } + protected int getTariffInfo() { + return ((getDB_0() >>> 4) & 0xff); + } + @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - switch (channelId) { + + EnOceanChannelTariffInfoConfig c = config.as(EnOceanChannelTariffInfoConfig.class); + if (c.tariff != getTariffInfo()) + return UnDefType.UNDEF; + + switch (channelTypeId) { case CHANNEL_INSTANTPOWER: case CHANNEL_CURRENTFLOW: case CHANNEL_CURRENTNUMBER: diff --git a/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/AutomatedMeterSensor.xml b/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/AutomatedMeterSensor.xml index 78f557e80..20db15ce2 100644 --- a/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/AutomatedMeterSensor.xml +++ b/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/AutomatedMeterSensor.xml @@ -4,7 +4,8 @@ xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> - + diff --git a/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/channels.xml index 22705d0a8..9550e0d5e 100644 --- a/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/channels.xml +++ b/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/channels.xml @@ -163,6 +163,18 @@ Instant power consumption in Watts + + + + Number of tariff this channel listens to + 0 + + + + Filter out increases more than 10.0 kWh and decreases less than 1.0 kWh + false + + @@ -171,6 +183,11 @@ Used energy in Kilowatt hours + + + Number of tariff this channel listens to + 0 + Filter out increases more than 10.0 kWh and decreases less than 1.0 kWh @@ -324,12 +341,26 @@ Number:VolumetricFlowRate + + + + Number of tariff this channel listens to + 0 + + Number:Volume + + + + Number of tariff this channel listens to + 0 + + @@ -337,6 +368,13 @@ Counter + + + + Number of tariff this channel listens to + 0 + + @@ -344,6 +382,13 @@ Current + + + + Number of tariff this channel listens to + 0 + +