updateRateBandwidth(status.rateUp(), status.bandwidthUp(), "up");
updateRateBandwidth(status.rateDown(), status.bandwidthDown(), "down");
- updateChannelQuantity(GROUP_CONNECTION_STATUS, BYTES_UP, new QuantityType<>(status.bytesUp(), OCTET),
- GIBIOCTET);
- updateChannelQuantity(GROUP_CONNECTION_STATUS, BYTES_DOWN, new QuantityType<>(status.bytesDown(), OCTET),
- GIBIOCTET);
+ updateChannelQuantity(GROUP_CONNECTION_STATUS, BYTES_UP, status.bytesUp(), OCTET);
+ updateChannelQuantity(GROUP_CONNECTION_STATUS, BYTES_DOWN, status.bytesDown(), OCTET);
}
if (anyChannelLinked(GROUP_FTTH,
Set.of(SFP_PRESENT, SFP_ALIM, SFP_POWER, SFP_SIGNAL, SFP_LINK, SFP_PWR_TX, SFP_PWR_RX))) {
}
private void updateRateBandwidth(long rate, long bandwidth, String orientation) {
- QuantityType<?> rateUp = new QuantityType<>(rate * 8, Units.BIT_PER_SECOND);
+ QuantityType<?> rateUp = new QuantityType<>(rate * 8, BIT_PER_SECOND);
QuantityType<?> bandwidthUp = new QuantityType<>(bandwidth, BIT_PER_SECOND);
- updateChannelQuantity(GROUP_CONNECTION_STATUS, RATE + "-" + orientation, rateUp, KILOBIT_PER_SECOND);
- updateChannelQuantity(GROUP_CONNECTION_STATUS, BW + "-" + orientation, bandwidthUp, KILOBIT_PER_SECOND);
+ updateChannelQuantity(GROUP_CONNECTION_STATUS, RATE + "-" + orientation, rateUp);
+ updateChannelQuantity(GROUP_CONNECTION_STATUS, BW + "-" + orientation, bandwidthUp);
updateChannelQuantity(GROUP_CONNECTION_STATUS, PCT_BW + "-" + orientation,
- !bandwidthUp.equals(QuantityType.ZERO) ? rateUp.multiply(HUNDRED).divide(bandwidthUp)
- : QuantityType.ZERO,
- Units.PERCENT);
+ !bandwidthUp.equals(QuantityType.ZERO) ? rateUp.divide(bandwidthUp) : QuantityType.ZERO, PERCENT);
}
@Override
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<channel-type id="lcd-brightness" advanced="true">
- <item-type>Number:Dimensionless</item-type>
+ <item-type unitHint="%">Number:Dimensionless</item-type>
<label>Screen Brightness</label>
<description>Brightness level of the screen in percent</description>
<category>Light</category>
- <state pattern="%d %unit%" min="0" max="100"/>
+ <state pattern="%d %%" min="0" max="100"/>
</channel-type>
<channel-type id="lcd-orientation" advanced="true">
</channel-type>
<channel-type id="bandwidth-usage">
- <item-type>Number:Dimensionless</item-type>
+ <item-type unitHint="%">Number:Dimensionless</item-type>
<label>Bandwidth Usage</label>
<description>Current bandwidth usage</description>
- <state readOnly="true" pattern="%.2f %unit%"/>
+ <state readOnly="true" pattern="%.0f %%"/>
</channel-type>
<channel-type id="transfer-rate">
- <item-type>Number:DataTransferRate</item-type>
+ <item-type unitHint="Mbit/s">Number:DataTransferRate</item-type>
<label>Transfer Rate</label>
<description>Current transfer rate</description>
<state readOnly="true" pattern="%.2f %unit%"/>
</channel-type>
<channel-type id="transfer-rate-bps" advanced="true">
- <item-type>Number:DataTransferRate</item-type>
+ <item-type unitHint="bit/s">Number:DataTransferRate</item-type>
<label>Transfer Rate</label>
<description>Current transfer rate</description>
- <state readOnly="true" pattern="%.2f bit/s"/>
+ <state readOnly="true" pattern="%.0f bit/s"/>
</channel-type>
<channel-type id="transfer-bytes" advanced="true">
- <item-type>Number:DataAmount</item-type>
+ <item-type unitHint="GB">Number:DataAmount</item-type>
<label>Transfered Bytes</label>
<description>Total data transfered since last connection</description>
<state readOnly="true" pattern="%.2f %unit%"/>
</channel-type>
- <channel-type id="bandwidth" advanced="true">
- <item-type>Number:DataTransferRate</item-type>
- <label>Bandwidth</label>
- <description>Available bandwidth</description>
- <state readOnly="true" pattern="%.2f %unit%"/>
- </channel-type>
-
<channel-type id="uptime" advanced="true">
<item-type>Number:Time</item-type>
<label>Uptime</label>
<item-type unitHint="%">Number:Dimensionless</item-type>
<label>Alarm Volume</label>
<category>oh:freeboxos:sirene</category>
- <state min="0" max="100" step="1" pattern="%d %unit%"/>
+ <state min="0" max="100" step="1" pattern="%d %%"/>
</channel-type>
<channel-type id="alarm-pin">