Network binding error resolving host name

Hello all,

I have updated OH 2.1 to 2.2 and I having problems with Network binding. In my setup, I’m using several MQTT sensor nodes what request their IP by DHCP so, their names are included in my local DNS server. When the host name can be resolved, OH starts correctly but if it can’t OH starts with a errors. Following you can view the log entries:

2018-01-09 10:59:33.811 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'default.rules'
2018-01-09 10:59:35.046 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'micasa.sitemap'
2018-01-09 10:59:35.506 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'MiCasa.things'
2018-01-09 10:59:35.993 [ERROR] [nding.network.handler.NetworkHandler] - Configuration for hostname is faulty
java.net.UnknownHostException: Sonoffxxxd: unknown error
	at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[?:?]
	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) [?:?]
	at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) [?:?]
	at java.net.InetAddress.getAllByName0(InetAddress.java:1276) [?:?]
	at java.net.InetAddress.getAllByName(InetAddress.java:1192) [?:?]
	at java.net.InetAddress.getAllByName(InetAddress.java:1126) [?:?]
	at java.net.InetAddress.getByName(InetAddress.java:1076) [?:?]
	at org.openhab.binding.network.internal.PresenceDetection.setHostname(PresenceDetection.java:96) [225:org.openhab.binding.network:2.2.0]
	at org.openhab.binding.network.handler.NetworkHandler.initialize(NetworkHandler.java:156) [225:org.openhab.binding.network:2.2.0]
	at org.openhab.binding.network.handler.NetworkHandler.initialize(NetworkHandler.java:202) [225:org.openhab.binding.network:2.2.0]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:497) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
	at java.lang.Thread.run(Thread.java:745) [?:?]
2018-01-09 10:59:37.551 [INFO ] [b.core.service.AbstractActiveService] - HTTP Refresh Service has been started


Also I’m using text file to configure Things as following:

network:pingdevice:Sonoff 
[
	hostname="Sonoffxxxd", 
	retry=2
]

In 2.1 version I didn’t experiment this problem and if a host name could not be resolved, Network binding considered that it was offline.

Could anyone help me?
Thanks in advance,

Have you tried to use the FQN i.e. Sonoffxxxs.mynetwork.net

Yes, I have tried it but with same result…

Change hostname=“Sonoffxxxd” to hostname=“IP-ADRESS”

With a hard coded IP address, it works but, I’m using DHCP just to avoid to use hard coded IP addresses…

You need internal DNS (at least a DNS forwarding service and names resolved through hosts file). I don’t know if sonos is special in this point, I don’t own a sonos system. All stuff at openHAB in my home LAN works with “fake” FQDN through DNS forwarder in my ipfire router.

I have an internal DNS server on my router and the names are resolved without problems by all hosts in the LAN. BTW, I’m not using any Sonos device. May be you are confused about the host name of in the above log: it is just a name…

Yes, misread Sonoff as Sonos … :flushed: