Returns the sensor reading at the assertion states for the given
        sensor number.

        `sensor_number`

        Returns a tuple with `raw reading`and `assertion states`.
960628
def get_sensor_reading(self, sensor_number, lun=0):
        
        rsp = self.send_message_with_name('GetSensorReading',
                                          sensor_number=sensor_number,
                                          lun=lun)

        reading = rsp.sensor_reading
        if rsp.config.initial_update_in_progress:
            reading = None

        states = None
        if rsp.states1 is not None:
            states = rsp.states1
            if rsp.states2 is not None:
                states |= (rsp.states2 << 8)
        return (reading, states)
786392
def request_set_sensor_inactive(self, req, sensor_name):
        """"""
        sensor = self.get_sensor(sensor_name)
        ts, status, value = sensor.read()
        sensor.set_value(value, sensor.INACTIVE, ts)
        return('ok',)
856525
def get_sensor_data(self):
        
        self.init_sdr()
        for sensor in self._sdr.get_sensor_numbers():
            rsp = self.raw_command(command=0x2d, netfn=4, data=(sensor,))
            if 'error' in rsp:
                if rsp['code'] == 203:  # Sensor does not exist, optional dev
                    continue
                raise exc.IpmiException(rsp['error'], code=rsp['code'])
            yield self._sdr.sensors[sensor].decode_sensor_reading(rsp['data'])
        self.oem_init()
        for reading in self._oem.get_sensor_data():
            yield reading
1255154
def rsl_count_readings(self):
        """"""

        storage, output = self.sensor_log.count()
        return [Error.NO_ERROR, storage, output]
834906
def get(self, sensor_type='temperature_core'):
        """"""
        self.__update__()
        if sensor_type == 'temperature_core':
            ret = [s for s in self.sensors_list if s['unit'] == SENSOR_TEMP_UNIT]
        elif sensor_type == 'fan_speed':
            ret = [s for s in self.sensors_list if s['unit'] == SENSOR_FAN_UNIT]
        else:
            # Unknown type
            logger.debug("Unknown sensor type %s" % sensor_type)
            ret = []
        return ret
261040
def simxGetVisionSensorImage(clientID, sensorHandle, options, operationMode):
    '''
    
    '''

    resolution = (ct.c_int*2)()
    c_image  = ct.POINTER(ct.c_byte)()
    bytesPerPixel = 3
    if (options and 1) != 0:
        bytesPerPixel = 1
    ret = c_GetVisionSensorImage(clientID, sensorHandle, resolution, ct.byref(c_image), options, operationMode)

    reso = []
    image = []
    if (ret == 0):
        image = [None]*resolution[0]*resolution[1]*bytesPerPixel
        for i in range(resolution[0] * resolution[1] * bytesPerPixel):
            image[i] = c_image[i]
        for i in range(2):
            reso.append(resolution[i])
    return ret, reso, image
764496
def readInternalC(self):
        """"""
        v = self._read32()
        # Ignore bottom 4 bits of thermocouple data.
        v >>= 4
        # Grab bottom 11 bits as internal temperature data.
        internal = v & 0x7FF
        if v & 0x800:
            # Negative value, take 2's compliment. Compute this with subtraction
            # because python is a little odd about handling signed/unsigned.
            internal -= 4096
        # Scale by 0.0625 degrees C per bit and return value.
        return internal * 0.0625
964360
def get_hum(self, raw = False):
        
        self.bus.write_byte(self.address, self.TRIG_RH_noHOLD); # start humidity measurement
        time.sleep(0.1)

        data = self.bus.read_i2c_block(self.address, 2)

        value = data[0]<<8 | data[1]
        value &= ~0b11    # trow out status bits
        humidity = (-6.0 + 125.0*(value/65536.0))

        if raw:                 # raw sensor output, useful for getting an idea of sensor failure status
            return humidity

        else:

            if humidity > 100.0:        # limit values to relevant physical variable (values out of that limit is sensor error state and are dependent on specific sensor piece)
                return 100.0
            elif humidity < 0.0:
                return 0.0
            else:
                return humidity
1127604
def request_set_sensor_unreachable(self, req, sensor_name):
        """"""
        sensor = self.get_sensor(sensor_name)
        ts, status, value = sensor.read()
        sensor.set_value(value, sensor.UNREACHABLE, ts)
        return('ok',)
