def get_fpga_temp_sensor(self): """ Get temperature sensor reading of the E310. """ self.log.trace("Reading temperature.") temp = '-1' raw_val = {} data_probes = ['in_temp0_raw', 'in_temp0_scale', 'in_temp0_offset'] try: for data_probe in data_probes: raw_val[data_probe] = read_sysfs_sensors_value('xadc', data_probe, 'iio', 'name')[0] temp = str((raw_val['in_temp0_raw'] + raw_val['in_temp0_offset']) * raw_val['in_temp0_scale'] / 1000) except ValueError: self.log.warning("Error when converting temperature value") except KeyError: self.log.warning("Can't read temp on thermal_zone".format(sensor)) return { 'name': 'temp_fpga', 'type': 'REALNUM', 'unit': 'C', 'value': temp }
def get_mb_temp_sensor(self): """ Get temperature sensor reading of the E310. """ self.log.trace("Reading temperature.") temp = '-1' raw_val = {} data_probes = ['temp1_input'] try: for data_probe in data_probes: raw_val[data_probe] = read_sysfs_sensors_value('jc-42.4-temp', data_probe, 'hwmon', 'name')[0] temp = str(raw_val['temp1_input'] / 1000) except ValueError: self.log.warning("Error when converting temperature value") except KeyError: self.log.warning("Can't read temp on thermal_zone".format(sensor)) return { 'name': 'temp_mb', 'type': 'REALNUM', 'unit': 'C', 'value': temp }