From: Kevin R. K. <ke...@kr...> - 2013-09-26 03:52:07
|
I work primarily on the Insteon code, so it is what I am most familiar with. The best example I can think of is in lib/Insteon/Security.pm, go to the end of the file and find: package Insteon::MotionSensor_Light_Level; At the very beginning of the class we define the class as a Generic_Item: @Insteon::MotionSensor_Battery::ISA = ('Generic_Item'); We then hijack the new() subroutine. Out hijacked sub() calls new() inside of Generic_Item and then adds a few attributes to the object. I hope this is enough to get you started. As for configuration, from my perspective, you would first define the alarm panel interface in your mht file. Then you would have an entry for each zone which references the alarm interface object. I am thinking of the alarm panel interface being like the PLM and the zones being similar to individual insteon switchlincs. On Wed, Sep 25, 2013 at 8:02 PM, Wayne Gatlin <wa...@ra...> wrote: > I checked out the xplademco and it doesn't seem to support relays (or i > didn't see it in the config). The problem with the onboard zones 1-7 is > that when the system is armed, you cant get the zone status. So for me I > have a sensor on my garage door that doesn't trigger an alarm, but I want > to know its status even when the system is armed. To do this you have to > program relays for each zone. > > You right about my code, I have never done any object oriented > programming. I have just picked up scripting over the years while working > as a network engineer and I just started with Perl about 8 months ago. > > I've been reading and trying to figure the generic_item and how I can use > it. I really need help with that part. I see what your talking about with > making each zone an object, but I don't know how to do that when the zones > are configured by the user and each panel supports a different amount of > zones. Could you give me an example of using the generic_item with the > alarm zones? > > > -Wayne > > > > > > > On Wed, Sep 25, 2013 at 6:11 PM, Kevin Robert Keegan <ke...@kr...>wrote: > >> Wayne, >> >> Very cool, I have planned on getting the AD2USB device for a long time >> now. You have already done a lot of work, but my initial thought was to >> use the XPLAdemco project here: >> >> https://github.com/hwstar/xplademco >> >> I had intended on getting a raspberry pi to act as the XPL gateway for >> the alarm box. I would then need to enable XPL in MH. My alarm box and MH >> server are in different locations of the house, so this made sense for me. >> >> As for your plan, it sounds like your current design is very code-based >> rather than object-based for lack of a better description. >> >> In order to truly make your work extensible, you would want to make use >> of the Generic_Item class already built into MH. I would make a Zone class >> that inherits Generic_Item and I would define each Zone as a separate >> object. This would avail you of all of the benefits of the set(), >> state_now(), and timer() functions already built into MH. This would allow >> you to fire off an action when a trigger occurs as well as make it easier >> to link the ademco zones to other objects defined within MH such as an >> insteon light switch. >> >> Alarm would also likely be its own object and class that would offer the >> same control and outputs as the alarm panel. This would also likely be a >> Generic_Item descendant as well. >> >> Next, you would want to create an Interface object that likely inherits >> Serial_Items. >> >> Finally, the mh.private.ini file should be used for settings. You would >> be better off adding an entry to read_table_A.pl for the various zones and >> alarms. Then you can define each zone and alarm in an MHT file such as >> ademco.mht. >> >> Sorry, I am sure this has been a poor explanation. I don't really have >> the software-coding lingo, but I am more than happy to answer more of your >> questions. Based on what you have achieved, I bet you have done much of >> the work already, now you just need to structure your design to fit into >> the MH structure to get all of the benefits of MH. >> >> Kevin >> >> >> On Tue, Sep 24, 2013 at 8:59 PM, Wayne Gatlin <wa...@ra...> wrote: >> >>> Hello, >>> >>> I am new to misterhouse, this is my first time using it and writing code >>> for it. I have completed the code to watch and track serial messages from >>> the AD2USB interface (from my Vista 21 alarm system). I really don't know >>> the best way to design the interface to interact with misterhouse so I will >>> explain what I have in mind and maybe someone can give me some suggestions >>> on the best way to do it. >>> >>> What I have completed: >>> - My current code watches the alarm messages, keeps track of the states >>> of the any zones you configure in the mh.private.ini >>> (This can be used to watch motion detectors and trigger lights, etc.) >>> - it also keeps track of the alarm system state (armed/disarmed/alarmed) >>> >>> Currently my code just puts the zone states in a comma separated list >>> containing the faulted zones. >>> >>> from my mh.private.ini: >>> ad2usb_relay_zone_map=14-02-006-Livingroom_motion,14-03-007-Garage_Open >>> >>> so if the Livingroom_motion and the Garage_Open zone is faulted the list >>> will be "Livingroom_motion-R,Garage_Open-R" and when the zone is no longer >>> faulted, that zone is removed from the list. >>> >>> I put the faulted zone list in a var called $faultedzonecnt >>> The alarm system state is in a var called $alarmstate >>> >>> >>> >>> The first thing I would like to do is be able to set times to alert me >>> that the Garage_Open zone is faulted via the web interface. Maybe a >>> calendar item or something. >>> >>> Next I want to watch the system alarm state and run a voice command when >>> it changes to alarmed and run another one when it changes back. This will >>> start my cameras recording. I would like to do this in a separate script >>> from the one I have already written to keep this one generic so others can >>> use it. >>> >>> Last (for now) I want to be able to send commands to the alarm system, >>> but to do this I need to be able to see the response. I've played with the >>> Voice_Cmd and got it working to trigger my zoneminder cameras, but when I >>> send a command via telnet, I cant figure out how to send a response back to >>> the terminal. >>> >>> >>> >>> -Wayne >>> >>> >>> ------------------------------------------------------------------------------ >>> October Webinars: Code for Performance >>> Free Intel webinars can help you accelerate application performance. >>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >>> from >>> the latest Intel processors and coprocessors. See abstracts and register >>> > >>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk >>> ________________________________________________________ >>> To unsubscribe from this list, go to: >>> http://sourceforge.net/mail/?group_id=1365 >>> >>> >>> >> > |