--- /dev/null
+/**
+ * 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;
+}
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;
return UnDefType.UNDEF;
}
+ protected int getTariffInfo() {
+ return ((getDB_0() >>> 4) & 0xff);
+ }
+
@Override
protected State convertToStateImpl(String channelId, String channelTypeId,
Function<String, State> 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:
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">
- <thing-type id="automatedMeterSensor">
+ <thing-type id="automatedMeterSensor"
+ extensible="currentFlow, cumulativeValue, counter, currentNumber, instantpower, totalusage">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge"/>
</supported-bridge-type-refs>
<label>Instant Power</label>
<description>Instant power consumption in Watts</description>
<state pattern="%d %unit%" readOnly="true"/>
+ <config-description>
+ <parameter name="tariff" type="integer" min="0" max="15">
+ <label>Tariff info</label>
+ <description>Number of tariff this channel listens to</description>
+ <default>0</default>
+ </parameter>
+ <parameter name="validateValue" type="boolean">
+ <label>Validate Value</label>
+ <description>Filter out increases more than 10.0 kWh and decreases less than 1.0 kWh</description>
+ <default>false</default>
+ </parameter>
+ </config-description>
</channel-type>
<channel-type id="totalusage">
<description>Used energy in Kilowatt hours</description>
<state pattern="%.1f %unit%" readOnly="true"/>
<config-description>
+ <parameter name="tariff" type="integer" min="0" max="15">
+ <label>Tariff info</label>
+ <description>Number of tariff this channel listens to</description>
+ <default>0</default>
+ </parameter>
<parameter name="validateValue" type="boolean">
<label>Validate Value</label>
<description>Filter out increases more than 10.0 kWh and decreases less than 1.0 kWh</description>
<item-type>Number:VolumetricFlowRate</item-type>
<label>Current Flow</label>
<state pattern="%d %unit%" readOnly="true"/>
+ <config-description>
+ <parameter name="tariff" type="integer" min="0" max="15">
+ <label>Tariff info</label>
+ <description>Number of tariff this channel listens to</description>
+ <default>0</default>
+ </parameter>
+ </config-description>
</channel-type>
<channel-type id="cumulativeValue">
<item-type>Number:Volume</item-type>
<label>Cumulative Value</label>
<state pattern="%d %unit%" readOnly="true"/>
+ <config-description>
+ <parameter name="tariff" type="integer" min="0" max="15">
+ <label>Tariff info</label>
+ <description>Number of tariff this channel listens to</description>
+ <default>0</default>
+ </parameter>
+ </config-description>
</channel-type>
<channel-type id="counter">
<label>Counter</label>
<description>Counter</description>
<state readOnly="true"/>
+ <config-description>
+ <parameter name="tariff" type="integer" min="0" max="15">
+ <label>Tariff info</label>
+ <description>Number of tariff this channel listens to</description>
+ <default>0</default>
+ </parameter>
+ </config-description>
</channel-type>
<channel-type id="currentNumber">
<label>Current</label>
<description>Current</description>
<state readOnly="true"/>
+ <config-description>
+ <parameter name="tariff" type="integer" min="0" max="15">
+ <label>Tariff info</label>
+ <description>Number of tariff this channel listens to</description>
+ <default>0</default>
+ </parameter>
+ </config-description>
</channel-type>
<channel-type id="rainStatus">