Occasionally we suffer a power failure and my Unifi Cloud Key does not come back up properly. Sometimes it is because I shut off power to the sockets to change a face plate. In this case, I should really shut down the unifi service first, but lets face it. I will always forget.
It is a shame as this service should be far more robust and not require manual intervention when this situation occurs, but it does.
To fix the problem of the Cloud Key becoming unavailable just SSH in and fire off the following commands to reset the MongoDB Database:
service unifi stop
mongod --repair --dbpath /srv/unifi/data/db
service unifi start
I found this solution on this thread:
https://community.ubnt.com/t5/UniFi-Wireless/CloudKey-stuck/td-p/1601984