mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
Handling null WifiInformation (#16700)
Signed-off-by: Gaël L'hopital <gael@lhopital.org>
This commit is contained in:
+6
-4
@@ -46,14 +46,16 @@ public class APManager extends ListableRest<APManager.WifiAp, APManager.APRespon
|
||||
long txBytes, // transmitted bytes (from Freebox to station)
|
||||
long txRate, // reception data rate (in bytes/s)
|
||||
long rxRate, // transmission data rate (in bytes/s)
|
||||
WifiInformation wifiInformation) {
|
||||
@Nullable WifiInformation wifiInformation) {
|
||||
|
||||
public int getSignal() {
|
||||
return wifiInformation.signal();
|
||||
public int getRSSI() {
|
||||
WifiInformation local = wifiInformation;
|
||||
return local != null ? local.signal : 1;
|
||||
}
|
||||
|
||||
public @Nullable String getSsid() {
|
||||
return wifiInformation().ssid();
|
||||
WifiInformation local = wifiInformation;
|
||||
return local != null ? local.ssid : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public class WifiStationHandler extends HostHandler {
|
||||
LanAccessPoint lanAp = wifiHost.get().accessPoint();
|
||||
if (lanAp != null) {
|
||||
updateChannelString(GROUP_WIFI, WIFI_HOST, "%s-%s".formatted(lanAp.type(), lanAp.uid()));
|
||||
updateWifiStationChannels(lanAp.getSignal(), lanAp.getSsid(), lanAp.rxRate(), lanAp.txRate());
|
||||
updateWifiStationChannels(lanAp.getRSSI(), lanAp.getSsid(), lanAp.rxRate(), lanAp.txRate());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user