AllskyTeam / allsky-modules

User modules for allsky
MIT License
20 stars 21 forks source link

i2c address selection of SHT31D sensor for dewheater & temp modules #137

Closed mgarza closed 5 months ago

mgarza commented 6 months ago

It would be great if there is a chance to allow different I2C addresses for the SHT31D for the dewheater and temp modules. For some other sensors this functionality seems to be implemented, but it's missing for the SHT31D.

e.g.: .... def readSHT31(sht31heater,i2caddress): temperature = None humidity = None if i2caddress != "": try: i2caddressInt = int(i2caddress, 16) except Exception as e: eType, eObject, eTraceback = sys.exc_info() s.log(0, f"ERROR: Module readSHT31 failed on line {eTraceback.tb_lineno} - {e}") try: i2c = board.I2C() if i2caddress != "": sensor = adafruit_sht31d.SHT31D(i2c,i2caddressInt) else: sensor = adafruit_sht31d.SHT31D(i2c) ....

Alex-developer commented 5 months ago

Thanks for the idea, I'll add the option

Alex-developer commented 5 months ago

I have added the ability to set the i2c address for the SHT31 to both the temp and dewheater module. YOu will need to reinstall the modules to get the new functionality

mgarza commented 5 months ago

Thank you very much for your fast support :-)