Привет Евгений,
Of the second pair, the first is certainly incorrect because of the wrong tense: "you are going to come yesterday" is impossible. The second sentence is completely correct.
Of the first pair, technically I think that they both could be correct, but they are both a little clumsy. Probably better to say, "If I had known that you were (or are) going to come by tomorrow, I would have been in then." The "I would have been in then" implies "I would have intended to be in then," or "been sure to be in then," or "made it my business to be in then." These intentions, although in the future, precede the other person's coming. Relative to the other person's coming, they are in the past. Therefore, "would have."
The choice of "were/are going to come" I think depends on whether you are shading the meaning to indicate that it was, or was and still is (if you know) the person's intention to come by tomorrow. Maybe he is coming to see someone else.
I hope this helps. I think these nuances would be difficult also for some native speakers of English to grasp. Кстати, я пытаюсь нацчиться говорить по-русски.
George