A homeless man has avoided jail after admitting to breaking into a community centre to take shelter from Storm Éowyn.