Get the mode for a zone
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'])
1123259
def enumerate_zones(self):
        
        zones = []
        for controller in range(1, 8):
            for zone in range(1, 17):
                zone_id = ZoneID(zone, controller)
                try:
                    name = yield from self.get_zone_variable(zone_id, 'name')
                    if name:
                        zones.append((zone_id, name))
                except CommandException:
                    break
        return zones
636262
def mode(self, mode):
        """"""
        _LOGGER.debug("Setting new mode: %s", mode)

        if self.mode == Mode.Boost and mode != Mode.Boost:
            self.boost = False

        if mode == Mode.Boost:
            self.boost = True
            return
        elif mode == Mode.Away:
            end = datetime.now() + self._away_duration
            return self.set_away(end, self._away_temp)
        elif mode == Mode.Closed:
            return self.set_mode(0x40 | int(EQ3BT_OFF_TEMP * 2))
        elif mode == Mode.Open:
            return self.set_mode(0x40 | int(EQ3BT_ON_TEMP * 2))

        if mode == Mode.Manual:
            temperature = max(min(self._target_temperature, self.max_temp),
                              self.min_temp)
            return self.set_mode(0x40 | int(temperature * 2))
        else:
            return self.set_mode(0)
495374
def _get_version_mode(self, mode=None):
        
        version_mode = self._version_modes.get(mode)
        if not version_mode:
            version_mode = self._version_modes[mode] = VersionMode(name=mode)
        return version_mode
146384
def list_zones(permanent=True):
    '''
    
    '''
    zones = {}

    cmd = '--list-all-zones'

    if permanent:
        cmd += ' --permanent'

    for i in __firewall_cmd(cmd).splitlines():
        if i.strip():
            if bool(re.match('^[a-z0-9]', i, re.I)):
                zone_name = i.rstrip()
            else:
                (id_, val) = i.strip().split(':')

                if zones.get(zone_name, None):
                    zones[zone_name].update({id_: val})
                else:
                    zones[zone_name] = {id_: val}

    return zones
781537
def set_mode_by_id(self, zone_id, mode):
        
        if not self._do_auth():
            raise RuntimeError("Unable to login")

        data = {
            "ZoneId": zone_id,
            "mode": mode.value
        }

        headers = {
            "Accept": "application/json",
            "Content-Type": "application/json",
            'Authorization':
                'Bearer ' + self.login_data['token']['accessToken']
        }

        url = self.api_base_url + "Home/SetZoneMode"
        response = requests.post(url, data=json.dumps(
            data), headers=headers, timeout=10)

        if response.status_code != 200:
            return False

        mode_data = response.json()

        return mode_data.get("isSuccess", False)
1013596
public static function getZone($zoneName=null)
    {
        if ($zoneName === null) {
            $zoneName = self::$_outputZone;
        }
        return (isset(self::$_zones[$zoneName]) ? self::$_zones[$zoneName] : null);
    }
1258366
def mode(dev, target):
    
    click.echo("Current mode: %s" % dev.mode_readable)
    if target:
        click.echo("Setting mode: %s" % target)
        dev.mode = target
1359383
def get_default_zone
      params = {
          'command' => 'listZones',
          'available' => 'true'
      }
      json = send_request(params)

      zones = json['zone']
      return nil unless zones
      # zones.sort! # sort zones so we always return the same zone
      # !this gives error in our production environment so need to retest this
      zones.first
    end
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']
1046998
def get_mode(device_filter):
    """"""
    from .device_filters import IBeaconFilter, EddystoneFilter, BtAddrFilter, EstimoteFilter
    if device_filter is None or len(device_filter) == 0:
        return ScannerMode.MODE_ALL

    mode = ScannerMode.MODE_NONE
    for filtr in device_filter:
        if isinstance(filtr, IBeaconFilter):
            mode |= ScannerMode.MODE_IBEACON
        elif isinstance(filtr, EddystoneFilter):
            mode |= ScannerMode.MODE_EDDYSTONE
        elif isinstance(filtr, EstimoteFilter):
            mode |= ScannerMode.MODE_ESTIMOTE
        elif isinstance(filtr, BtAddrFilter):
            mode |= ScannerMode.MODE_ALL
            break

    return mode
83209
def searchZone(self, zone, q=None, has_geo=False, callback=None, errback=None):
        
        import ns1.zones
        return zone.search(q, has_geo, callback=callback, errback=errback)
1193677
def set_zone_variable(self, zone_id, variable, value):
        
        return self._send_cmd("SET %s.%s=\"%s\"" % (
            zone_id.device_str(), variable, value))
1349505
public alluxio.grpc.PModeOrBuilder getModeOrBuilder() {
    return mode_ == null ? alluxio.grpc.PMode.getDefaultInstance() : mode_;
  }
606357
private static int getZoneOffset(String myZone, boolean preferSameZone, String[] availZones) {
        for (int i = 0; i < availZones.length; i++) {
            if (myZone != null && (availZones[i].equalsIgnoreCase(myZone.trim()) == preferSameZone)) {
                return i;
            }
        }
        logger.warn("DISCOVERY: Could not pick a zone based on preferred zone settings. My zone - {}," +
                " preferSameZone - {}. Defaulting to {}", myZone, preferSameZone, availZones[0]);

        return 0;
    }
1279458
def mode_name(self):
        

        for name, id in self.MODES.iteritems():
            if id == self.mode:
                return name
899768
def mode(self, mode=None):
        
        if mode is None:
            return self.__mode
        if mode == const.MODBUS_TCP or mode == const.MODBUS_RTU:
            self.__mode = mode
            return self.__mode
        else:
            return None