Skip to content

Commit 7535787

Browse files
committed
[ddwrt] Fix logging and remove MAC wireless client property
- Change 8 non-compliant logger.info calls to logger.debug per openHAB guidelines (info should only be used for newly started components or loaded files) - Remove MAC address from wireless client discovery properties PR openhab#20505 Assisted-by: Windsurf:SWE-1.6 Signed-off-by: Lee Ballard <ballle98@gmail.com>
1 parent 0a0aa0a commit 7535787

6 files changed

Lines changed: 8 additions & 11 deletions

File tree

bundles/org.openhab.binding.ddwrt/src/main/java/org/openhab/binding/ddwrt/internal/DDWRTDiscoveryService.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ private void discoverWirelessClients(DDWRTNetwork net) {
201201

202202
final Map<String, Object> props = new java.util.HashMap<>();
203203
props.put("hostname", client.getHostname());
204-
if (!client.getMac().isEmpty()) {
205-
props.put("mac", client.getMac());
206-
}
207204

208205
final DiscoveryResult result = DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID)
209206
.withLabel(client.getHostname()).withProperties(props).withRepresentationProperty("hostname")

bundles/org.openhab.binding.ddwrt/src/main/java/org/openhab/binding/ddwrt/internal/api/DDWRTBaseDevice.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,7 @@ public void reboot() {
18441844
lastRecoveryAuthAttemptMs = 0;
18451845
recoveryNetFailures = 0;
18461846
lastRecoveryNetAttemptMs = 0;
1847-
logger.info("Recovered SSH session for {}", config.hostname);
1847+
logger.debug("Recovered SSH session for {}", config.hostname);
18481848
SshLogFollower follower = logFollower;
18491849
if (follower != null) {
18501850
follower.wakeUp();

bundles/org.openhab.binding.ddwrt/src/main/java/org/openhab/binding/ddwrt/internal/api/DDWRTNetwork.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class DDWRTNetwork {
7575
/** Hand the entire bridge configuration to the network. */
7676
public void setConfig(DDWRTNetworkConfiguration netCfg) {
7777
if (!Objects.equals(this.config, netCfg)) {
78-
logger.info("Config changed.");
78+
logger.debug("Config changed.");
7979
this.config = netCfg;
8080

8181
// Clear failure tracking for retry logic
@@ -252,7 +252,7 @@ public void addFailedDeviceConfig(String hostname, DDWRTDeviceConfiguration cfg)
252252
DDWRTNetworkConfiguration netCfg = config;
253253
int interval = netCfg != null ? netCfg.refreshInterval : cfg.refreshInterval;
254254
device.startRefresh(interval);
255-
logger.info("Successfully connected to device: {} (MAC: {})", cfg.hostname, device.getMac());
255+
logger.debug("Successfully connected to device: {} (MAC: {})", cfg.hostname, device.getMac());
256256
return device;
257257
}
258258
} catch (Exception e) {
@@ -317,7 +317,7 @@ public void refresh() {
317317
DDWRTNetworkConfiguration netCfg = config;
318318
int interval = netCfg != null ? netCfg.refreshInterval : cfg.refreshInterval;
319319
device.startRefresh(interval);
320-
logger.info("Successfully reconnected to device: {}", hostname);
320+
logger.debug("Successfully reconnected to device: {}", hostname);
321321
}
322322
} catch (Exception e) {
323323
if (isAuthFailure(e)) {

bundles/org.openhab.binding.ddwrt/src/main/java/org/openhab/binding/ddwrt/internal/api/SshClientManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private SshClientManager() {
8686
Path knownHostsPath = getHomeSshDir() != null ? Objects.requireNonNull(getHomeSshDir()).resolve("known_hosts")
8787
: Paths.get(ohPrivateKeyDirString, "known_hosts");
8888
ServerKeyVerifier verifier = new KnownHostsServerKeyVerifier((s, a, k) -> {
89-
logger.info("TOFU: auto-accepting host key for {}", a);
89+
logger.debug("TOFU: auto-accepting host key for {}", a);
9090
return true;
9191
}, knownHostsPath) {
9292
@Override

bundles/org.openhab.binding.ddwrt/src/main/java/org/openhab/binding/ddwrt/internal/handler/DDWRTBaseHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ public final void handleCommand(ChannelUID channelUID, Command command) {
136136
if (entity != null && network != null) {
137137
try {
138138
if (!handleCommand(network, entity, channelUID, command)) {
139-
logger.info("Ignoring unsupported command = {} for channel = {}", command, channelUID);
139+
logger.debug("Ignoring unsupported command = {} for channel = {}", command, channelUID);
140140
}
141141
} catch (Exception e) {
142-
logger.info("Error handling command = {} for channel = {}: {}", command, channelUID,
142+
logger.debug("Error handling command = {} for channel = {}: {}", command, channelUID,
143143
e.getMessage());
144144
}
145145
} else {

bundles/org.openhab.binding.ddwrt/src/main/java/org/openhab/binding/ddwrt/internal/handler/DDWRTFirewallRuleHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected boolean handleCommand(DDWRTNetwork network, DDWRTFirewallRule rule, Ch
8080
Command command) {
8181
String channelId = channelUID.getIdWithoutGroup();
8282
if (CHANNEL_ENABLED.equals(channelId) && command instanceof OnOffType) {
83-
logger.info("Firewall rule enable/disable not yet implemented for {}", rule.getRuleId());
83+
logger.debug("Firewall rule enable/disable not yet implemented for {}", rule.getRuleId());
8484
return false;
8585
}
8686
return false;

0 commit comments

Comments
 (0)