View Full Version : Security Device Types
harleydude
November 5th, 2006, 07:35 PM
With the Elk there is the ability to turn an output on, on for a specified amount of time, off or toggle it. What device type would be recommeded or does a new type need to be created?
Promixis
November 5th, 2006, 08:06 PM
I think a new device type is suited for this... the HAI offers this but I did not export that functionality to the DM -> prefering to control timing within G4.
So, I would inherit from the switch device and add an option to set time as a user input.
BTW, how is the Elk plugin working?
Great too see you digging into the DM. Post away with any questions.
Promixis
November 5th, 2006, 08:07 PM
On second thought, for now, just use a switch device. We should work this out internally I think. Also, want to see what Rob thinks.
Rob H
November 6th, 2006, 01:52 AM
Sounds like a new device type to me. Nice thing is that the provider can either handle the timing internally or hand it over to the real hardware if it offers that functionality.
harleydude
November 6th, 2006, 12:31 PM
Ok, got bored at work today and threw together a new device to handle outputs. Hope I am not getting to far ahead of the game here. Here is what I added to the security.lua file.
--[[
SEcurity Output Device Class
--]]
local SecurityOutput = Sensor:New ( {
Type = 'Security\\Output',
AddControls = function (self)
Sensor.AddControls (self)
local StateControl = DeviceManager.Controls.Classes.RadioButtons:New ( {ID = 'State',Name = 'Output State',Device = self,Values = self.StateValues or {'On','Off'}, Command = self.StateCommand})
self:AddControl(StateControl)
end,
} )
I also created a DUI Action for the device and have that working, it reacts to device state changes and provides information to the provider when the action is initiated. I would like to notify the provider about the hours/minutes/seconds to leave the output on, how do I provide that info to the provider? I have looked at the action code for the lighting action and see how this can be handled internally by G5, but would also like the option of being able to have the Elk handle timing as well.
Rick
Promixis
November 6th, 2006, 08:54 PM
Rick, I would use the standard switch device from the Lighting.lua file.
As for time, I am not sure what is best. ie. the time is really controlled via the external device. You can set up a device to SET that time but I think it should only track that time if the Elk constantly reports the time. Does it?
Rob and I have been discussing on how to have a Time control for entering a time. We need to plough through a few different scenarios first. Its not that its not doable... its just doing it right the first time. Sometimes that happens :D
harleydude
November 8th, 2006, 10:57 AM
Will use the switch device for now. I am going to install G5 on my main server this weekend and do some more testing with my Elk script. If all goes well will leave it there for more time. If I have troubles is there any problems with having G4 & G5 on the same machine?
As far as the time issue, with the Elk I can send a command to the unit to instruct it to turn an output on for 0 - 65535 seconds, 0 being on indefinitly. The Elk will then handle turning the output off at the appointed interval.
From what I have seen so far the DM is really impressive.
harleydude
November 9th, 2006, 08:19 PM
Well tonight I was thinking about some of the things that I will need to change in order to move my Elk script to G5 and use the DM. I only want to create devices that are actually being used, ie areas and zones. To do this I need to poll the Elk for the information. Previously I would issue the needed commands and let it go. This process could take several minutes to complete.
I assume now that I will need a more controlled process for getting the data collected and once collected then start the DM. Does this sound right?
Rick
Promixis
November 9th, 2006, 08:39 PM
Hi,
Here is what the HAI plugin does....
1. it queries the controller and gets a list of all devices ie zones, units, hvac etc.
2. it then starts the provider
3. provirder requests all of the above
4. provider only exports devices that have real names (ie not default) to the DM
i would add a publisher to the Elk plugin if one isn't there. this concept is key to everything in G5 publisher/subscriber
harleydude
November 9th, 2006, 09:10 PM
In its current state my plugin uses hard coded tables with area and zone data that is loaded in the Initialize() routine. Also in the Initialize() routine I am starting up the Elk provider which reads the area and zone tables and loads them into the DM. This appears to work fine.
However to get the same data from the Elk I will have to send 8 areaname commands and 208 zonename commands and wait for them to all be processed before starting the DM. This process can take a minute or more to complete. I need a method for knowing when the process is complete.
Or could I start the provider during the Initialize() routine, but not load the devices. Then as the devices are discovered add them to the DM similar to the way the W800 adds new devices???
Rick
Promixis
November 9th, 2006, 10:04 PM
You can start the provider whenever you want. It should be able to add and remove devices on the fly.
In the future, the DM interface will allow you to exclude devices from being seen by users of the DM. It will also allow you to retype some devices ie a light to an appliance etc.
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.