Sensor Configuration - FengtianGu/Sonoff-Tasmota GitHub Wiki
Pre-work:
The software allows for easy configuration of sensors and devices to selected GPIO pins. Depending on the type of Template/Module, certain GPIO pins are user configurable. Sensor configuration is possible by either the WebUI or using the commands Template
, Module
or GPIO
.
Tasmota supports:
The following single wire sensors are supported:
- DHT11 Temperature and Humidity -
DHT11 (1)
in group 1 - DHT21 Temperature and Humidity -
AM2301 (2)
in group 1 - AM2301 Temperature and Humidity -
AM2301 (2)
in group 1 - DHT22 Temperature and Humidity -
AM2301 (2)
in group 1 - AM2302 Temperature and Humidity -
AM2301 (2)
in group 1 - AM2321 Temperature and Humidity -
AM2301 (2)
in group 1 - Itead SI7021 Temperature and Humidity -
SI7021 (3)
in group 1 - DS18B20 Temperature -
DS18x20 (4)
in group 2
Enable optionUSE_DS18x20
inuser_config.h
for multiple sensors using OneWire library - DS18S20 Temperature -
DS18x20 (4)
in group 2
Enable optionUSE_DS18x20
inuser_config.h
using OneWire library - External switch -
Switch (9)
UseSwitchMode
to tune its behaviour - HC-SR501 PIR Motion Detection -
Switch (9)
UseSwitchMode
to tune its behaviour
Note: With older releases DHT22, AM20302, and AM2321 sensors operated under AM2302 (3)
. They now operate under AM2301 (2)
. If you are using a DHT22 or similar and do not see AM2302 (3)
use AM2301 (2)
.
You can add a sensor using the following commands:
-
Template
- select desired template functionality for the device (Wait for the restart) -
Modules
- show supported modules -
Module
- select desired module functionality for the device (Wait for the restart) -
Gpios
- show supported sensor types. (e.g. DHT21 = AM2301) -
GPIO
- show current defined sensors on supported GPIO pins or assign a GPIO function, - e.g.,gpio14 2
configures sensor AM2301 to GPIO14 (Wait for the restart)
For some sensors to show up you may need to cycle power to reset the device you just configured.
The following I2C sensors are supported using I2C SCL (5) and I2C SDA (6) in group 3:
- BH1750 Ambient Light Intensity
- DS3231 External RTC
- BMP180 Pressure and Temperature in group 3a
- BMP280 Pressure and Temperature in group 3a
- BME280 Pressure, Temperature and Humidity in group 3a
- HTU21 Temperature and Humidity in group 3b
- SI7013 Temperature and Humidity in group 3b
- SI7020 Temperature and Humidity in group 3b
- SI7021 Temperature and Humidity in group 3b
- SHT10 Temperature and Humidity in group 3c
- SHT11 Temperature and Humidity in group 3c
- SHT15 Temperature and Humidity in group 3c
You can add I2C sensors using the following commands:
-
Template
- select desired template functionality for the device (Wait for the restart) -
Modules
- show supported modules -
Module
- select desired module functionality for the device (Wait for the restart) -
Gpios
- show supported sensor types. We need two pins: I2C SCL (5) and I2C SDA (6) -
GPIO
- show current defined sensors on supported GPIO pins or assign a GPIO function, - e.g.,Backlog gpio14 5; gpio4 6
- select I2C SCL and SDA respectively (Wait for the restart)
The software will auto-detect the connected I2C devices. For some sensors to show up you may need to cycle power to reset the device just configured.
The following additional device(s) are supported:
- WS2812/WS2813 led string -
WS2812 (7)
in group 4
Using NeoPixelBus library and external 5V power supply - IR Remote -
IRremote (8)
in group 5
Using IRremoteESP8266 library and additional IR led hardware as documented here
You can add a device using the following commands:
-
Template
- select desired template functionality for the device (Wait for the restart) -
Modules
- show supported modules -
Module
- select desired module functionality for the device (Wait for the restart) -
Gpios
- show supported sensor types. We need WS2812 (7) -
GPIO
- show current defined sensors on supported GPIO pins or assign a GPIO function, - e.g.,gpio14 7
- select WS2812 led string (Wait for the restart)
For some sensors to show up you may need to cycle power to reset the device just configured.
The temperature units can be set to report in Celsius or Fahrenheit with the SetOption8
command:
To change the update interval change the TelePeriod
. The default interval is 300 seconds. The interval can be set between 10 and 3600 seconds. TelePeriod 10
will set the update interval to 10 seconds, so the sensor will update 6 times a minute.