This problem occured randomly. I have this problem for a week now.
My phone does not connect to the router, although it shows it in the list. If I get very close to the router (max. 2-3 meters) it does work.
I have tried setting the router to 5 or 2.4Ghz and tried different channels. The router does not show any problems. Also deleting the WiFi profile on the phone and re-adding it normally or via WPS does not help. I even installed another ROM on the phone (was on a 5.1.1 ROM, changed to stock one).
The connection works fine on at least 10 other devices (no, they are not connected at the same time, that's not the problem ^^)
Phone: Sony Xperia Z, newest firmware (Android 5.0.2) Router: Fritz!Box 7490, newest firmware (113.06.30)
Thanks for your help!