Local valence instabilities and mixing in rare-earth semiconducting compounds