Data Sharing between controlers
adys
Posts: 395
Hi guys
how can I share the data of the statuses between cotrolers?
For example, in the Master that connected to the Lutron lighting system, I will hold a table with the current states of the lighting system (ONLY on this Master)
How will you recommend to share the data beween all home controllers that need to enter to the lighting screen and to fetch the current statuses?
As I see it ths simple way is to make all the relevant lighing screens handling in this controller for all the TP.
But what if now I have some screens that relate to other controller that need to get status from this controller?
I don't want to listen to status change in each controller.
Any tricks for this?
thank
Adys.
how can I share the data of the statuses between cotrolers?
For example, in the Master that connected to the Lutron lighting system, I will hold a table with the current states of the lighting system (ONLY on this Master)
How will you recommend to share the data beween all home controllers that need to enter to the lighting screen and to fetch the current statuses?
As I see it ths simple way is to make all the relevant lighing screens handling in this controller for all the TP.
But what if now I have some screens that relate to other controller that need to get status from this controller?
I don't want to listen to status change in each controller.
Any tricks for this?
thank
Adys.
0
Comments
Assuming that the second controller isn't meant to change the data on the first controller - the transfer is one-way:
You could set up a mechanism so that any state change on one controller is immediately replicated to the other. It would be easy to code, assuming limited state volatility wouldn't add excess load, and would be plenty fast.
Ideally hold the state in a generic format eg an array of integers subscripted by a set of constants. Always update the state indirectly through a routine which also checks for a change of state and sends a notification string (array subscript plus new value) to the other controller. On the other controller accept the string and update an array that mirrors the first.
This code is of course very reusable. Here is a first draft neither compiled nor tested:
SOLUTION 2
Alternatively use one or more virtual devices in the same way. I haven't done this but I believe it works. It would be good to hear from someone who has done it.
In controller 1, create a virtual device and use its levels and channels as places to store information in the same way that I use the generic repository in the method above. Channels are binary repositories; levels offer values 0-255.
Master-to-master makes that device and its attributes seamlessly visible on controller 2.
If you access this device at both ends via a single routine (or two), you can change your mind about it, extend it, or re-implement it very easily. That is, for instance, you can change from solution 1 to 2 without messing with your code.
This code is also very reusable.
(**********************************************************************************)
(* MASTER-TO-MASTER COMMUNICATIONS: THE vdvCOMM VIRTUAL DEVICE POINTS TO THE *)
(* MASTER IN THIS ROOM. CHANNELS ARE SET TO INDICATE THE STATUS OF VARIOUS *)
(* OPERATIONS. *)
(* CHANNEL 1 ON INDICATES THAT A IS IN COMBINED MODE WITH B. *)
(* CHANNEL 2 ON INDICATES THAT A IS IN COMBINED MODE WITH C. *)
(* CHANNEL 2 CAN NOT BE ON UNLESS CHANNEL 1 IS ALSO ON. *)
(* CHANNEL 11 ON INDICATES THAT ROOM B IS IN USE. *)
(* CHANNEL 12 ON INDICATES THAT ROOM C IS IN USE. *)
(* ROOM A CONTROLS CHANNELS 1 AND 2. ROOM B CONTROLS CHANNEL 11 AND *)
(* ROOM C CONTROLS CHANNEL 12. IF SATELLITE ROOMS ARE IN USE INDICATED BY *)
(* CHANNELS 11 OR 12, THEN A WILL NOT BE ABLE TO ENTER COMBINED MODE WITH *)
(* THAT ROOM. *)
(* LEVEL 1 WILL CONTAIN THE VALUE OF THE ROOM CURRENTLY CONTROLING THE VTC *)
(* LEVEL 2 WILL CONTAIN THE VALUE OF THE ROOM CURRENTLY CONTROLING THE DVD *)
(* LEVEL 3 WILL CONTAIN THE VALUE OF THE ROOM CURRENTLY CONTROLING THE VCR *)
(* LEVEL 4 WILL CONTAIN THE VALUE OF THE ROOM CURRENTLY CONTROLING THE WIRELESS *)
(* MICROPHONES. *)
(* A VALUE OF 3 INDICATES THAT THE DEVICE IS FREE. *)
(**********************************************************************************)
vdvCOMM = 33050:1:201 // INTER-ROOM COMMUNICATION
This particular application had three rooms, each having a master. The rooms could be combined (0 and 1 or 0 and 1 and 2) or used as separate systems. There are four devices that are shared by the three rooms. These are the Video Conferencing system, the DVD, the VCR, and the wireless mics.
In the setup of each room, I assign a room number to a persistent variable. For the shared devices, the room that has the device "reserved" sends their room number as the level value for that particular device. When the value is 3, the device is available. If I do it again, I would probably number the rooms 1, 2, and 3 and have the 0 to indicate that the device is available. I don't know where my head was that day.
Anyway, I use send_level, level_event, channel_event, and so on against this virtual device to maintain the status of the system. Since the device buttons are available on the touch panel in each room, I use the level of a particular device to change the icon on the buttons, so that if room 1 is using the DVD player, the circle and slash symbol appears on the DVD buttons on the touch panels for rooms 0 and 2.
In other sites, I have also used channels to indicate which lighting preset is currently in use by the main room, so that if the rooms are combined I can tell the Lutron in each system to select the same lighting preset.
This method is easy to use, and the response is good since you use channel and level events to keep the mutiple systems in sync.
the second solution look good to me too.
Can anyone give a few words/resource/examples on channels and levels?
I looked at the programming manuals - very few words on those subjects and I think I miss the basic idea on channels and levels...
thanks
Ady
Neither compiled nor tested:
Danny, thanks for the example, much clear how to do it now.
What generate the channel event?
I searched anywhere for info on levels and channel, and there very basic informaion on this topics...
It works just like normal channel events. Any of the masters in the system with the virtual device defined can make changes to channels and levels.