895753
def get_output_sensors(self):
        
        data = dict()
        found_sensors = get_sensors()
        if len(found_sensors) == 0:
            raise Exception("No sensors detected! "
                            "Ensure lm-sensors is installed and check the output of the `sensors` command.")
        for sensor in found_sensors:
            data[sensor.name] = self.format_sensor(sensor)
            data["{}_bar".format(sensor.name)] = self.format_sensor_bar(sensor)
        data['temp'] = max((s.current for s in found_sensors))
        return {
            'full_text': self.format.format(**data),
            'urgent': self.get_urgent(found_sensors),
            'color': self.color if not self.dynamic_color else None,
        }
597787
def _cb_inform_sensor_status(self, msg):
        """"""
        timestamp = msg.arguments[0]
        num_sensors = int(msg.arguments[1])
        assert len(msg.arguments) == 2 + num_sensors * 3
        for n in xrange(num_sensors):
            name = msg.arguments[2 + n * 3]
            status = msg.arguments[3 + n * 3]
            value = msg.arguments[4 + n * 3]
            self.update_sensor(name, timestamp, status, value)
93457
def get_sensor(self, sensor_name):
        
        sensor = self._sensors.get(sensor_name, None)
        if not sensor:
            raise ValueError("Unknown sensor '%s'." % (sensor_name,))
        return sensor
850075
def _getSensorLimits(self):
        
        limits = []
        limits.extend(self._getTotalDemandLimits())
#        limits.extend(self._getDemandLimits())
#        limits.extend(self._getPriceLimits())

#        limits.extend(self._getVoltageSensorLimits())

#        limits.extend(self._getVoltageMagnitudeLimits())
#        limits.extend(self._getVoltageAngleLimits())
#        limits.extend(self._getVoltageLambdaLimits())
#        limits.extend(self._getFlowLimits())

        logger.debug("Sensor limits: %s" % limits)
        return limits
766403
def _read_weights(self):
        
        weights = []

        grams_per_pound = 453.592

        # Read from each of the sensors
        for ser in self._serials:
            ser.write('W\r')
            ser.flush()
        time.sleep(0.02)
        for ser in self._serials:
            try:
                output_str = ser.readline()
                weight = float(output_str) * grams_per_pound
                weights.append(weight)
            except:
                weights.append(0.0)

        # Log the output
        log_output = ''
        for w in weights:
            log_output +='{:.2f} '.format(w)
        rospy.loginfo(log_output)

        return weights
386182
def sensor(self, sensor_type):
        """"""
        _LOGGER.debug("Reading %s sensor.", sensor_type)
        return self._session.read_sensor(self.device_id, sensor_type)
349072
def getSpec(cls):
    """"""
    spec = {
      "description":"Sensor for sending sparse data to an HTM network.",
      "singleNodeOnly":True,
      "outputs":{
        "dataOut":{
          "description":"Encoded text",
          "dataType":"Real32",
          "count":0,
          "regionLevel":True,
          "isDefaultOutput":True,
          },
        "resetOut":{
          "description":"Boolean reset output.",
          "dataType":"Real32",
          "count":1,
          "regionLevel":True,
          "isDefaultOutput":False,
          },
        "sequenceIdOut":{
          "description":"Sequence ID",
          "dataType":'Real32',
          "count":1,
          "regionLevel":True,
          "isDefaultOutput":False,
        },
      },
      "inputs":{},
      "parameters":{
        "verbosity":{
          "description":"Verbosity level",
          "dataType":"UInt32",
          "accessMode":"ReadWrite",
          "count":1,
          "constraints":"",
        },
        "outputWidth":{
          "description":"Size of output vector",
          "dataType":"UInt32",
          "accessMode":"ReadWrite",
          "count":1,
          "defaultValue": 2048,
          "constraints":"",
        },
      },
      "commands":{
        "addDataToQueue": {
          "description": "Add data",
        }
      },
    }

    return spec
650293
def check_temperature_sensors():
        
    # walk all temperature sensor values and thresholds
    env_temp = walk_data(sess, oid_env_temp, helper)[0]
    env_temp_thresh = walk_data(sess, oid_env_temp_thres, helper)[0]
    env_temp_zipped = zip(env_temp, env_temp_thresh)

    for x, data in enumerate(env_temp_zipped, 1):
        # skip the check if -99 or 0 is in the value or threshold, because these data we can not use
        if '-99' not  in data and '0' not in data:
            #check if the value is over the treshold
            if int(data[0]) > int(data[1]):
                helper.add_summary('Temperature at sensor %d above threshold (%s / %s)' % (x, data[0], data[1]))
                helper.status(critical)
            # always add the sensor to the output
            helper.add_long_output('Temperature %d: %s Celsius (threshold: %s Celsius)' % (x, data[0], data[1]))
            # for the first sensor (envirnoment temperature, we add performance data)
            if x == 1:
                helper.add_metric("Environment Temperature", data[0], '', ":" + data[1], "", "", "Celsius")