Let $X$ be a connected CW-complex with $\pi_k(X)$ trivial for $k >2$. Is it known under which circumstances $X$ is an $H$-group?

I have been able only to deduce the necessary condition that $\pi_1(X)$ has to be abelian and act trivially on $\pi_2(X)$. Furthermore, if the necessary condition holds, vanishing of the Postnikov invariant $\beta \in H^3( \pi_1(X), \pi_2(X))$ is a sufficient condition. Thus the interesting case is that of $\beta$ nonzero.