The aim of the project is to develop, implement and test a controller for advanced hybrid system with a heat pump enabling an interaction with a local PV system and interaction with the grid while knowing the dynamic price of electricity and / or quality of the supplied energy mix in terms of CO2 emissions. The aim is to minimize CO2 emissions associated with the operation and to minimize building operation costs. The project will also build a laboratory system for testing such a system under dynamic boundary conditions with physical emulation of heat loads, PV electricity production and grid demand based on parallel simulation with defined climatic conditions to control the provision of internal comfort. Hybrid system with the implemented controller will be demonstrated in real building.