The development of renewable energy sources, using the Combined Heat and Power (CHP), along with controllable appliances, has provided new opportunities for scheduling resources and consumption in smart homes. This paper proposes a framework for the optimal scheduling of electrical appliances and sources of electricity and heat in a smart home. The smart home is able to purchase electricity through bilateral contracts and spot market. Real-Time Pricing (RTP) and Inclining Block Rate (IBR) tariffs are considered in the spot market. Uncertainties related to production of renewable resources, spot market prices and usage time of inelastic non-shiftable appliances are modeled by scenarios. The presented framework is modeled as a two-stage stochastic optimization problem, with the aim of minimizing the expected cost of the smart home. Then, the problem is formulated in the form of MILP problem. The simulation results showed that the cogeneration of electricity and heat significantly reduced the expected cost of the smart home by 125% compared to the base case study. Meanwhile, the Peak to Average Ratio index (PAR) due to the distribution of consumption along the scheduling horizon has decreased by 35% compared to the base case study.