Wireless sensor networks take a major part in our everyday lives by enhancing systems for home automation, healthcare, temperature control, energy consumption monitoring, and so forth. In this paper we focus on a system used for temperature regulation for residential, educational, industrial, and commercial premises, and so forth. We propose a framework for indoor temperature regulation and optimization using wireless sensor networks based on ZigBee platform. This paper considers architectural design of the system, as well as implementation guidelines. The proposed system favors methods that provide energy savings by reducing the amount of data transmissions through the network. Furthermore, the framework explores techniques for localization, such that the location of the nodes can be used by algorithms that regulate temperature settings.