On a polyphonic instrument like the harmonium, "playing by ear" really refers to three separate but related skills.
One is the ability to hear and predict, Markov-chain style, the chord progressions in a song. This actually isn't very difficult, once you realize that 1) all songs make use of exactly the same handful of existing chord-to-chord transitions, just shifted depending on the root chord (key) the sheet music is written in, 2) some chord transitions are vastly more common than others, and 3) each transition has a distinct feel, which your brain soon learns to appreciate with an intuition similar to that you have for language.
Thus, it helps to re-write each piece of sheet music into C before you play it ("normalization", if you will), so you can see and hear the essence of e.g. C→G across the context of different pieces. Later, go around the circle of fifths, so you can see the patterns reappear in keys other than C. Music theory textbooks use tables of Roman numerals for this, but those only make sense to people who already have the intuition anyway. But there are good videos on this, like https://www.youtube.com/channel/UC8qv5hZppyGQbe9laVKwg3w.
Playing chords by ear is a very satisfying feeling, because it gives you the illusion that you're 80% there with 20% of the effort. It also translates easily to other instruments.
Second is the ability to hear and play back melodies. This comes with practice. Trial and error, hit and miss ... until your miss rate goes down, which it will, slowly, over time, asymptotically approaching zero. As you practice your intuition for chords, however, you will soon know what certain intervals (especially 3, 4, 5) sound like, and that will often help you find the right next note. When you hit a plateau, read up on different types of scales – knowing "this part of the melody is mixolydian" will prune the search tree for you.
Being able to pick out the right note without thinking will turn the instrument into an extension of yourself, just as you sing or whistle without thinking. However, you may well be a proficient amateur harmonium player long before you can reproduce any complex melody completely error-free, so I don't know that it's something worth obsessing about.
Third is the ability to play more than just simple triads and monophonic melodies, but to add patterns and rhythms and chord inversions and "crunchy" notes (sus, dim, maj, 6, 9, 13, etc.) and improvisations on the melody. Those aren't self-contained skills, but rather a repertoire of tricks that you acquire as you play and analyze other people's music, and there are lots of textbooks and videos on them. Those don't do that much for your perceived level of "fluency", but they do make you feel "eloquent" and they're great for your ego.