Get the temperature for a zone
514557
def get_zone_temperature(self, zone_name):
        
        zone = self.get_zone(zone_name)

        if zone is None:
            raise RuntimeError("Unknown zone")

        return zone['currentTemperature']
974811
def get_zone_variable(self, zone_id, variable):
        

        try:
            return self._retrieve_cached_zone_variable(zone_id, variable)
        except UncachedVariable:
            return (yield from self._send_cmd("GET %s.%s" % (
                zone_id.device_str(), variable)))
1193677
def set_zone_variable(self, zone_id, variable, value):
        
        return self._send_cmd("SET %s.%s=\"%s\"" % (
            zone_id.device_str(), variable, value))
1009896
async def zone(dev: Device, zone, activate):
    """"""
    if zone:
        zone = await dev.get_zone(zone)
        click.echo("%s %s" % ("Activating" if activate else "Deactivating", zone)) 
        await zone.activate(activate)
    else:
        click.echo("Zones:")
        for zone in await dev.get_zones():
            act = False
            if zone.active:
                act = True
            click.echo("  * " + click.style(str(zone), bold=act))
55785
def call_cool(tstat):
    
    current_hsp, current_csp = tstat.heating_setpoint, tstat.cooling_setpoint
    current_temp = tstat.temperature
    tstat.write({
        'heating_setpoint': current_temp-20,
        'cooling_setpoint': current_temp-10,
        'mode': COOL,
    })

    def restore():
        tstat.write({
            'heating_setpoint': current_hsp,
            'cooling_setpoint': current_csp,
            'mode': AUTO,
        })
    return restore
145755
def last_bed_temp(self):
        """"""
        try:
            bedtemps = self.intervals[1]['timeseries']['tempBedC']
        except KeyError:
            return None
        tmp = 0
        num_temps = len(bedtemps)

        if num_temps == 0:
            return None

        for temp in bedtemps:
            tmp += temp[1]
        bedtemp = tmp/num_temps
        return bedtemp
570014
def room_temperature(self):
        """"""
        # Check which side is active, if both are return the average
        tmp = None
        tmp2 = None
        for user in self.users:
            obj = self.users[user]
            if obj.current_values['processing']:
                if tmp is None:
                    tmp = obj.current_values['room_temp']
                else:
                    tmp = (tmp + obj.current_values['room_temp']) / 2
            else:
                if tmp2 is None:
                    tmp2 = obj.current_values['room_temp']
                else:
                    tmp2 = (tmp2 + obj.current_values['room_temp']) / 2

        if tmp is not None:
            return tmp
        elif tmp2 is not None:
            return tmp2
