I was having issues with my DHT22 humidity sensors which also include a temp sensor. Random very high values. Apparently the sensors don't last forever. The humidity sensors are used to determine when to open the windows in the basement in the summer to greatly reduce the humidity. Without a noisy, kWh guzzling dehumidifier. It's not obvious when it's a good time to open or close the windows.
I have two of them on one controller for upstairs and downstairs. There is a separate one of a different type, SHTC3, outside on a separate microcontroller. I only use DS18B20s for critical temp sensing used for control.
The sensors each take up one input with some dedicated DHT22 protocol.
With the new I2C sensors I free up those two inputs. It's better to use the limited NodeMCU I/O for a bus to talk to various devices instead of each device taking up dedicated I/O. Two inputs with I2C talk to many devices.
One input using the OneWire protocol talks to many DS18B20 temperature sensors. With multiple temp sensors it's much more reliable to use the unique 64 bit sensor address method. Otherwise I found temps can be mixed up occasionally. https://lastminuteengineers.com/multiple-ds18b20-arduino-tutorial/
I looked around for some I2C humidity sensors. There are quite a few different ones.
If you use I2C sensors they don't take up any new I/O if you put the data lines in parallel with the ones used for the clock. Many different sensors as well as digital and analog I/O expanders can go on the same two I2C inputs.
Different types of sensors have different I2C addresses so there is no conflict.
The issue I had was I want to use two of the same I2C sensors on the same I2C inputs.
One way is to get an I2C multiplexer chip that selects which device to talk to if they have the same address.
Another way is to get a sensor where you can change the I2C address. This is what I did.
Putting 3V or Gnd on one of the pins changes the address.
This sensor not only does humidity but also temp, pressure and altitude which is interesting.
It can tell if you lift it up a couple of feet based on the slight change in air pressure.
Altitude, instead of pressure, is used to determine if the trend is high pressure (lower than actual altitude reading) or low pressure (higher than actual altitude reading). High pressure can indicate good weather and low not so good.
I got 3 of them for $12. I always buy more than I need for stuff worth next to nothing in case I smoke a few. Or there is a defect.
I followed this website to work with multiple BME280s. Not waterproof like DS18B20s.
Tiny little board. The actual sensor is a teeny tiny 2.5mm cube.
New sensors usually need you to load a new library if it isn't already included with Arduino IDE.