Like you mentioned, that in your experience it leave you groggy, personally I think this depends on the person and how their body reacts to beer. I've found that one beer (500 ml) at least an hour or two before sleep doesn't leave me groggy in the morning at all. If I drank beer right before sleep that probably wouldn't work well.