You have the right to consume electricity that you produce yourself, but you must comply with the connection conditions set by the relevant grid operator. In theory, it is technically feasible to supply your heat pump directly with electricity that you generate yourself using an intelligent controller. Ideally, you should ask your installer for advice on this matter.