micropython-sht30
micropython-sht30 copied to clipboard
SHT-30 alert functionality
Hello,
Thank you for this library. SHT30 sesnor comes with built-in alert pin which can be activated ex. if humidity is higher then set.
Details 3.5 (page 9) of datasheet: https://www.mouser.com/datasheet/2/682/Sensirion_Humidity_Sensors_SHT3x_Datasheet_digital-971521.pdf
Could you be so kind to add this functionality, to set the temp or humidity alert?
I mean something like function writeAlertData in this Arduino library: https://github.com/closedcube/ClosedCube_SHT31D_Arduino/blob/master/src/ClosedCube_SHT31D.cpp
Hi - great module - I'm sure a lot of folks are using it! Can I suggest some improvements? It's very easy to abstract out the I2C module and Pins and make this module more adaptable to other hardware:
- remove the import machine line
- abstract I2C to a bus:
def __init__(self, **bus**, delta_temp = 0, delta_hum = 0, i2c_address=DEFAULT_I2C_ADDRESS): self.i2c = bus self.i2c_addr = i2c_address self.set_delta(delta_temp, delta_hum) time.sleep_ms(50)
- remove the I2C init function and let the app developer handle his/her own I2C stuff. Doing the above will also fix the deprecated I2C function which has been replaced by SoftI2C.
I've made the above changes to your code and it's working great on the newer Wemos/Lolin E32S2 Mini and Pico.