I got a D-Link Water Sensor DCH-S160 and hoped that it would be detected by the D-Link binding. This did not work. Is there a way to configure the binding (supporting the motion sensor) to also support the water sensor?
At the moment the binding only supports the motion sensor. D-Link do not publish the API so it’s difficult to add support for other devices without having the device.
One thing you could try is to add your water sensor manually by pretending it’s a motion sensor thing. This would at least make the binding try and communicate with the device. If you also enable debug logging for the binding it should log any unexpected responses. This might provide enough information to work out what changes are needed.
Thanks for looking into this. I used the console and set
log:set DEBUG org.openhab.binding.dlink
The information doesn’t seem too much but it was the first time I used logging and I guess there are more options I could set.
I removed the thing and added it again.
log:display gave me the output below.
Can you advise me on how to get more precise information for you?
16:29:31.162 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘dlinksmarthome:DCH-S150:91e87c01’ changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
16:29:31.810 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘dlinksmarthome:DCH-S150:91e87c01’ changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR)
16:31:29.407 [INFO ] [thome.event.ItemChannelLinkAddedEvent] - Link ‘dlinksmarthome_DCH_S150_db729160_motion-dlinksmarthome:DCH-S150:db729160:motion’ has been added.
16:31:29.430 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘dlinksmarthome:DCH-S150:db729160’ changed from UNINITIALIZED to INITIALIZING
16:31:29.997 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘dlinksmarthome:DCH-S150:db729160’ changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR)
Can you try with the following:
log:set DEBUG org.openhab.binding.dlinksmarthome
Ok, much more logging now…
20:22:49.109 [INFO ] [thome.event.ItemChannelLinkAddedEvent] - Link ‘dlinksmarthome_DCH_S150_29ac5a1b_motion-dlinksmarthome:DCH-S150:29ac5a1b:motion’ has been added.
20:22:49.127 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘dlinksmarthome:DCH-S150:29ac5a1b’ changed from UNINITIALIZED to INITIALIZING
20:22:49.512 [DEBUG] [sensor.DLinkMotionSensorCommunication] - getLastDetection - Communication error
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:?]
at java.lang.Long.parseLong(Long.java:601) [?:?]
at java.lang.Long.valueOf(Long.java:803) [?:?]
at org.openhab.binding.dlinksmarthome.internal.motionsensor.DLinkMotionSensorCommunication.getLastDetection(DLinkMotionSensorCommunication.java:266) [332:org.openhab.binding.dlinksmarthome:126.96.36.199708221733]
at org.openhab.binding.dlinksmarthome.internal.motionsensor.DLinkMotionSensorCommunication.access$5(DLinkMotionSensorCommunication.java:251) [332:org.openhab.binding.dlinksmarthome:188.8.131.52708221733]
at org.openhab.binding.dlinksmarthome.internal.motionsensor.DLinkMotionSensorCommunication$1.run(DLinkMotionSensorCommunication.java:116) [332:org.openhab.binding.dlinksmarthome:184.108.40.206708221733]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
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) [?:?]
20:22:49.791 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘dlinksmarthome:DCH-S150:29ac5a1b’ changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR)
That’s interesting as it seems to have got a lot further with the communication then I was expecting. It looks like the API supports the same command that the binding uses for the motion sensor, but it’s not returning a trigger time.
Out of interest have you tried detecting water with the sensor?
If you are willing to help test an updated binding then I’ll try and add support for the water sensor, but it might be a slow process with a lot of trial and error.
I haven’t tried to detect water in context of openhab since the sensor is shown as offline.
I get a notification via dlink app and via IFTTT when I place the sensor in a glas of water and with IFTTT I can run something like “HUE lights triggered on/off when water detected”.
I would definitely be interested to help develop an updated version of the binding because I would prefer to define such rules “cloudless” in openhab.
ready for testing…
I’m also happy to provide my help here. Also just got a DCH-S160.
I guess it is more less the same as the DCH-S150 as even the trigger is working.
Just let me know what is required.
Just a reminder that I’m happy to provide help here.
yes I connected it. I use the motion detector instead.
You will see some exceptions but the trigger is working.
Has anyone tried the DCH-S161 with this?