xAP for HouseBot - and can I programatically create devices

HouseBot Plugin Development Discussions.
CouchPotatoe
Senior Member
Posts: 103
Joined: Sun Jul 31, 2005 2:43 pm
Location: Yorkshire UK

xAP for HouseBot - and can I programatically create devices

Post by CouchPotatoe »

I'm very new to HouseBot/Meedio so excuse me if these are silly questions - I'm trying conceptually to understand the best way to approach adding xAP support. xAP is a HomeAutomation protocol that presents all devices via an Ethernet connection using UDP (oversimplified). All devices are broadcast in nature and effectively networked. So I need to receive/send UDP packets - decode their format (properties) and map these to devices in HouseBot in realtime.



Ideally it seems I could make a software device plugin but my experience in C++ is nil - if it could be done in VB I would be well pleased. Maybe some time down the road...



So are there other ways to approach this ? I saw two interesting possibilities - the External control using COM and the device replication that HouseBot supports. This way I could write an external bridge application/service and link between xAP and HouseBot devices in realtime. Not ideal but perhaps a useable solution. A couple of questions.



1) Is the protocol that the device replicator uses published anywhere ?



2) Is there any way to create devices under program/script control from HouseBot. Ideally I would like to be able to add/modify/delete a software device, by modify I mean alter the number and type of properties a device has.



3) Hopefully I can accomplish 2) using the External control - perhaps by utilising a dummy device, setting properties and then launching a script to manage the device creation.



The point is that I dont want to have to manually predefine each and every xAP device in HouseBot - ideally I would like a list of discovered xAP devices and their available properties and then selectively create them in HouseBot - either via a HouseBot dialog/wizard or an external application equivalent that 'injects' them into HouseBot automatically. This way HouseBot discovers what devices are out there and offers them for inclusion.



So any pointers would be gratefully received - it appears the missing bit is device management via script/external control (device create/modify/delete) ? Having that seems to open HouseBot up to intelligent device discovery and creation, manageable via a security layer if needed, to have this accessible via External control would be even better.



Cheers Kevin



PS xAP is just a free protocol. It attempts to allow all devices to interact in a simple yet powerful way, exactly like the goals of HouseBot. xAP is not a commercial organisation - its purpose is just to facilitate making things work the way we all want them too. So no commercial angle here.



Just to give you some ideas of what xAP devices there are out there already.... things like CallerID, NewsFeeds, TV Listings, email advisors, Hardware standalone I/O controllers (using embedded xAP) 16In 16Out Serial I/O . Temp Sensors A/D convertors, mp3 player control, C-Bus Lighting connectivity, X10, Linet lighting, Dynalite lighting , Call loggers, Skype, TV OSD and LCD displays etc etc, the main plus being - if you can support xAP then all these devices become available to HouseBot :-)



http://www.xapautomation.org

some example apps http://www.mi4.biz
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: xAP for HouseBot - and can I programatically create devi

Post by ScottBot »

CouchPotatoe wrote: 1) Is the protocol that the device replicator uses published anywhere ?
No. It's a binary protocol, so it would be difficult to use anyway.
2) Is there any way to create devices under program/script control from HouseBot. Ideally I would like to be able to add/modify/delete a software device, by modify I mean alter the number and type of properties a device has.
Absolutely. The easiest thing to do is to add a "Null Device" and then right-mouse click the Device and Add Properties. If you need specific property types that contain your own values, you can use the Property Manager to create your own.
3) Hopefully I can accomplish 2) using the External control - perhaps by utilising a dummy device, setting properties and then launching a script to manage the device creation.
You can also just create a 'Script Device'. Add properties the same as you would a dummy/null device, and interact with it through the script.
The point is that I dont want to have to manually predefine each and every xAP device in HouseBot - ideally I would like a list of discovered xAP devices and their available properties and then selectively create them in HouseBot - either via a HouseBot dialog/wizard or an external application equivalent that 'injects' them into HouseBot automatically. This way HouseBot discovers what devices are out there and offers them for inclusion.
I don't think you will be able to do anything that dynamic with scripts and null devices. Even doing a plugin in C++ to do that is tricky (but it can be done, because the Device Replicator does it).



As an alternative, you might want to just create a single generic Device (instead of hardware specific devices) that contains a superset of all of the Properties needed. Or if there are just a couple of common/critical properties (like a 'status', 'power state', etc.), you can, perhaps, use the same properties for all devices??
Scott
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

There may also be a way of using Device Definition files (*.ddf) to define the various xap devices. Currently, you can create three different types of DDFs (IR, serial, windows message). Once a device definition is created, it will appear as a normal device when adding a new device to the system.



