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";
) {
}
- private enum SynchroState {
+ public enum SynchroState {
DOWN, // unsynchronized
TRAINING, // synchronizing step 1/4
STARTED, // synchronizing step 2/4
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 {
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;
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) {
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
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
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
<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>
</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"/>
</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>
<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>
<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>