Question to Matt and Jay and anyone who whats to chime in.
the subscribe method works fine for event type of messages eg sensor is up.
I am struggling with how/when to transmit / receive Meta data, ie which device state is participating, active, suspended , deleted ..
Here is what I would like to do:
ONE plugin will receive data from SEVERAL other plugins
in the plugin I am planning there will be menus where the user can select
1. ids of plugins that supply the information to be collected ("simple list of all active plugins minus - obviously not qualified for the task), this is "easy"
2. select individual devices from these plugins that are used to perform the functions
The second part is not . Where should the master data be managed - ie which devices/states participate in the send plugins or in the receiving plugin.
A) if the meta data management is done in the sending plugins they need to be able to tell in a managed way to the receiving plugin: here is my offer, take it or leave it-- no response required
-- issue: these message must be send when the receiving plugin is able to receive, so it has to be repeated in some frequency, doable
-- EACH of sending plugins will need to setup menus to manage which device/ state are participating -- menus: could be one central or a field in device edit for each device
B) if the receiving plugin is able to request the device/state participation there must be a 2 way message stream
1. receiving plugin sends a request, and 2. the sending plugins answer with the meta data and will setup the device/state event data stream.
Option A is easier to control but would require that each sending plugin adds a menu to manage the device/states that participate
Option B is easier for the user, one central place /menu where everything is managed, but the communication requirements become much more involved.
- either through action methods or through subscriptions, but that is much more involved, each sending plugin then needs to define which one it will partner with
So here my current thinking:
the receiving plugin does 90% of the work
1. in menu define sending plugins
2. in menu select devices from all indigo devices to participate
3. send action method requests to the sending plugins: I want data from this device/ state, please setup "indigo.server.broadcastToSubscribers(messageType, device/state data)"
4. will receive event data through subscriptions "indigo.server.subscribeToBroadcast(senderpluginId, messageType,device/state data)" for each sending plugin
the sending plugins will need to
1. setup receiving action method
- receive requests to add/remove device/.states to subscription
2. send broadcasts for the selected devices.
Q: does this make sense?
Karl