I can't remember how restrictive these DDFs are to the current three types, but there may be a way to extend them to xAP as well. I know the implementation is fairly generic and so it may be possible. Under the "Settings" main menu item, you will see the three "Configure _" options for creating the DDFs. You might want to play with it (and the XML that it generates) to see if you can get something to work.
Scott
CouchPotatoe
Senior Member
Posts: 103
Joined: Sun Jul 31, 2005 2:43 pm
Location: Yorkshire UK

Re: xAP for HouseBot - and can I programatically create devi

Post by CouchPotatoe »

ScottBot wrote:
CouchPotatoe wrote: 2) Is there any way to create devices under program/script control from HouseBot. Ideally I would like to be able to add/modify/delete a software device, by modify I mean alter the number and type of properties a device has.
Absolutely. The easiest thing to do is to add a "Null Device" and then right-mouse click the Device and Add Properties. If you need specific property types that contain your own values, you can use the Property Manager to create your own.
I meant actually to create a new device with custom properties from a script, not via any user interaction. ie I was hoping their might be a 'create device' and 'add property' type call.
The point is that I dont want to have to manually predefine each and every xAP device in HouseBot - ideally I would like a list of discovered xAP devices and their available properties and then selectively create them in HouseBot - either via a HouseBot dialog/wizard or an external application equivalent that 'injects' them into HouseBot automatically. This way HouseBot discovers what devices are out there and offers them for inclusion.
I don't think you will be able to do anything that dynamic with scripts and null devices. Even doing a plugin in C++ to do that is tricky (but it can be done, because the Device Replicator does it).

As an alternative, you might want to just create a single generic Device (instead of hardware specific devices) that contains a superset of all of the Properties needed. Or if there are just a couple of common/critical properties (like a 'status', 'power state', etc.), you can, perhaps, use the same properties for all devices??


This isn't going to be practical, xAP devices have many different properties - for example the xAP Netiom I/O board has 103 properties covering it's inputs and outputs, email applications have very different properties to say mp3 applications or C-Bus lighting. We do have a very 'basic' device that we could support that way (even called it 'Basic') but that would very much impact the usefulness of xAP



Would it not be a good idea (feature request) to have a 'create device' script command and also the ability to add specific types of properties to that device. I don't really need the device to react to anything except raise the normal events back with HouseBot when its properties are changed from xAP and to work with the external control to signal things have been changed by HouseBot - so I can propogate the change to xAP. So a Null device would be fine I guess



Kevin
CouchPotatoe
Senior Member
Posts: 103
Joined: Sun Jul 31, 2005 2:43 pm
Location: Yorkshire UK

Re: xAP for HouseBot - and can I programatically create devi

Post by CouchPotatoe »

CouchPotatoe wrote: This isn't going to be practical, xAP devices have many different properties - for example the xAP Netiom I/O board has 103 properties covering it's inputs and outputs,


Maybe I'm not visualising this device correctly - if you had a 'device' that had say 8 relay outputs on it , (you might have several of these) . I guess each output could be a separate device ?? My thoughts were that the device was an 8 output relay so you would have a device in HouseBot with 8 properties. This still doesn't help me with other devices like a TV listings application , weather forecast or television or something though. I'll investigate the DDF files, although I still can't programatically insert such a device via a script or the External control can I ?



K
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

You can't create new devices or properties from a script or external control.



In most cases, users must manually create and setup the Devices in their system from the UI. There are a couple of Hardware Interfaces that can auto-create specialized Devices, but this is not typical.



As far as a feature request for allowing scripts to add Devices dynamically, you can certainly as Meedio to implement this. However, the general idea is that scripts (and the COM external control) are for somewhat more 'lightweight' things. The function set mostly just involves setting and getting Property values. More serious Devices were intended to be developed using the "C" SDKs. I agree that the old VB SDK would be a better fit for your purpose and skill set, but even that SDK did not support all of the features as the "C" SDK (not sure if you could dynamically create devices in it.).



Your concept of a Device is correct. For a relay Device, you would likely have eight 'state' Properties that can be set to 'open' or 'closed' (or whatever names you would choose).
Scott
HB Guy
Member
Posts: 36
Joined: Fri Jun 30, 2006 3:52 pm
Location: Montréal, QC

Post by HB Guy »

<bump>

Scott:

I haven't dabbled with eXtensible Automation Protocol (xAP) yet but the breadth of available applications and supported devices is drawing me in quickly!

Here's my two cents:
It seems to me that if you could add support for xAP, HouseBot could tap into the existing pool of xAP-supported devices, the xAP developer community, and new HouseBot customers. You could focus on making HouseBot the best Home Automation Controller and let the xAP developer community shoulder some of the burden of making device interfaces.

