mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[freeboxos] Add channels in group xdsl (#17260)
Follow-up #17219 Fixes #17073 * Category added * Change ffth and xdsl group labels Signed-off-by: Laurent Garnier <lg.hc@free.fr> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
d5e409280f
commit
c64d7338e4
@ -168,6 +168,12 @@ public class FreeboxOsBindingConstants {
|
||||
public static final String SFP_PWR_TX = "sfp-pwr-tx";
|
||||
public static final String SFP_PWR_RX = "sfp-pwr-rx";
|
||||
|
||||
// xDSL channels ids
|
||||
public static final String XDSL_READY = "ready";
|
||||
public static final String XDSL_STATUS = "status";
|
||||
public static final String XDSL_MODULATION = "modulation";
|
||||
public static final String XDSL_UPTIME = "uptime";
|
||||
|
||||
// Home channels
|
||||
public static final String KEYFOB_ENABLE = "enable";
|
||||
public static final String NODE_BATTERY = "battery";
|
||||
|
@ -107,7 +107,7 @@ public class ConnectionManager extends ConfigurableRest<ConnectionManager.Status
|
||||
) {
|
||||
}
|
||||
|
||||
private enum SynchroState {
|
||||
public enum SynchroState {
|
||||
DOWN, // unsynchronized
|
||||
TRAINING, // synchronizing step 1/4
|
||||
STARTED, // synchronizing step 2/4
|
||||
@ -118,18 +118,16 @@ public class ConnectionManager extends ConfigurableRest<ConnectionManager.Status
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
private enum Modulation {
|
||||
public enum Modulation {
|
||||
ADSL,
|
||||
VDSL,
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
public static record XdslStatus(SynchroState status, String protocol, Modulation modulation, long uptime) {
|
||||
|
||||
}
|
||||
|
||||
public static record XdslInfos(XdslStatus status, XdslStats down, XdslStats up) {
|
||||
|
||||
}
|
||||
|
||||
public ConnectionManager(FreeboxOsSession session) throws FreeboxException {
|
||||
|
@ -31,6 +31,8 @@ import org.openhab.binding.freeboxos.internal.api.rest.ConnectionManager;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.ConnectionManager.FtthStatus;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.ConnectionManager.Media;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.ConnectionManager.Status;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.ConnectionManager.SynchroState;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.ConnectionManager.XdslInfos;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.FtpManager;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.LanBrowserManager.Source;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.LanManager;
|
||||
@ -206,6 +208,13 @@ public class ServerHandler extends ApiConsumerHandler implements FreeDeviceIntf
|
||||
updateChannelQuantity(GROUP_FTTH, SFP_PWR_TX, ftthStatus.getTransmitDBM(), Units.DECIBEL_MILLIWATTS);
|
||||
updateChannelQuantity(GROUP_FTTH, SFP_PWR_RX, ftthStatus.getReceivedDBM(), Units.DECIBEL_MILLIWATTS);
|
||||
}
|
||||
if (anyChannelLinked(GROUP_XDSL, Set.of(XDSL_READY, XDSL_STATUS, XDSL_MODULATION, XDSL_UPTIME))) {
|
||||
XdslInfos xdslInfos = getManager(ConnectionManager.class).getXdslStatus();
|
||||
updateChannelOnOff(GROUP_XDSL, XDSL_READY, xdslInfos.status().status() == SynchroState.SHOWTIME);
|
||||
updateChannelString(GROUP_XDSL, XDSL_STATUS, xdslInfos.status().status());
|
||||
updateChannelString(GROUP_XDSL, XDSL_MODULATION, xdslInfos.status().modulation());
|
||||
updateChannelQuantity(GROUP_XDSL, XDSL_UPTIME, xdslInfos.status().uptime(), Units.SECOND);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRateBandwidth(long rate, long bandwidth, String orientation) {
|
||||
|
@ -155,7 +155,7 @@ channel-group-type.freeboxos.connectivity.channel.last-seen.label = Last Activit
|
||||
channel-group-type.freeboxos.display.label = Front Display Panel
|
||||
channel-group-type.freeboxos.fans.label = Fans
|
||||
channel-group-type.freeboxos.file-sharing.label = File Sharing
|
||||
channel-group-type.freeboxos.ftth.label = FTTH Connection Status
|
||||
channel-group-type.freeboxos.ftth.label = FTTH Connection Details
|
||||
channel-group-type.freeboxos.ftth.channel.sfp-pwr-rx.label = RX Power
|
||||
channel-group-type.freeboxos.ftth.channel.sfp-pwr-rx.description = SFP Power in reception
|
||||
channel-group-type.freeboxos.ftth.channel.sfp-pwr-tx.label = TX Power
|
||||
@ -199,7 +199,8 @@ channel-group-type.freeboxos.wifi.channel.rate-down.label = Rx Rate
|
||||
channel-group-type.freeboxos.wifi.channel.rate-down.description = Current RX rate
|
||||
channel-group-type.freeboxos.wifi.channel.rate-up.label = Tx Rate
|
||||
channel-group-type.freeboxos.wifi.channel.rate-up.description = Current TX Rate
|
||||
channel-group-type.freeboxos.xdsl.label = xDSL Connection Status
|
||||
channel-group-type.freeboxos.xdsl.label = xDSL Connection Details
|
||||
channel-group-type.freeboxos.xdsl.channel.uptime.description = Time since last synchronization
|
||||
|
||||
# channel types
|
||||
|
||||
@ -364,6 +365,18 @@ channel-type.freeboxos.uptime.state.pattern = %1$tdd %1$tHh %1$tMm %1$tSs
|
||||
channel-type.freeboxos.wifi-host.label = Access Point
|
||||
channel-type.freeboxos.wifi-status.label = Wifi Enabled
|
||||
channel-type.freeboxos.wifi-status.description = Indicates whether the wifi network is enabled
|
||||
channel-type.freeboxos.xdsl-modulation.label = Modulation
|
||||
channel-type.freeboxos.xdsl-ready.label = Ready
|
||||
channel-type.freeboxos.xdsl-ready.description = ON when xDSL line connection is synchronized
|
||||
channel-type.freeboxos.xdsl-status.label = Line Status
|
||||
channel-type.freeboxos.xdsl-status.description = Status of xDSL line connection
|
||||
channel-type.freeboxos.xdsl-status.state.option.DOWN = Unsynchronized
|
||||
channel-type.freeboxos.xdsl-status.state.option.TRAINING = Synchronizing step 1/4
|
||||
channel-type.freeboxos.xdsl-status.state.option.STARTED = Synchronizing step 2/4
|
||||
channel-type.freeboxos.xdsl-status.state.option.CHAN_ANALYSIS = Synchronizing step 3/4
|
||||
channel-type.freeboxos.xdsl-status.state.option.MSG_EXCHANGE = Synchronizing step 4/4
|
||||
channel-type.freeboxos.xdsl-status.state.option.SHOWTIME = Synchronized
|
||||
channel-type.freeboxos.xdsl-status.state.option.DISABLED = Disabled
|
||||
|
||||
# messages
|
||||
|
||||
|
@ -503,4 +503,35 @@
|
||||
<state readOnly="true" pattern="%.2f dBm"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="xdsl-ready">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Ready</label>
|
||||
<description>ON when xDSL line connection is synchronized</description>
|
||||
<category>Switch</category>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="xdsl-status" advanced="true">
|
||||
<item-type>String</item-type>
|
||||
<label>Line Status</label>
|
||||
<description>Status of xDSL line connection</description>
|
||||
<state readOnly="true" pattern="%s">
|
||||
<options>
|
||||
<option value="DOWN">Unsynchronized</option>
|
||||
<option value="TRAINING">Synchronizing step 1/4</option>
|
||||
<option value="STARTED">Synchronizing step 2/4</option>
|
||||
<option value="CHAN_ANALYSIS">Synchronizing step 3/4</option>
|
||||
<option value="MSG_EXCHANGE">Synchronizing step 4/4</option>
|
||||
<option value="SHOWTIME">Synchronized</option>
|
||||
<option value="DISABLED">Disabled</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="xdsl-modulation" advanced="true">
|
||||
<item-type>String</item-type>
|
||||
<label>Modulation</label>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
|
@ -53,7 +53,7 @@
|
||||
</channel-group-type>
|
||||
|
||||
<channel-group-type id="ftth">
|
||||
<label>FTTH Connection Status</label>
|
||||
<label>FTTH Connection Details</label>
|
||||
<channels>
|
||||
<channel id="sfp-present" typeId="sfp-present"/>
|
||||
<channel id="sfp-alim-ok" typeId="sfp-alim-ok"/>
|
||||
@ -72,10 +72,14 @@
|
||||
</channel-group-type>
|
||||
|
||||
<channel-group-type id="xdsl">
|
||||
<label>xDSL Connection Status</label>
|
||||
<label>xDSL Connection Details</label>
|
||||
<channels>
|
||||
<channel id="status" typeId="status"/>
|
||||
<!-- to be completed -->
|
||||
<channel id="ready" typeId="xdsl-ready"/>
|
||||
<channel id="status" typeId="xdsl-status"/>
|
||||
<channel id="modulation" typeId="xdsl-modulation"/>
|
||||
<channel id="uptime" typeId="uptime">
|
||||
<description>Time since last synchronization</description>
|
||||
</channel>
|
||||
</channels>
|
||||
</channel-group-type>
|
||||
|
||||
|
@ -54,6 +54,19 @@
|
||||
<label>RX Power</label>
|
||||
<description>SFP Power in reception</description>
|
||||
</add-channel>
|
||||
<add-channel id="ready" groupIds="xdsl">
|
||||
<type>freeboxos:xdsl-ready</type>
|
||||
</add-channel>
|
||||
<add-channel id="status" groupIds="xdsl">
|
||||
<type>freeboxos:xdsl-status</type>
|
||||
</add-channel>
|
||||
<add-channel id="modulation" groupIds="xdsl">
|
||||
<type>freeboxos:xdsl-modulation</type>
|
||||
</add-channel>
|
||||
<add-channel id="uptime" groupIds="xdsl">
|
||||
<type>freeboxos:uptime</type>
|
||||
<description>Time since last synchronization</description>
|
||||
</add-channel>
|
||||
</instruction-set>
|
||||
|
||||
</thing-type>
|
||||
@ -86,6 +99,19 @@
|
||||
<label>RX Power</label>
|
||||
<description>SFP Power in reception</description>
|
||||
</add-channel>
|
||||
<add-channel id="ready" groupIds="xdsl">
|
||||
<type>freeboxos:xdsl-ready</type>
|
||||
</add-channel>
|
||||
<add-channel id="status" groupIds="xdsl">
|
||||
<type>freeboxos:xdsl-status</type>
|
||||
</add-channel>
|
||||
<add-channel id="modulation" groupIds="xdsl">
|
||||
<type>freeboxos:xdsl-modulation</type>
|
||||
</add-channel>
|
||||
<add-channel id="uptime" groupIds="xdsl">
|
||||
<type>freeboxos:uptime</type>
|
||||
<description>Time since last synchronization</description>
|
||||
</add-channel>
|
||||
</instruction-set>
|
||||
|
||||
</thing-type>
|
||||
|
Loading…
Reference in New Issue
Block a user