Adding a New Device
You can automatically discover devices with the IzoT Server, and you can manually add devices to the IzoT Server devices collection. You can discover or add devices to the IzoT Server using any of the following methods:
- ISI Discovery — the IzoT Server automatically discovers and adds devices that implement the ISI protocol and that have device class files defined on the IzoT Server as described in Mapping IzoT Device Datapoints to IzoT Server Datapoints Overview.
- Service Pin Discovery — you can request the IzoT Server to discover a device by pressing the Service button on the device. To discover the device, the IzoT Server must have a device class file for the device as described in Mapping IzoT Device Datapoints to IzoT Server Datapoints Overview.
- Manual Addition — you can manually add a device to the devices collection maintained by the IzoT Server as described in this topic.
The IzoT Server maintains a list of devices in a device file. On the IzoT Router and other Debian derivative platforms, the device file is /home/debian/izot-sdk/etc/lonbridge/instances/device.xml. The device file has a list of all devices discovered by the IzoT Server, and you can manually add devices to the device file. The device file also has properties for each device as described in Getting a List of Devices. When the IzoT Server discovers a new device, it adds an entry for the device to the device file, and sets the active attribute to pending. If the IzoT Server matches the program ID for the device to a device class file and starts receiving datapoint values from the device, it changes the active attribute to true. If the IzoT Server fails to read a datapoint from a device after several attempts, it changes the active attribute to marginal. If the IzoT Server fails to read a datapoint from a device after many attempts, it changes the active attribute to false.
The following example shows the contents of a device file with two devices defined:
<devices> <device nid="00D07105C253" id="7" fblock="-1" type="unknown" name="Unknown Device" brand="IzoT" active="false" pid="8000010101010421" /> <device nid="00D07110020D" id="1" fblock="-1" type="room_controller" name="FT_6000_Multi_Sensor" brand="Echelon" active="true" pid="9FFFFF0501840430" illuminance="35841" temperature="102" switch-setting-1="off" switch-state-1="off" state-setting- 1="off" state-1="off" switch-setting-2="off" switch-state-2="off" state-setting-2="off" state-2="off" /> </devices>
To manually add a device to the device file, follow these steps:
- Open an SSH console to the IzoT Server and enter the commands in the following steps.
Stop the IzoT Server:
izot_stop
If the $IZOT/etc/lonbridge/instances/devices.xml device file does not exist, create it by entering the following command:
sudo printf '<devices>\n\n</devices>' > $IZOT/etc/lonbridge/instances/devices.xml
Edit the $IZOT/etc/lonbridge/instances/devices.xml device file and add the following line at the end before </devices>:
<device nid="{macID}" id="{deviceIdx}" fblock="-1" type="unknown" name="Unknown Device" brand="IzoT" active="false" />
where {macID} is the MAC ID (also known as the Neuron ID) of the device and {deviceIdx} is the index of the device that starts from 0. Each index must be unique. This device index is not the same as the Device ID shown in the Device Browser.
For example, to add a device with a BAAACCCCBBA0 MAC ID at index 0, enter the following line:<device nid=" BAAACCCCBBA0" id="0" fblock="-1" type="unknown" name="Unknown Device" brand="IzoT" active="false" />
Restart the IzoT Server:
izot_restart