I’m wondering if this is a valid structure for a Binding I’m looking to write for the ClearOne XAP800/XAP400 audio matrix devices:
The top-level Bridge will be a Serial connection to a stack of devices which are then inter-linked. Each first level Thing will have some Channels & Properties itself which relate to the individual device, and it has 8-12 Outputs, I’d like each one of these to be a Thing with individual channels for source, volume, mute etc.
I’ve got as far as defining the top level Bridge, which is then Discovering each top-level Thing, and I’ve added an supported-bridge-type-refs entry to the bottom-level Thing, which does allow me to select the first-level Thing, but I’m getting a “Bridge Uninitialized” error (but the Thing is relates to is online)
If this structure isn’t possible, then I’ll just go for a flatter design with the Unit and Outputs at the same level, just referencing the main Bridge (which is where all communications will need to be passed through anyway)
You may wish to look at Modbus binding. That has structure
Bridge // this defines a physical box and pathway
Bridge // this defines a group of registers and how to access them
data Thing // describes a register and how to interpret it
Bridge // some other group (usually) on the same box
Modbus is very simplistic, which at the same time allows enormous flexibility. Manufacturers all exploit this in different ways, while there is no method of self-discovery at all.
The upshot is that Modbus is a nightmare of detailed manual configuration.
The structure is rather clumsy really, but the only realistic way to allow for the flexibility. For example, the top level Bridge could be a gateway device leading to several other differing Modbus devices. The three-level structure accommodates that without further expansion, a two-level structure would have much duplication.
That’s not a recommendation to do it that way, just to illustrate that it works. As you have some discovery, choices might well be different.
Gut says a stack of devices should be represented as a Thing for stack/pathway and a Thing for each device. but I suppose it depends how intimately they are connected.