use of org.openhab.binding.insteonplm.internal.device.DeviceType in project openhab1-addons by openhab.
the class InsteonPLMActiveBinding method makeNewDevice.
/**
* Creates a new insteon device for a given product key
*
* @param aConfig The binding configuration parameters, needed to make device.
* @return Reference to the new device that has been created
*/
private InsteonDevice makeNewDevice(InsteonPLMBindingConfig aConfig) {
String prodKey = aConfig.getProductKey();
DeviceType dt = DeviceTypeLoader.s_instance().getDeviceType(prodKey);
if (dt == null) {
logger.error("unknown product key: {} for config: {}." + " Add definition to xml file and try again", prodKey, aConfig);
return null;
}
InsteonDevice dev = InsteonDevice.s_makeDevice(dt);
dev.setAddress(aConfig.getAddress());
dev.setDriver(m_driver);
dev.addPort(m_driver.getDefaultPort());
if (!dev.hasValidPollingInterval()) {
dev.setPollInterval(m_devicePollInterval);
}
if (m_driver.isModemDBComplete() && dev.getStatus() != DeviceStatus.POLLING) {
int ndev = checkIfInModemDatabase(dev);
if (dev.hasModemDBEntry()) {
dev.setStatus(DeviceStatus.POLLING);
Poller.s_instance().startPolling(dev, ndev);
}
}
m_devices.put(aConfig.getAddress(), dev);
return (dev);
}
Aggregations