Input request: AM2301 sensor has been replaced with SI7021 in Sonoff TH16/10


I have been using Mycodo for a couple of years now and it has worked very well, I love it. Recently my AM2301 sensor died so I bought a replacement. Even though it is labelled as AM2301 the sensor inside is SI7021.

Upon further research it appears Sonoff at some point switched to using this SI7021 instead of AM2301 for temp/humidity . I bought 2 more sensors labelled as AM2301 but they both also have SI7021 inside so it does not work with Mycodo.

Is it possible to request that this sensor be added as an input?

Many thanks,

1 Like

A recent circuitpython library exists (adafruit-circuitpython-si7021 · PyPI) so it shouldn’t be too difficult to modify another temp/hum circuitpython library to use this library.

1 Like

Hi Kyle,

Thank you. I took a look at the link. Is this something that I would need to do myself? I am a much better grower than I am a coder lol.

The instructions at the link you posted seems like something I could follow but what would be needed after that to be able to use it within Mycodo for my conditional functions. How does it get added as an input?

Sorry if these questions are rudimentary but I am a novice.


Just added. Upgrade to master to get the code and test if it works.

1 Like

Great, thanks so much!

I upgraded to Master, no errors and there is an input for Si7021.

When I attempted to add the input I could not as it is listed as [I2C] but it is the same as the AM2301 sensor and plugs into the Sonoff TH16. I need to use the IP address of the Sonoff as the address of the sensor.

Input list:

1 Like

Sonoff TH16 with Si7201 sensor attached:

Ah. I see. I’ll copy and create a new Input with the new library.

1 Like

Just made a generic TH10/16 module that allows either the AM2301, Si7021, or any other temp/hum sensor it might switch to in the future to be used.

1 Like

Thank you that is now working. At first it was not pulling any data but once I forced it to acquire the measurements it started and is now pulling continuous live data :grinning:


Thanks again for this great software I have made a small donation, get yourself a six pack :beers:

That shouldn’t be necessary. Probably just didn’t wait long enough. In any case, thanks for verifying it works and for the donation.

1 Like