Distributed thermostat