Skip to content

Commit 374a660

Browse files
authored
Merge pull request #14 from Dmole/patch-1
set_iaq_humidity
2 parents 9d6b19f + baa3621 commit 374a660

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

adafruit_sgp30.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@ def set_iaq_baseline(self, eCO2, TVOC): # pylint: disable=invalid-name
130130
buffer += arr
131131
self._run_profile(["iaq_set_baseline", [0x20, 0x1e] + buffer, 0, 0.01])
132132

133+
def set_iaq_humidity(self, gramsPM3): # pylint: disable=invalid-name
134+
"""Set the humidity in g/m3 for eCO2 and TVOC compensation algorithm"""
135+
tmp = int(gramsPM3 * 256)
136+
buffer = []
137+
for value in [tmp]:
138+
arr = [value >> 8, value & 0xFF]
139+
arr.append(self._generate_crc(arr))
140+
buffer += arr
141+
self._run_profile(["iaq_set_humidity", [0x20, 0x61] + buffer, 0, 0.01])
133142

134143
# Low level command functions
135144

0 commit comments

Comments
 (0)