Answer can be found in this topic: https://community.home-assistant.io/t/conditional-split-energy-consumption