Sonoff TH with SI7021 humidity sensor

What part don't you know how to do?

  1. Read the humidity
  2. Compare it with a limit
  3. Switch the fan off/on

[Edit] If point 2 is the issue see this recent thread asking a very similar question Front montant du signal
Read the full thread.