The electricity wholesale hourly price can vary significantly during the day. The installation of solar panels and batteries helps to address this problem, but only to a limited extent. To properly react to changing grid price while also considering other factors such as production amount, level of the desired user comfort, it is necessary to predict energy production, energy consumption, and perform optimisation of energy consumer and battery operation modes. The optimisation task must be resolved in a short period of time since it should be repeated frequently to address deviations from the predicted energy production and consumption. The goal of this research is to develop the optimisation algorithm, and the predictive models needed for edge-cloud-based power resource management and balancing platform orientated towards office buildings. The models maximise the use of renewable resources, minimise electricity costs, and ensure the desired level of user comfort. The preferences between costs and user comfort can be passed as weights for the optimisation algorithm.