Question about binary sleeping device.

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
Maverick
Posts: 4
Joined: 23 Oct 2014 04:42

Question about binary sleeping device.

Post by Maverick »

Hi everyones
I m new to razberry, now im at the point that I would like to make an alarm system for my house and I got few question about how dealing with binary devices such as Door/Window contact motion detectors etc.

I'D like to know how should I manage the contact, first by polling every 5 or 10 seconds the state of the device or Second, is thres a way to catch the device changing state.

Thank for response and if you could add an example I'll apreciate it

Regards, thanks in advance.
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: Question about binary sleeping device.

Post by pofs »

Of course you may (and should!) catch events from devices when possible. Polling a battery device is:
a) useless, because device actually sleeps most of the time, and no requests would be delivered until it wakes up, and
b) energy inefficient, because frequent wake-ups drain battery pretty fast.
So battery devices always support events. Most mains-powered devices have them too, but some of them (usually old ones) might have not.

Normally a sleeping device sends periodical updates to controller about battery status (usually like once a week), and alarms in case something happens (smoke, break-in, flood, motion etc.). The controller then handles them whatever way you want/made it to. For example, it could turn on a siren, turn off water, notify you with text/email, take some pictures from webcams, call the police etc.
Of course, in case of an alarm system you should think about a decent backup battery supply for your controller (in case of power outage), and maybe a cellular module to handle notifications when Internet connection is unavailable.

In terms of RaZberry/Z-Way, each device has a set of command classes it supports, each of them having some characteristics (we call them Data Holders, or DH). When some update comes from a device (either as a result of polling, or when device issued some event), one or more DHs are updated. You can bind a callback to one or more of DHs, so when it changes your code gets executed. You might then send a command to other device(s) in your home network, execute some shell script, perform HTTP request to some server etc. Some typical cases are already implemented as a set of modules, the complex ones might need some programming.
Maverick
Posts: 4
Joined: 23 Oct 2014 04:42

Re: Question about binary sleeping device.

Post by Maverick »

thanks thats what I had in mind polling would drain the battery and I need to read about the data handler because I'm making a custom app. So far i have success with the lighting but I'd like to add security devies

thanks
Post Reply