Xiaomi Aqara gateway being found but not connecting

My Hass.io install is finding my gateway but won’t connect. I’ve tried both an android phone and my iPhone and both give me the same code so I don’t think that’s the issue.

2018-05-08 03:23:56 INFO (MainThread) [homeassistant.components.discovery] Found new service: xiaomi_gw {'host': '192.168.2.61', 'port': 54321, 'hostname': 'lumi-gateway-v3_miio78801472.local.', 'properties': {'epoch': '1', 'mac': '7811dcb795e6'}, 'mac_address': '7811dcb795e6'}
2018-05-08 03:23:56 INFO (MainThread) [homeassistant.core] Bus:Handling <Event platform_discovered[L]: service=xiaomi_gw, discovered=host=192.168.2.61, port=54321, hostname=lumi-gateway-v3_miio78801472.local., properties=epoch=1, mac=7811dcb795e6, mac_address=7811dcb795e6>

This is all that home assistant is showing in the logs. I’m not really sure what the issue is.

2018-05-08 03:23:41 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: timestamp=1525749821.975924, level=ERROR, message=Setup failed for xiaomi_aqara: Component failed to initialize., exception=, source=setup.py>

Have you enabled the device mode and got the key/password setup correctly?
Perhaps post your config so someone can check that?

Looks like it was caused by my router not sending multicast packets to my other port since it was on another VLAN.