ENS160
ENS160 Python library.
This code was tested on a Raspberry Pi 5 at 100kHz I2C clock.
The I2C code is abstracted from the sensor handling and other communication methods could be added.
Tested with Python 3.12
Documentation
The detailed API documentation can be found here.
Install
pip install ens160
Example
See example.py
import sys
from time import sleep
from ens160 import Driver, OpModes
from ens160.i2c import SMBusRetryingI2C
dev = Driver(SMBusRetryingI2C(0x53, 1))
dev.init()
part_id = dev.get_part_id()
if part_id != Driver.PART_ID:
print(f"Part not found, expected {Driver.PART_ID} got {part_id}.")
sys.exit(-1)
print(f"Part Id {part_id}")
print(f"Firmware version {dev.get_fw_version()}")
dev.set_rh_compensation(55.0)
dev.set_temp_compensation_fahrenheit(72.5)
print(dev.get_device_status())
dev.set_operating_mode(OpModes.STANDARD)
print("Operating Mode: ", dev.get_operating_mode())
while True:
status = dev.get_device_status()
print(status)
if status.new_data:
print(
f"AQI={dev.get_aqi()}, eCO2={dev.get_eco2()}ppm, TVOC={dev.get_tvoc()}ppb"
)
else:
sleep(0.1)
Metadata
Release files for ens160 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ens160-0.0.2.tar.gz | 7.6 kB | Without provenance | Details for ens160-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ens160-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for ens160-0.0.2-py3-none-any.whl |
Total release size: 16.7 kB
Release files / ens160-0.0.2.tar.gz
| Download URL | ens160-0.0.2.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4fb202b7ff54be7cae5894d5a1f6a64956c947b8b3df4de1e3af5c02565d49d
|
|
BLAKE2b-256 checksum How to use checksums |
a73663febda777bd7b0f827dd7c6705478ce7a3a4cfc6e9bf19073662943f971
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / ens160-0.0.2-py3-none-any.whl
| Download URL | ens160-0.0.2-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
192b2c38f7cd88275515049c756f8e16e8a2bcb7d1ec1c87a34958e56fd51ce8
|
|
BLAKE2b-256 checksum How to use checksums |
09b102fc2c431699c3b8c5d3d30d897d257f4b000eb6149ead2eb67a8a836e58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Security for ens160 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.