A conventional solar inverter receives DC power from the solar panels and convert to AC power. A bidirectional solar inverter can additionally convert AC power to DC power for battery charging (if required). The inverter automatically detects availability of AC supply and changes operation mode from inverter to charger and charges the battery if solar power is not available.