import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.types.StringType;
+import org.openhab.core.library.unit.Units;
import org.openhab.core.types.Command;
import org.openhab.core.types.State;
import org.openhab.core.types.UnDefType;
return mappedSignalStrength;
}
+ /**
+ * post processor for decibel values (which are served as deca decibel)
+ *
+ * @param state the channel value in deca decibel
+ * @param channelConfig channel config of the channel
+ * @return the state converted to decibel
+ */
+ @SuppressWarnings("unused")
+ private State processDecaDecibel(State state, Tr064ChannelConfig channelConfig) {
+ Float value = state.as(DecimalType.class).floatValue() / 10;
+
+ return new QuantityType(value, Units.DECIBEL);
+ }
+
/**
* post processor for answering machine new messages channel
*
<item type="Number:Dimensionless" unit="dB" statePattern="%.1f dB"/>
<service deviceType="urn:dslforum-org:device:WANDevice:1"
serviceId="urn:WANDSLIfConfig-com:serviceId:WANDSLInterfaceConfig1"/>
- <getAction name="GetInfo" argument="NewDownstreamNoiseMargin"/>
+ <getAction name="GetInfo" argument="NewDownstreamNoiseMargin" postProcessor="processDecaDecibel"/>
</channel>
<channel name="dslUpstreamNoiseMargin" label="DSL Upstream Noise Margin">
<item type="Number:Dimensionless" unit="dB" statePattern="%.1f dB"/>
<service deviceType="urn:dslforum-org:device:WANDevice:1"
serviceId="urn:WANDSLIfConfig-com:serviceId:WANDSLInterfaceConfig1"/>
- <getAction name="GetInfo" argument="NewUpstreamNoiseMargin"/>
+ <getAction name="GetInfo" argument="NewUpstreamNoiseMargin" postProcessor="processDecaDecibel"/>
</channel>
<channel name="dslDownstreamAttenuation" label="DSL Downstream Attenuation">
<item type="Number:Dimensionless" unit="dB" statePattern="%.1f dB"/>
<service deviceType="urn:dslforum-org:device:WANDevice:1"
serviceId="urn:WANDSLIfConfig-com:serviceId:WANDSLInterfaceConfig1"/>
- <getAction name="GetInfo" argument="NewDownstreamAttenuation"/>
+ <getAction name="GetInfo" argument="NewDownstreamAttenuation" postProcessor="processDecaDecibel"/>
</channel>
<channel name="dslUpstreamAttenuation" label="DSL Upstream Attenuation">
<item type="Number:Dimensionless" unit="dB" statePattern="%.1f dB"/>
<service deviceType="urn:dslforum-org:device:WANDevice:1"
serviceId="urn:WANDSLIfConfig-com:serviceId:WANDSLInterfaceConfig1"/>
- <getAction name="GetInfo" argument="NewUpstreamAttenuation"/>
+ <getAction name="GetInfo" argument="NewUpstreamAttenuation" postProcessor="processDecaDecibel"/>
</channel>
<channel name="dslFECErrors" label="DSL FEC Errors">
<item type="Number:Dimensionless"/>