Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHT-30 alert functionality #2

Open
tikky opened this issue Jan 6, 2020 · 1 comment
Open

SHT-30 alert functionality #2

tikky opened this issue Jan 6, 2020 · 1 comment

Comments

@tikky
Copy link

tikky commented Jan 6, 2020

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

@fpgirard
Copy link

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:

  1. remove the import machine line
  2. 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)
  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants