-
Notifications
You must be signed in to change notification settings - Fork 42
Added sensor properties + example to reflect consistency changes #6
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,40 @@ def __init__(self, i2c, address=_SGP30_DEFAULT_I2C_ADDR): | |
raise RuntimeError('SGP30 Not detected') | ||
self.iaq_init() | ||
|
||
self._co2eq = None # pylint: disable=invalid-name | ||
self._tvoc = None # pylint: disable=invalid-name | ||
self._baseline_tvoc = None # pylint: disable=invalid-name | ||
self._baseline_co2eq = None # pylint: disable=invalid-name | ||
|
||
|
||
@property | ||
def tvoc(self): # pylint: disable=invalid-name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These look like valid names to me. Did you copy the lint part from somewhere else? I don't think they are needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I was copying that from the CCS811 library. I'll remove. |
||
"""Total Volatile Organic Compound in parts per billion.""" | ||
self._tvoc = self.iaq_measure()[1] | ||
return self._tvoc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed - thanks (will keep this in mind next time)! |
||
|
||
|
||
@property | ||
def baseline_tvoc(self): #pylint: disable=invalid-name | ||
"""Total Volatile Organic Compound baseline value""" | ||
self._baseline_tvoc = self.get_iaq_baseline()[1] | ||
return self._baseline_tvoc | ||
|
||
|
||
@property | ||
def co2eq(self): #pylint: disable=invalid-name | ||
"""Carbon Dioxide Equivalent in parts per million""" | ||
self._co2eq = self.iaq_measure()[0] | ||
return self._co2eq | ||
|
||
|
||
@property | ||
def baseline_co2eq(self): #pylint: disable=invalid-name | ||
"""Carbon Dioxide Equivalent baseline value""" | ||
self._baseline_co2eq = self.get_iaq_baseline()[0] | ||
return self._baseline_co2eq | ||
|
||
|
||
def iaq_init(self): | ||
"""Initialize the IAQ algorithm""" | ||
# name, command, signals, delay | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need these because you always update them in the property getter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!