Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if ret[1] == 0xfe:
LOGGER.warning('possibly uninitialized device')
status = [
('Current uptime', self._get_timedelta(_CORSAIR_READ_UPTIME), ''),
('Total uptime', self._get_timedelta(_CORSAIR_READ_TOTAL_UPTIME), ''),
('Temperature 1', self._get_float(CMD.READ_TEMPERATURE_1), '°C'),
('Temperature 2', self._get_float(CMD.READ_TEMPERATURE_2), '°C'),
('Fan control mode', self._get_fan_control_mode(), ''),
('Fan speed', self._get_float(CMD.READ_FAN_SPEED_1), 'rpm'),
('Input voltage', self._get_float(CMD.READ_VIN), 'V'),
('Total power', self._get_float(_CORSAIR_READ_INPUT_POWER), 'W'),
('+12V OCP mode', self._get_12v_ocp_mode(), ''),
]
for rail in [_RAIL_12V, _RAIL_5V, _RAIL_3P3V]:
name = _RAIL_NAMES[rail]
self._exec(WriteBit.WRITE, CMD.PAGE, [rail])
status.append((f'{name} output voltage', self._get_float(CMD.READ_VOUT), 'V'))
status.append((f'{name} output current', self._get_float(CMD.READ_IOUT), 'A'))
status.append((f'{name} output power', self._get_float(CMD.READ_POUT), 'W'))
self._exec(WriteBit.WRITE, CMD.PAGE, [0])
self.device.release()
LOGGER.warning('reading the +12V OCP mode is an experimental feature')
return status
('Total uptime', self._get_timedelta(_CORSAIR_READ_TOTAL_UPTIME), ''),
('Temperature 1', self._get_float(CMD.READ_TEMPERATURE_1), '°C'),
('Temperature 2', self._get_float(CMD.READ_TEMPERATURE_2), '°C'),
('Fan control mode', self._get_fan_control_mode(), ''),
('Fan speed', self._get_float(CMD.READ_FAN_SPEED_1), 'rpm'),
('Input voltage', self._get_float(CMD.READ_VIN), 'V'),
('Total power', self._get_float(_CORSAIR_READ_INPUT_POWER), 'W'),
('+12V OCP mode', self._get_12v_ocp_mode(), ''),
]
for rail in [_RAIL_12V, _RAIL_5V, _RAIL_3P3V]:
name = _RAIL_NAMES[rail]
self._exec(WriteBit.WRITE, CMD.PAGE, [rail])
status.append((f'{name} output voltage', self._get_float(CMD.READ_VOUT), 'V'))
status.append((f'{name} output current', self._get_float(CMD.READ_IOUT), 'A'))
status.append((f'{name} output power', self._get_float(CMD.READ_POUT), 'W'))
self._exec(WriteBit.WRITE, CMD.PAGE, [0])
self.device.release()
LOGGER.warning('reading the +12V OCP mode is an experimental feature')
return status
def get_status(self, **kwargs):
"""Get a status report.
Returns a list of `(property, value, unit)` tuples.
"""
ret = self._exec(WriteBit.WRITE, CMD.PAGE, [0])
if ret[1] == 0xfe:
LOGGER.warning('possibly uninitialized device')
status = [
('Current uptime', self._get_timedelta(_CORSAIR_READ_UPTIME), ''),
('Total uptime', self._get_timedelta(_CORSAIR_READ_TOTAL_UPTIME), ''),
('Temperature 1', self._get_float(CMD.READ_TEMPERATURE_1), '°C'),
('Temperature 2', self._get_float(CMD.READ_TEMPERATURE_2), '°C'),
('Fan control mode', self._get_fan_control_mode(), ''),
('Fan speed', self._get_float(CMD.READ_FAN_SPEED_1), 'rpm'),
('Input voltage', self._get_float(CMD.READ_VIN), 'V'),
('Total power', self._get_float(_CORSAIR_READ_INPUT_POWER), 'W'),
('+12V OCP mode', self._get_12v_ocp_mode(), ''),
]
for rail in [_RAIL_12V, _RAIL_5V, _RAIL_3P3V]:
name = _RAIL_NAMES[rail]
self._exec(WriteBit.WRITE, CMD.PAGE, [rail])