This is my first post on the forum. I hope this is the right way to report a problem.
My OpenHAB is running on a Windows 10 machine.
I noticed in my DEBUG-log from the Network Binding, the Latency was calculated bij de the executiontime of the ping-request and not by the present “time=” value. See below the log showing the issue.
2020-10-16 13:25:53.799 [DEBUG] [network.internal.utils.LatencyParser] - Parsing latency from input Reply from 192.168.178.207: bytes=32 time=2ms TTL=64
2020-10-16 13:25:53.799 [DEBUG] [network.internal.utils.LatencyParser] - Did not find a latency value
2020-10-16 13:25:53.799 [DEBUG] [g.network.internal.PresenceDetection] - Getting latency from ping result PingResult{success=true, responseTimeInMS=null, executionTimeInMS=111.0} using latency mode true
2020-10-16 13:25:53.799 [DEBUG] [network.internal.utils.LatencyParser] - Parsing latency from input Reply from 192.168.178.202: bytes=32 time<1ms TTL=64
2020-10-16 13:25:53.799 [DEBUG] [network.internal.utils.LatencyParser] - Did not find a latency value
2020-10-16 13:25:53.799 [DEBUG] [g.network.internal.PresenceDetection] - Getting latency from ping result PingResult{success=true, responseTimeInMS=null, executionTimeInMS=126.0} using latency mode true
2020-10-16 13:25:57.361 [DEBUG] [network.internal.utils.LatencyParser] - Parsing latency from input Reply from 192.168.178.241: bytes=32 time<1ms TTL=64
2020-10-16 13:25:57.361 [DEBUG] [network.internal.utils.LatencyParser] - Did not find a latency value
2020-10-16 13:25:57.361 [DEBUG] [g.network.internal.PresenceDetection] - Getting latency from ping result PingResult{success=true, responseTimeInMS=null, executionTimeInMS=143.0} using latency mode true
I noticed in the ‘LatencyParser.java’ code the Parser expects a space after the “time=xx ms” (String pattern = “.time=(.) ms”;). My respons on the Windows 10 ping request is however without this space and therefore not recognized as a present Latency value.
public Optional<Double> parseLatency(String inputLine) {
logger.debug("Parsing latency from input {}", inputLine);
String pattern = ".*time=(.*) ms";
Matcher m = Pattern.compile(pattern).matcher(inputLine);
if(m.find() && m.groupCount() == 1) {
return Optional.of(Double.parseDouble(m.group(1)));
}
logger.debug("Did not find a latency value");
return Optional.empty();
}
I suppose this is the cause of my problem. I am not sure how and where to ask for a fix but could this be fixed?