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.
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 . Not sure why restart was required.
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.
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
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
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