Understanding Controlled Via (aka Parent)

From LinuxMCE
Jump to: navigation, search


Every device must be controlled by (also known as a child of) another except for computers and devices that are stand-alone. A device's parent, or controlled via device, is the device that will be responsible for creating it. You specify what a device template can be controlled via (ie what are the eligible parents) on the Edit Device Template page in the LinuxMCE Admin Website.

Example 1

If you create a Media Player device, the controlled via device will likely be a PC. Then, whatever PC the media player is running on will be responsible for starting the media player.

If the device does not implement DCE, then the Controlled Via / parent device will likely be a device that does implement DCE and will be responsible for controlling this device.

Example 2

Say you create a device that is an interface for a lighting control system that has various lights wired to it.

There are actually 2 devices:

  1. The lighting control system, or panel,
  2. The individual lights themselves.

Likely the panel will be a device that implements DCE, either because the manufacturer specifically built the panel with an Ethernet port and the panel speaks DCE, or because someone wrote a DCE Device driver that runs on a computer and communicates with the panel some other way, like RS232. But the lights themselves probably do not implement DCE. They are just controlled by the panel, which is what should receive all the commands for the light (like on/off).

In this example, where you have a panel that will be controlled by a DCE Device, and then some lights that will be wired to the panel, you would create a Device Template for the panel that Implements DCE. It's controlled via device would be anything in the category "Computers", since the software could run on any computer.

You would also create a Device Template for the light itself, and it's controlled via would be the panel. You do not need to specify a controlled via. But if you don't, then that means the user will be able to add the light switch and specify a controlled via device of anything he wants--even, say a DVD player. Of course, the DVD player would not know what to do with this child device and would ignore it. To prevent such errors, you can specify that the light switch is controlled via the panel. Then the user can add the light switch only as a child of the panel, which will know what to do with it.

When possible, try to re-use such devices and make them general purpose. So, unless there is something peculiar about the commands your light switch will implement, rather than giving it a controlled via device of your panel, you can just give it a controlled via of the category "Interfaces/Lighting". Then anyone writing an interface for a lighting panel can use that device. You can also re-use one of LinuxMCE's generic light switch devices. You will see they have a "controlled via" of any lighting interface. This is an 'or' type of operation. If you add a controlled via device of Device Template #281, Device Template #292, and Category #9, then the user will be able to create this device as a child of either Device 281, 292 or any device in category #9.