py-opc-ng package
Module contents
- opcng.detect(spi)
Try to autodetect a device parsing information string
- Parameters
spi – SPI device instance as returned by SpiDev or USBiss
- Returns
an OPC_(N3,N2,R1,R2) instance, check type() to see if the device was properly detected.
- class opcng.OPCN2(spi)
Bases:
_OPCOPC-N2
Experimental support, only tested with firmware 18
- Parameters
spi – a SPI device as returned by SpiDev or USBiss
- fwversion()
Query device firmware version
- histogram(raw=False)
Query and decode histogram data.
- Parameters
raw – if True do not post process data (e.g. converting raw temperature to degrees etc.) and return raw numbers instead.
- Returns
a dictionary of histogram bins and auxiliary data
- info()
Query device information
- off()
Power off peripherals.
- on()
Power on peripherals (laser and fan).
Wait at least 600ms for the fan speed to settle and power absorption peak to pass before sending more commands.
- ping()
Check device status. Returns True if the device is responding.
- pm()
Query particle mass loadings.
- Returns
a dictionary containing PM1, PM2.5 and PM10 data.
- power_state()
Report peripherals and digital pots state.
- Returns
a dictionary of each peripheral current state.
- Example
>>> o = OPCN2(spi) >>> o.power_state() {'FanON': 1, 'LaserON': 1, 'FanDACVal': 255, 'LaserDACVal': 164}
- serial()
Query device serial
- class opcng.OPCN3(spi)
Bases:
_OPCOPC-N3
- Parameters
spi – a SPI device as returned by SpiDev or USBiss
- config()
Query configuration variables.
- fan_off()
Power off fan.
- fan_on()
Power on fan.
Wait at least 600ms for the fan speed to settle and power absorption peak to pass before sending more commands.
- fwversion()
Query device firmware version
- histogram(raw=False)
Query and decode histogram data.
- Parameters
raw – if True do not post process data (e.g. converting raw temperature to degrees etc.) and return raw numbers instead.
- Returns
a dictionary of histogram bins and auxiliary data
- info()
Query device information
- laser_off()
Power off laser.
- laser_on()
Power on laser.
- off()
Power off peripherals (both laser and fan).
- on()
Power on peripherals (both laser and fan).
Wait at least 600ms for the fan speed to settle and power absorption peak to pass before sending more commands.
- ping()
Check device status. Returns True if the device is responding.
- pm()
Query particle mass loadings.
- Returns
a dictionary containing PM1, PM2.5 and PM10 data.
- power_state()
Report peripherals and digital pots state.
- Returns
a dictionary of each peripheral current state.
- Example
>>> o = OPCN3(spi) >>> o.power_state() {'FanON': 0, 'LaserON': 1, 'FanDACVal': 255, 'LaserDACVal': 140, 'LaserSwitch': 0, 'GainToggle': 3}
- reset()
Reset device.
Not so clear what it really does, poorly documented in manufacturer docs.
- serial()
Query device serial
- class opcng.OPCR1(spi)
Bases:
_OPCOPC-R1
- Parameters
spi – a SPI device as returned by SpiDev or USBiss
- fwversion()
Query device firmware version
- histogram(raw=False)
Query and decode histogram data.
- Parameters
raw – if True do not post process data (e.g. converting raw temperature to degrees etc.) and return raw numbers instead.
- Returns
a dictionary of histogram bins and auxiliary data
- info()
Query device information
- off()
Power off peripherals (both laser and fan).
- on()
Power on peripherals (both laser and fan).
Wait at least 600ms for the fan speed to settle and power absorption peak to pass before sending more commands.
- ping()
Check device status. Returns True if the device is responding.
- pm()
Query particle mass loadings.
- Returns
a dictionary containing PM1, PM2.5 and PM10 data.
- reset()
Reset device.
Not so clear what it really does, poorly documented in manufacturer docs.
- serial()
Query device serial
- class opcng.OPCR2(spi)
Bases:
OPCR1- fwversion()
Query device firmware version
- histogram(raw=False)
Query and decode histogram data.
- Parameters
raw – if True do not post process data (e.g. converting raw temperature to degrees etc.) and return raw numbers instead.
- Returns
a dictionary of histogram bins and auxiliary data
- info()
Query device information
- off()
Power off peripherals (both laser and fan).
- on()
Power on peripherals (both laser and fan).
Wait at least 600ms for the fan speed to settle and power absorption peak to pass before sending more commands.
- ping()
Check device status. Returns True if the device is responding.
- pm()
Query particle mass readings.
- reset()
Reset device.
Not so clear what it really does, poorly documented in manufacturer docs.
- serial()
Query device serial
- exception opcng.USBISSError
Bases:
BaseException- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- opcng.detect(spi)
Try to autodetect a device parsing information string
- Parameters
spi – SPI device instance as returned by SpiDev or USBiss
- Returns
an OPC_(N3,N2,R1,R2) instance, check type() to see if the device was properly detected.