Skip to content

changing eCO2 and TVOC to eco2 and tvoc respectively #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions adafruit_ccs811.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def __init__(self, i2c_bus, address=0x5A):
#default to read every second
self.drive_mode = DRIVE_MODE_1SEC

self._eCO2 = None # pylint: disable=invalid-name
self._TVOC = None # pylint: disable=invalid-name
self._eco2 = None # pylint: disable=invalid-name
self._tvoc = None # pylint: disable=invalid-name

@property
def error_code(self):
Expand All @@ -143,22 +143,22 @@ def _update_data(self):
i2c.write(buf, end=1, stop=False)
i2c.readinto(buf, start=1)

self._eCO2 = (buf[1] << 8) | (buf[2])
self._TVOC = (buf[3] << 8) | (buf[4])
self._eco2 = (buf[1] << 8) | (buf[2])
self._tvoc = (buf[3] << 8) | (buf[4])

if self.error:
raise RuntimeError("Error:" + str(self.error_code))

@property
def TVOC(self): # pylint: disable=invalid-name
def tvoc(self): # pylint: disable=invalid-name
"""Total Volatile Organic Compound in parts per billion."""
self._update_data()
return self._TVOC
return self._tvoc

@property
def eCO2(self): # pylint: disable=invalid-name
def eco2(self): # pylint: disable=invalid-name
"""Equivalent Carbon Dioxide in parts per million. Clipped to 400 to 8192ppm."""
return self._eCO2
return self._eco2

@property
def temperature(self):
Expand Down
2 changes: 1 addition & 1 deletion examples/ccs811_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
ccs.temp_offset = temp - 25.0

while True:
print("CO2: ", ccs.eCO2, " TVOC:", ccs.TVOC, " temp:", ccs.temperature)
print("CO2: ", ccs.eco2, " TVOC:", ccs.tvoc, " temp:", ccs.temperature)
time.sleep(.5)