Skip to content

Commit 532f84b

Browse files
committed
set_iaq_humidity
1 parent 9d6b19f commit 532f84b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

adafruit_sgp30.py

+9
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, rh): # pylint: disable=invalid-name
134+
"""Set the humidity for eCO2 and TVOC compensation algorithm"""
135+
rh = int(rh * 256)
136+
buffer = []
137+
for value in [rh]:
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)