LinuxMCE Forums

General => Developers => Topic started by: mkbrown69 on October 09, 2013, 06:55:36 pm

Title: Need some design advice
Post by: mkbrown69 on October 09, 2013, 06:55:36 pm
Good Day folks!

I'm hoping Thom, posde, phenigma, or anyone else who's familiar with the guts of LMCE can sanity check and provide some advice on what I'm thinking below...

I'm working on my ISY driver, and getting to the parts where it will create devices in LMCE based on what exists in the ISY.  The idea is that the ISY "owns" the devices that are linked to it (Insteon for now, possibly UPB and Zwave in future versions of the driver and hardware), and it will inform LMCE about the devices and their configuration.  Generally, that is easy and works presently in my driver.  The way the ISY works is that there is a Java-based management console that is used to configure and administrate the system, and add and mange connected devices.  The API and subscription channel are used to interact with and monitor/react to events from the ISY, for integration into Home Automation systems.  Most things are fairly straight forward to implement from the LMCE point of view. There are a few devices/features I'm not quite certain as to the best way to implement them, which is why I'm asking for advice.

The first is Insteon keypads (Dimmer or relay switched).  There are 6 and 8 button models; the 6 button has an 'on' and an 'off' button (which appears as one load control switch remotely), and 4 other buttons.  The 8 button model has one load control button, and 7 other buttons.  The other buttons can be triggers for Insteon scenes (which I'll get to next), or can be cross-linked to other switches.  For example, I have a 6 button KeypadLinc in my breakfast nook, that is linked to the switches in the kitchen and family room.  Now, I could create a device template for it, but I think I could simply use the generic Light Switch on/off and Light Switch dimmable templates, and use the configuration field to store the required information.  Here's the part I'm not sure about.  The "other" buttons are a part of the switch, but are not controlling the parent switches load (unless they are part of a scene involving the parent switch).  Is is possible to create child devices of a generic light switch, and would it be a good ideal?  Or should they be treated as peers and grouped or related somehow?

Insteon Scenes are my next challenge;  basically, they are a pre-programmed into the various devices which comprise the scene (using a scene identifier, level, and ramp rate), and then are triggered by the scene broadcast message.  The nice thing about scenes is that they happen simultaneously (all member devices respond to the broadcast message directly), and being programmed into the target devices, they work even if the automation controller goes down.  Scenes triggered via the protocol have an on/off capability, and a relative dim/bright capability (in which all scene members will brighten or dim as the scene button is held, relative to their scene levels).  The thing is, a scene can't be queried directly; it's just a broadcast message on the Insteon network.  Scene members have to be queried directly for their status (and that's covered already in the subscription channel in the driver).  So, I'm wondering if I should create a device template for an "Insteon Scene", which has a data field consisting of the members of that scene?  Or would an LMCE group work?  If an LMCE group would work, can I generate and modify them using LMCE events?  Or should just use a generic light switch for a scene, and handle it all in my driver using the configuration field information?

The last thing I'm wondering about is the ISY concept of "folders".  The ISY has a feature (not Insteon specific) that allows you to group related items (by room, by function, whatever).  A device/scene/program can be assigned to only one folder.  Would that capability translate directly to an LMCE group?  If I were to use groups for ISY folders, are there any problems or gotchas with doing that?  Can I create/modify groups using LMCE events?

The ISY also has "programs" and "variables" which are used on the controller for conditional if/then/else type events and automation.  Those are all visibly exposed via API's and the subscription channel for event status updates.  I'm not even looking at dealing with them right now, is this version of the driver.  I'll look at those later when the driver is mature and stable for production usage, but if anyone has thoughts on those, I'd be happy to hear them!

Thanks for your time!

Title: Re: Need some design advice
Post by: Marie.O on October 09, 2013, 09:50:50 pm
you might want to touch bases with hari, and discuss his design decisions for the agecontrol, sorry, agocontrol gateway into LinuxMCE.
Title: Re: Need some design advice
Post by: mkbrown69 on October 10, 2013, 01:35:50 am
... and discuss his design decisions for the agecontrol, sorry, agocontrol gateway into LinuxMCE.

I'm guessing there's something behind the "slip", but I'm missing it...   ;)

Thanks for the pointer though... I have been watching AgoControl, as I think it has potential as a Home Automation sensor platform when running on a PI.  Just don't have the extra cycles right now... Doing the ISY driver, plus building LED DMX dimmers and fixtures plus some props with the kids for Halloween and Christmas.  I'll go bonkers if I pickup another hobby project.  ;-p


Title: Re: Need some design advice
Post by: mkbrown69 on November 07, 2013, 01:58:58 am
Still plugging along...

Question to the experienced LME users and devs...  So, my driver starts up (after a boot or router reload), it connects to the ISY, retrieves managed devices from the ISY, and creates LMCE child devices for any ISY devices it finds that LMCE doesn't know about.  We can't use them yet, because they were just created, and the router needs to be reloaded...

Would it be considered "good behavior" if I programmatically trigger a router reload so that devices can be used, or is it preferred to just tell the user to do it, and let them decide when to reload?


Title: Re: Need some design advice
Post by: tschak909 on November 07, 2013, 04:12:10 am
The user should do the reload, simplest reason: because we're never quite sure what else may be going on in the house.

but, if you want to do it yourself, you merely need to send a message, of type MESSAGETYPE_SYSCOMMAND, and the command ID would be 1. You can see what's going on in src/DCE/Message.h, grepping for SYSCOMMAND.

Title: Re: Need some design advice
Post by: mkbrown69 on November 23, 2013, 04:35:07 am
More progress and more questions...

I'm using event 765 (Set Device Relations) to establish the relationship between a Keypadlinc and it's buttons.  It works, and I'm able to show the buttons as related devices.  I'm wondering what the 'value' field in the schema is for?  I'm also wondering if I'm using this "related devices" correctly?  Basically, the buttons are physically part of the same switch, but are separate from the load, and seperate from each other.

I'm also curious about the difference between the Device Group and the "related devices" ;  the one notable difference I saw was that you can create "related devices" programmatically from GSD, but I don't see a way of doing it from GSD driver for Device Groups.