Optimising hydrogen production and use