The connection unit should measure voltages on both sides of the unit (private system, the micro grid) and decide whether to provide power to the grid, or pull energy from the grid. Doing either one, it should keep track of the energy consumed or provided. It should safeguard itself and the private system by checking for over-voltage in the grid, under-voltage in the private system (to protect batteries from depletion), excessive currents and other potential dangers. The information it gathers should not only be used internally, but also provided to the user, e.g. via a WiFi or BLE interface, or longer range technologies such as LoRaWAN. It could also provide additional adaption to the grid, like DC-DC-conversion if the grid is operated at a different voltage than the private system.
Note: This is for now mostly mirrored content from the Design For A Cause 2021 contest over at Element14.