Skip to content

Conversation

SengerM
Copy link

@SengerM SengerM commented Sep 17, 2025

Now it is possible to convert into a dict:

from time import sleep
from sensirion_i2c_driver import I2cConnection, LinuxI2cTransceiver
from sensirion_i2c_sen5x import Sen5xI2cDevice

with LinuxI2cTransceiver('/dev/i2c-1') as i2c_transceiver:
	device = Sen5xI2cDevice(I2cConnection(i2c_transceiver))
	device.device_reset()
	device.start_measurement()
	sleep(2)
	while device.read_data_ready() is False:
		sleep(0.1)
	result = device.read_measured_values()
	result = dict(result)
	print(result)
$ python main.py 
{'mc_1p0': 3.6, 'mc_2p5': 6.4, 'mc_4p0': 8.6, 'mc_10p0': 9.6, 'ambient_rh': 45.66, 'ambient_t': 30.105, 'voc_index': 0.0, 'nox_index': nan}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant