Device methods?

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
jkish
Member
Posts: 29
Joined: Thu Jun 07, 2007 1:17 pm
Location: Roswell GA

Device methods?

Post by jkish »

Hi,

I'm new and have been playing around with the HouseBot trial (now 3.0).

I've created some devices, tasks, and simple panels to learn how the system works. One thing that I'm not seeing is how to create methods (functions) to retrieve more complex properties or to perform more complex methods on devices.

I guess you could have a task that refreshes property values in a device periodically and processes property changes, but it seems a little disconnected and harder to bundle together. Is this the preferred method?

-John
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Post by Richard Naninck »

Once you start thinking about complex stuff, my advise is to create some script devices and have the scripts (called from tasks or always running) handle your complex stuff. VBScript is very common and is easy to use within HB. This is obviously just one method.
jkish
Member
Posts: 29
Joined: Thu Jun 07, 2007 1:17 pm
Location: Roswell GA

Post by jkish »

Richard Naninck wrote:Once you start thinking about complex stuff, my advise is to create some script devices and have the scripts (called from tasks or always running) handle your complex stuff. VBScript is very common and is easy to use within HB. This is obviously just one method.
Scripts make sense as a way to implement the methods, but I looked at the script device and it looks like there is a single script that is assigned?

One concrete example I was thinking about was a key queue device. I wanted to have panels get input from the key queue and have the UIRT and the key hooks on the panel feed the queue. Getting and setting data on the queue is small amount of code, but it isn't a straight property read. You could embed the same code in a bunch of places, but that isn't very nice. Maybe that is the way it has to work...

Nicer would be to have arbitrary methods on devices that could be backed up by scripts.
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Post by Richard Naninck »

If you look n the scripts section at my ELK M1 alarm script, you see a Sub that handles touchscreen keys. It adds 4 strokes to match a 4 digit code with a timeout of 10 seconds er key. Maybe this is what yo are looking for. All of his is done thrhough code and a single property. This single property is read by the script constantly and handled. You could task UIRT codes through this single property and handle the results in a script. Once you get the input in the script, the limit is just your ability to write good code. Limitless if you ask me.
jkish
Member
Posts: 29
Joined: Thu Jun 07, 2007 1:17 pm
Location: Roswell GA

Post by jkish »

I'm not saying that anything is "not doable" because of the structure, it just doesn't seem quite as encapsulated as it might be otherwise.

Of course, maybe I don't understand completely yet...

Thanks for the pointers.
Post Reply