The efficient coupling between lattice degrees of freedom and spin degrees of freedom in magnetic materials can be used for refrigeration and energy conversion. This coupling is enhanced in materials exhibiting the giant magnetocaloric effect. First principle electronic structure calculations on hexagonal MnFe(P, Si) reveal a new form of magnetism: the coexistence of strong and weak magnetism in alternate atomic layers. The weak magnetism of Fe layers (disappearance of local magnetic moments at the Curie temperature) is responsible for a strong coupling with the crystal lattice while the strong magnetism in adjacent Mn-layers ensures Curie temperatures high enough to enable operation at and above room temperature. Varying the composition on these magnetic sublattices gives a handle to tune the working temperature and to achieve a strong reduction of the undesired thermal hysteresis. In this way we design novel materials based on abundantly available elements with properties matched to the requirements of an efficient refrigeration or energy-conversion cycle.