Skip to content

Commit c5d99b9

Browse files
authored
Add configurable chip address for SHT4x sensor (#439)
* Add configurable chip address for SHT4x sensor
1 parent d4e3100 commit c5d99b9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mqtt_io/modules/sensor/sht4x.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
REQUIREMENTS = ("adafruit-circuitpython-sht4x",)
1212

13+
CONFIG_SCHEMA = {
14+
"chip_addr": {"type": "integer", "required": False, "empty": False, "default": 0x44}
15+
}
1316

1417
class Sensor(GenericSensor):
1518
"""
@@ -34,7 +37,7 @@ def setup_module(self) -> None:
3437
import busio # type: ignore
3538

3639
i2c = busio.I2C(board.SCL, board.SDA)
37-
self.sensor = adafruit_sht4x.SHT4x(i2c)
40+
self.sensor = adafruit_sht4x.SHT4x(i2c, address=self.config["chip_addr"])
3841

3942
@property
4043
def _temperature(self) -> SensorValueType:

0 commit comments

Comments
 (0)