212865
private function _temperature()
    {
        if (PSI_OS == 'WINNT') {
            if ($this->_buf) foreach ($this->_buf as $buffer) {
                if (isset($buffer['CurrentTemperature']) && (($value = ($buffer['CurrentTemperature'] - 2732)/10) > -100)) {
                    $dev = new SensorDevice();
                    if (isset($buffer['InstanceName']) && preg_match("/([^\\\\ ]+)$/", $buffer['InstanceName'], $outbuf)) {
                        $dev->setName('ThermalZone '.$outbuf[1]);
                    } else {
                        $dev->setName('ThermalZone THM0_0');
                    }
                    $dev->setValue($value);
                    if (isset($buffer['CriticalTripPoint']) && (($maxvalue = ($buffer['CriticalTripPoint'] - 2732)/10) > 0)) {
                        $dev->setMax($maxvalue);
                    }
                    $this->mbinfo->setMbTemp($dev);
                }
            }
        } else {
            $notwas = true;
            $thermalzones = glob('/sys/class/thermal/thermal_zone*/');
            if (is_array($thermalzones) && (count($thermalzones) > 0)) foreach ($thermalzones as $thermalzone) {
                $thermalzonetemp = $thermalzone.'temp';
                $temp = null;
                if (CommonFunctions::rfts($thermalzonetemp, $temp, 1, 4096, false) && !is_null($temp) && (($temp = trim($temp)) != "")) {
                    if ($temp >= 1000) {
                        $div = 1000;
                    } elseif ($temp >= 200) {
                        $div = 10;
                    } else {
                       $div = 1;
                    }
                    $temp = $temp / $div;

                    if ($temp > -40) {
                        $dev = new SensorDevice();
                        $dev->setValue($temp);

                        $temp_type = null;
                        if (CommonFunctions::rfts($thermalzone.'type', $temp_type, 1, 4096, false) && !is_null($temp_type) && (($temp_type = trim($temp_type)) != "")) {
                            $dev->setName($temp_type);
                        } else {
                            $dev->setName("ThermalZone");
                        }

                        $temp_max = null;
                        if (CommonFunctions::rfts($thermalzone.'trip_point_0_temp', $temp_max, 1, 4096, false) && !is_null($temp_max) && (($temp_max = trim($temp_max)) != "") && ($temp_max > -40)) {
                            $temp_max = $temp_max / $div;
                            if (($temp_max != 0) || ($temp != 0)) { // if non-zero values
                                $dev->setMax($temp_max);
                                $this->mbinfo->setMbTemp($dev);
                            }
                        } else {
                            $this->mbinfo->setMbTemp($dev);
                        }
                        $notwas = false;
                    }
                }
            }
            if ($notwas) {
                $thermalzones = glob('/proc/acpi/thermal_zone/TH*/temperature');
                if (is_array($thermalzones) && (count($thermalzones) > 0)) foreach ($thermalzones as $thermalzone) {
                    $temp = null;
                    if (CommonFunctions::rfts($thermalzone, $temp, 1, 4096, false) && !is_null($temp) && (($temp = trim($temp)) != "")) {
                        $dev = new SensorDevice();
                        if (preg_match("/^\/proc\/acpi\/thermal_zone\/(.+)\/temperature$/", $thermalzone, $name)) {
                           $dev->setName("ThermalZone ".$name[1]);
                        } else {
                            $dev->setName("ThermalZone");
                        }
                        $dev->setValue(trim(substr($temp, 23, 4)));
                        $this->mbinfo->setMbTemp($dev);
                    }
                }
            }
        }
    }
1221236
def temperature(self, temperature):
        
        if temperature < 0 or temperature > 1:
            raise ValueError("Temperature must be a percentage "
                             "represented as decimal 0-1.0")
        self._temperature = temperature
        cmd = self.command_set.temperature(temperature)
        self.send(cmd)
1345307
def _get_temperature(self, data):
        ''''''
        if data[1:2] == 0x7FFF:
            return None

        temperature = twos_complement((data[1] << 8) + data[2], 16) / 200
        return round(temperature, 2)
390622
def get_target_temperature(self):
        
        value = self.box.homeautoswitch("gethkrtsoll", self.actor_id)
        self.target_temperature = self.__get_temp(value)
        return self.target_temperature
893064
def get_zone(self, id=None, name=None):
        
        log.info("Picking zone: %s (%s)" % (name, id))
        return self.zones[id or name]
546799
def get_zone_mode(self, zone_name):
        
        zone = self.get_zone(zone_name)

        if zone is None:
            raise RuntimeError("Unknown zone")

        return ZoneMode(zone['mode'])
119889
private function _temperature()
    {
        if (isset($this->_buf['Temperature'])) foreach ($this->_buf['Temperature'] as $name=>$value) {
            $dev = new SensorDevice();
            $dev->setName($name);
            $dev->setValue($value);
            $this->mbinfo->setMbTemp($dev);
        }
    }
1148588
def set_temperature(self, temp):
        """"""

        self.set_service_value(
            self.thermostat_setpoint,
            'CurrentSetpoint',
            'NewCurrentSetpoint',
            temp)

        self.set_cache_value('setpoint', temp)
646545
def get_current_goal_temperature(self, refresh=False):
        """"""
        if refresh:
            self.refresh()
        try:
            return float(self.get_value('setpoint'))
        except (TypeError, ValueError):
            return None
676353
def _find_zone_by_id(self, zone_id):
        """"""
        if not self.zones:
            return None

        zone = list(filter(
            lambda zone: zone.id == zone_id, self.zones))

        return zone[0] if zone else None