Abstract The energy interaction between smart homes can be a solution for developing renewable energy systems in residential sections and optimal energy consumption in homes. The main objectives of such energy interactions are to increase consumer participation in energy management‘ boost economic efficiency‘ increase the user’s satisfaction by choosing between electricity sellers and buyers‘ and reduce the electricity purchased from the grid especially at peak hours. Thus, the innovations of this study includes defining an energy exchange method between smart buildings in an off-grid mode considering renewable energy systems, considering both thermal and electrical equilibrium and studying the lightning loads. it is assumed, here, that smart homes are off-grid‘ and the critical loads are supplied by the energy transfer between the homes using mixed integer linear programming. A compromise between the cost and time interval for using home appliances is considered to provide consumer’s comfort. An objective function is introduced considering programmable and non-programmable loads‘ thermal and electrical storages and lighting loads aiming to optimize the cost of energy between different smart buildings. Based on the method, which is tested in two different cases not only does the total cost of the smart buildings decrease but also the cost is reduced significantly when lightning loads are managed.