In pre-Windows days, a word-processing company would devote valuable developer talent for creating printer-drivers (an endless and insatiable need for new and updated drivers). In the post-Windows world, they could use a standard printer model and focus all of their talent on the core product. That's the relationship I see between HouseBot and xAP.

HouseBot is a fantastic application and reflects well on your vision and talent. I'd hate to see your time and expertise spent on fine-tuning yet another hardware interface when you could be augmenting HouseBot's core feature-set. I think supporting xAP is beneficial to you, HouseBot, and your customers.

Taras
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

Yes, I've had a fair number of requests for xAP support. I believe there is another user working on a plugin for xAP. Hopefully we can have something for version 3.0 that will support it. If nobody else writes it, I suppose I can start to explore the world of xAP and write something.
Scott
erspearson
Member
Posts: 14
Joined: Sun Apr 23, 2006 5:52 am
Location: London, UK
Contact:

xAP Soon

Post by erspearson »

I am actively working on xAP support for HouseBot. I have had an alfa version running for several months. It supports xAP BSC binary and level devices. The devices can either be local to HouseBot or mirror the state remote devices. The plugin does not create devices dynamically (the original question on this thread) each has to be setup by the user but the wizard interface make tis pretty easy.

But being limited to BSC devices is quite, well, limiting. I'm currently working on how to provide more general xAP support without having to write a new device implementation for each xAP schema.

Edward
Last edited by erspearson on Mon Aug 21, 2006 11:06 am, edited 1 time in total.
erspearson
Member
Posts: 14
Joined: Sun Apr 23, 2006 5:52 am
Location: London, UK
Contact:

Dynamic creation

Post by erspearson »

Coming back to the original question of dynamic device creation. Assume that the xAP functionality is being implemented as a Hardware Interface 'xAP Network' that deals with low-level xAP message (UDP) reception and transmission coupled with various flavours of HouseBot Devices that act as proxies for remote devices out on the xAP network. Given this architecture, can you confim that:

1) Once created, the hardware interface can dynamically create devices and start to communicate with them (via a mutually defined API)
2) The devices can dynamically create parameters based on data sent to them from the hardware interface.

If true this would seem to be sufficient to support a dynamic xAP implementation.

Now this approach could potentially generate significant numbers of device/property combinations. The Netiom example cited above (which is fairly extreme, but real) has about 100 control points. This would either generate one Device per Netiom each with 100 individual properties or 100 devices each with a couple of properties. Would housebot cope with such a situation and if so which option is preferable? From a user PoV, the single device with many properties would be easier to work with.

Edward
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: Dynamic creation

Post by ScottBot »

erspearson wrote:can you confim that:

1) Once created, the hardware interface can dynamically create devices and start to communicate with them (via a mutually defined API)
2) The devices can dynamically create parameters based on data sent to them from the hardware interface.
Hardware Interfaces can dynamically create devices (using the pHB_CreateDevice callback). They can also assign Properties to the Devices. The properties have to be created (the type of property) first, which might be a problem if you were going to create a slew of new properties. It might be best to do this from the device anyway.

Devices can create properties and values and do much more dynamic things to themselves than hardware interfaces (better API for it).

As some examples,
  • The Z-Wave Hardware Interface can automatically create devices using information it queries from the z-wave controller.
  • The device replicator will create properties to match the remote device it is replicating.
Scott
erspearson
Member
Posts: 14
Joined: Sun Apr 23, 2006 5:52 am
Location: London, UK
Contact:

Post by erspearson »

OK that's cool. How do you feel about the quantity of properties/devices?
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

Technically, there shouldn't be a problem with creating a large number of properties. However, it's sometimes a pain to navigate through the UI when configuring things if there is a huge list.

Depending on what the properties are used for, you may be able to combine some into a 'composite' properties. Like if you have a "Zone n", "Device n", "Input n", type of setup, you could specify "Zone;Device;Input" as the value for a single property. Not sure if that makes sense to you, but it really just depends on the requirements.
Scott
erspearson
Member
Posts: 14
Joined: Sun Apr 23, 2006 5:52 am
Location: London, UK
Contact:

Post by erspearson »

Good to know you're not worried about any technical limitations of large numbers of properties. As I said, this is an exteme, but real example. Most other situations would be much more conservative. I understand your composite suggestion; there could be milage in that. One issue with that is the lack of richness in the script operators - there's no 'contains' operator or wildcards that would make dealing with structures like this practical in the HouseBot automation environment difficult without resorting to external scripts; something I'd like to avoid for user friendliness. You might like to consider more flexibility in this area as a feature request.

But for now I'll work with what's already available...
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

A 'contains' Task comparison operator would be a good idea. I'll add it to the list for V 3.0.
Scott
Post Reply