Skip to content

Commit

Permalink
Changes required by pylint
Browse files Browse the repository at this point in the history
It now passes all tests
  • Loading branch information
linucks committed Jun 20, 2024
1 parent 4fba755 commit c0a78cc
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions mqtt_io/modules/sensor/ens160.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
ENS160 Air Quality Sensor
sensor_modules:
Expand Down Expand Up @@ -27,7 +26,6 @@
interval: 10
digits: 0
type: eco2
"""

from typing import cast
Expand Down Expand Up @@ -71,7 +69,7 @@ class Sensor(GenericSensor):
TVOC: Total Volatile Organic Compounds concentration
Return value range: 0–65000, unit: ppb
CO2 equivalent concentration calculated according to the detected data of VOCs and hydrogen (eCO2 – Equivalent CO2)
CO2 equivalent concentration calculated according to the detected data of VOCs and hydrogen
Return value range: 400–65000, unit: ppm
Five levels: Excellent(400 - 600), Good(600 - 800), Moderate(800 - 1000),
Expand All @@ -98,10 +96,7 @@ def setup_module(self) -> None:
import board # type: ignore

self.adafruit_ens160_module = adafruit_ens160

i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller

self.ens160 = adafruit_ens160.ENS160(i2c, address=self.config["chip_addr"])
self.ens160.temperature_compensation = self.config["temperature_compensation"]
self.ens160.humidity_compensation = self.config["humidity_compensation"]
Expand All @@ -112,11 +107,12 @@ def get_value(self, sens_conf: ConfigType) -> float:
# data_validity values:
# NORMAL_OP - Normal operation,
# WARM_UP - Warm-Up phase, first 3 minutes after power-on.
# START_UP - Initial Start-Up phase, first full hour of operation after initial power-on.Only once in the sensor’s lifetime.
# START_UP - Initial Start-Up phase, first full hour of operation after initial power-on.
# Only once in the sensor’s lifetime.
# INVALID_OUT - Invalid output
# note: Note that the status will only be stored in the non-volatile memory after an initial 24h of continuous
# operation. If unpowered before conclusion of said period, the ENS160 will resume "Initial Start-up" mode
# after re-powering.
# note: Note that the status will only be stored in the non-volatile memory after an initial
# 24h of continuous operation. If unpowered before conclusion of said period, the
# ENS160 will resume "Initial Start-up" mode after re-powering.
if self.ens160.data_validity == self.adafruit_ens160_module.INVALID_OUT:
raise RuntimeError("ENS160 sensor is returning invalid output")

Expand Down

0 comments on commit c0a78cc

Please sign in to comment.