Hi, thanks for writing.
Without knowing more details about your situation I can’t give any specific suggestions, but I can give some general information.
The penis can become erect (“straight” or “hard”) at any time, whether you are with another person or alone. Erection can be caused by sexual arousal, but not always, and it’s normal to have spontaneous erections.
Some erections are caused by varying hormone levels. For example, some people experience higher levels of testosterone in the morning and can wake-up with an erection. This type of erection is not caused by sexual stimulation, but by an increased level of the testosterone hormone. These erections are normal, and can occur at different times of the day for different people, and can also vary in frequency over an individual’s lifetime.
Hope this helps! Please feel free to leave a comment or ask another question if needed.