Assalamu alaikum,
If he saw you unintentionally from your part, there is no sin at all.
As for talking to him, you shouldn’t have done that as this is not permissible to talk to non mahram in private or to be alone with him even if for advice. You could have requested his mahram sister or mother to convey the message to him.
Anyhow, seek Allah’s forgiveness and don’t do it again and Allah will forgive you.