Search in sources :

Example 6 with HmInterface

use of org.eclipse.smarthome.binding.homematic.internal.model.HmInterface in project smarthome by eclipse.

the class AbstractHomematicGateway method initialize.

@Override
public void initialize() throws IOException {
    logger.debug("Initializing gateway with id '{}'", id);
    HmGatewayInfo gatewayInfo = config.getGatewayInfo();
    if (gatewayInfo.isHomegear()) {
        // Homegear
        availableInterfaces.put(HmInterface.RF, TransferMode.BIN_RPC);
    } else if (gatewayInfo.isCCU()) {
        // CCU
        if (gatewayInfo.isRfInterface()) {
            availableInterfaces.put(HmInterface.RF, TransferMode.XML_RPC);
        }
        if (gatewayInfo.isWiredInterface()) {
            availableInterfaces.put(HmInterface.WIRED, TransferMode.XML_RPC);
        }
        if (gatewayInfo.isHmipInterface()) {
            availableInterfaces.put(HmInterface.HMIP, TransferMode.XML_RPC);
        }
        if (gatewayInfo.isCuxdInterface()) {
            availableInterfaces.put(HmInterface.CUXD, TransferMode.BIN_RPC);
        }
        if (gatewayInfo.isGroupInterface()) {
            availableInterfaces.put(HmInterface.GROUP, TransferMode.XML_RPC);
        }
    } else {
        // other
        if (gatewayInfo.isRfInterface()) {
            availableInterfaces.put(HmInterface.RF, TransferMode.XML_RPC);
        }
        if (gatewayInfo.isWiredInterface()) {
            availableInterfaces.put(HmInterface.WIRED, TransferMode.XML_RPC);
        }
        if (gatewayInfo.isHmipInterface()) {
            availableInterfaces.put(HmInterface.HMIP, TransferMode.XML_RPC);
        }
    }
    logger.info("{}", config.getGatewayInfo());
    StringBuilder sb = new StringBuilder();
    for (Entry<HmInterface, TransferMode> entry : availableInterfaces.entrySet()) {
        sb.append(entry.getKey()).append(":").append(entry.getValue()).append(", ");
    }
    if (sb.length() > 2) {
        sb.setLength(sb.length() - 2);
    }
    logger.debug("Used Homematic transfer modes: {}", sb.toString());
    startClients();
    startServers();
    if (!config.getGatewayInfo().isHomegear()) {
        // delay the newDevice event handling at startup, reduces some API calls
        long delay = config.getGatewayInfo().isCCU1() ? 10 : 3;
        enableNewDeviceFuture = scheduler.schedule(() -> {
            newDeviceEventsEnabled = true;
        }, delay, TimeUnit.MINUTES);
    } else {
        newDeviceEventsEnabled = true;
    }
}
Also used : HmGatewayInfo(org.eclipse.smarthome.binding.homematic.internal.model.HmGatewayInfo) HmInterface(org.eclipse.smarthome.binding.homematic.internal.model.HmInterface) TransferMode(org.eclipse.smarthome.binding.homematic.internal.communicator.client.TransferMode)

Aggregations

HmInterface (org.eclipse.smarthome.binding.homematic.internal.model.HmInterface)6 TransferMode (org.eclipse.smarthome.binding.homematic.internal.communicator.client.TransferMode)2 HmDatapoint (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)2 HmDevice (org.eclipse.smarthome.binding.homematic.internal.model.HmDevice)2 ArrayList (java.util.ArrayList)1 BinRpcServer (org.eclipse.smarthome.binding.homematic.internal.communicator.server.BinRpcServer)1 RpcServer (org.eclipse.smarthome.binding.homematic.internal.communicator.server.RpcServer)1 XmlRpcServer (org.eclipse.smarthome.binding.homematic.internal.communicator.server.XmlRpcServer)1 BatteryTypeVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.BatteryTypeVirtualDatapointHandler)1 ButtonVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.ButtonVirtualDatapointHandler)1 DeleteDeviceModeVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.DeleteDeviceModeVirtualDatapointHandler)1 DeleteDeviceVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.DeleteDeviceVirtualDatapointHandler)1 DisplayOptionsVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.DisplayOptionsVirtualDatapointHandler)1 FirmwareVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.FirmwareVirtualDatapointHandler)1 HmwIoModuleVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.HmwIoModuleVirtualDatapointHandler)1 OnTimeAutomaticVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.OnTimeAutomaticVirtualDatapointHandler)1 ReloadAllFromGatewayVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.ReloadAllFromGatewayVirtualDatapointHandler)1 ReloadFromGatewayVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.ReloadFromGatewayVirtualDatapointHandler)1 ReloadRssiVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.ReloadRssiVirtualDatapointHandler)1 RssiVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.RssiVirtualDatapointHandler)1