DLink WiFi Motion Sensor (DCH-S150)

I’m currently using one of these motion sensors, but it’s a little slow to respond due to requiring the use of IFTTT to integrate with OH.

It’s possible to retrieve the last motion time through the HNAP interface so it should be possible to develop a binding.

Before I start I just thought I’d check to make sure no one else is working on something similar.

I now have a working binding and the response time is 2-3 seconds faster than using IFTTT/myopenHAB.

org.openhab.binding.dlinkmotionsensor-2.1.0-SNAPSHOT.jar

Pull Request

What is the overall latency now?

Hi,

I have purchased this sensor today and just hooked it to my wifi. Works well within MyDlink app, detects movement quicker then originally anticipated.
Next step is to add to openhab (version 2.4.0-1). Then installed D-Link binding. Binding could not discover sensot automatically so had to add it manually, correct IP address and Pin code from the box.
However it is still showing communication error offline see attached graphic below. I have not linked any items yet but as I far I am aware it should be visible as ONLINE, unless I`m missing something.

DCH-S150

What does openhab.log have to say about it? The binding should produce initialization messages.

Can`t find many records in log file related to this sensor apart from this INFO

2020-03-29 15:04:52.374 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'dlinksmarthome:DCH-S150:908d78a119ab' to inbox.

An update - retyped sensor pin code once again and still didn`t worked. Then restarted openhab service and thing has changed status to ONLINE so it works now :wink:. Not sure why restart was required.

Basic question regarding linking an item and displaying on sitemap. I have created an item called MotionDetector1

Item:

Switch MotionDetector1 "Sensor" <switch>  { channel="dlinksmarthome:DCH-S150:475f3f10:motion" }

Sitemap:

Text item=MotionDetector1

In Paper UI is asking me to choose profile when attempting to link an item…
Not sure about this profile, anyone know this ?

DCH-S150_2

Maybe I over complicating this, only need to link this item and display it in sitemap

Use default profile.

Thanks for the suggestion, it is not allowing me to enter a profile name and there aren`t any profiles to select from drop down menu.

I have figured that out. For anyone working with this sensor in the future use the following setup

item:

Switch MotionDetector1 "Sensor" <switch>  { channel="dlinksmarthome:DCH-S150:475f3f10:motion" }

Sitemap:

Default item=MotionDetector1 label="Motion [MAP(motion.map):%s]"

Rule:

rule "Motion Detection"
when
    Channel "dlinksmarthome:DCH-S150:475f3f10:motion" triggered
then
    MotionDetector1.sendCommand(ON)
end

So how it works now is when motion is detected it switches MotionDetector1 switch to ON position.
Then this switch will remain in ON position forever so need to change to OFF after X minutes.
Not sure how but will update as soon I got a solution.

This is what expire binding is made for

I have my rule modified and also using expire binding now. Works partly as expected.
When the motion is triggered it will activate the switch and expire binding will switch it off after period of 2 minutes. But as I added notification to alert me about this event, each take I walk pass the sensor it triggers the notification again , even the switch is still on. What I wish to achieve is the condition when the switch is still active (within this 2 minutes of expire timer) , ignore the notification alert and extend or reset timer again.
How can I overcome this then, I though I got it but not quite right yet :thinking:

Items

Switch MotionDetector1 "Sensor" <motion>  { channel="dlinksmarthome:DCH-S150:475f3f10:motion" ,expire="2m,command=OFF" }

Rule

rule "Motion Detector D-Link DCH-S150"
when
    Channel "dlinksmarthome:DCH-S150:475f3f10:motion" triggered
then
    if  (MotionDetector1.state != ON)
	MotionDetector1.sendCommand(ON)
	sendNotification("andy31xxxx@xxxx.xxx", "Someone by the front door")
end

How could openHAB detect that the sensor is still active? So far as I can make out, you have an event for “motion begins” and that’s all? Neither “ended” nor “still got motion” events?

Mind you, I’m not all sure what your rule is about. Do you ever see commands in your event log? I suspect it never runs, because that channel is not an event/trigger channel, it is a state updating channel.

EDIT - okay, checked docs it is an event/trigger channel.

That means your Item definition is nonsense. You cannot link a trigger channel to an Item state (which is probably why PaperUI wouldn’t let you do it). The docs don’t suggest linking to Item anywhere.
Change to

Switch MotionDetector1 "Sensor" <motion>  {expire="2m, state=OFF" }

We needn’t use commands at all with this Item, and not doing so is more consistent with normal openHAB sensor usage.

Okay, change your event responding rule to

rule "Motion Detector D-Link DCH-S150"
when
    Channel "dlinksmarthome:DCH-S150:475f3f10:motion" triggered
then
   MotionDetector1.postUpdate(ON)
end

Assuming your sensor does send repeated triggers, this will keep updating your Item.
The updates even if already ON, will re-start the expire timer, so it will revert to OFF only after 2 mins with no activity.

Now send your message only when “new” motion is detected

rule "Motion Detector D-Link DCH-S150 messaging"
when
    Item MotionDetector1 changed to ON
then
    sendNotification("andy31xxxx@xxxx.xxx", "Someone by the front door")
end
1 Like

@rossko57 indeed this works great now, tested all behave well as expected.
Many thanks for fixing this for me.