             self.connectedHub = Duplo.TrainBase()
         }
         
+        self.isInitializingHub = true
         self.peripheral = peripheral
         centralManager.connect(peripheral, options: nil)
         

    }
    
    func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
        StoreCenter.store.dispatch(ConnectAction.disconnect)
    }
    
    func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
        StoreCenter.store.dispatch(ConnectAction.disconnect)
    }
}

    }
    
    func disconnect() {
        write(data: Data([0x04, 0x00, 0x02, 0x01])) // Switch Off Hub
        reset()
    }
    
    func reset() {
        self.peripheral = nil
        self.characteristic = nil
        self.connectedHub = nil
        self.isInitializingHub = false
    }
    
    func set(characteristic: CBCharacteristic) {
