Pre-configure the device before configuring a sensor

Michael Ingraham 2019-05-04 14:17:41 -04:00
parent 66d8064eae
commit a8dfb31516
1 changed files with 30 additions and 42 deletions

@ -1,14 +1,13 @@
Pre:
[How To Connect a Sensor](https://github.com/arendst/Sonoff-Tasmota/wiki/Expanding-Sonoffs)
Pre-work:
* [Device Configuration](https://github.com/arendst/Sonoff-Tasmota/wiki/Initial-Configuration)
* [How To Connect a Sensor](https://github.com/arendst/Sonoff-Tasmota/wiki/Expanding-Sonoffs)
The software allows for dynamically configuration of sensors and devices to selected GPIO pins. Depending on the type of (Sonoff) Module certain GPIO pins are easily accessible.
Sensor configuration is possible by either the web pages OR using the commands ``modules``, ``module``, ``gpios`` and ``gpio``.
The software allows for dynamically configuration of sensors and devices to selected GPIO pins. Depending on the type of Template/Module, certain GPIO pins are easily accessible. Sensor configuration is possible by either the web pages OR using the commands [`Template`](Commands#template), [`Module`](Commands#module), and [`GPIO`](Commands#gpio).
The software supports:
- [single wire sensors](#single-wire-sensor)
- [dual wire or I<sup>2</sup>C sensors](#i2c-sensor)
- [single wire devices](#device)
- [Single wire sensors](#single-wire-sensor)
- [Dual wire or I<sup>2</sup>C sensors](#i2c-sensor)
- [Single wire devices](#device)
Only one sensor per group is allowed.
@ -23,23 +22,21 @@ The following single wire sensors are supported:
- Itead SI7021 Temperature and Humidity - ``SI7021 (3)`` in group 1
- DS18B20 Temperature - ``DS18x20 (4)`` in group 2<br/>Enable option ``USE_DS18x20`` in ``user_config.h`` for multiple sensors using OneWire library
- DS18S20 Temperature - ``DS18x20 (4)`` in group 2<br/>Enable option ``USE_DS18x20`` in ``user_config.h`` using OneWire library
- External switch - ``Switch (9)``<br/>Use ``SwitchMode`` to tune its behaviour
- HC-SR501 PIR Motion Detection - ``Switch (9)``<br/>Use ``SwitchMode`` to tune its behaviour
- External switch - ``Switch (9)``<BR>Use [`SwitchMode`](Commands#switchmode) to tune its behaviour
- HC-SR501 PIR Motion Detection - ``Switch (9)``<BR>Use [`SwitchMode`](Commands#switchmode) 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 (MQTT) commands:
You can add a sensor using the following commands:
1. ``modules`` - show supported modules
2. ``module 4`` - select desired module functionality for a Sonoff TH (Wait for the restart)
3. ``gpios`` - show supported sensor types. (e.g. DHT21 = AM2301)
4. ``gpio`` - show current defined sensors on supported GPIO pins
5. ``gpio14 2`` - select sensor AM2301 (Wait for the restart)
* [`Template`](Commands#template) - select desired template functionality for the device (Wait for the restart)
* [`Modules`](Commands#modules) - show supported modules
* [`Module`](Commands#module) - select desired module functionality for the device (Wait for the restart)
* [`Gpios`](Commands#gpios) - show supported sensor types. (e.g. DHT21 = AM2301)
* [`GPIO`](Commands#gpio) - show current defined sensors on supported GPIO pins or assign a GPIO function, - e.g., ``gpio14 2`` select sensor AM2301 (Wait for the restart)
For some sensors to show up a power cycle of Sonoff is needed to reset the devices just configured.
## I<sup>2</sup>C sensor
The following I<sup>2</sup>C sensors are supported using I<sup>2</sup>C SCL (5) and I<sup>2</sup>C SDA (6) in group 3:
@ -59,29 +56,28 @@ The following I<sup>2</sup>C sensors are supported using I<sup>2</sup>C SCL (5)
- SHT11 Temperature and Humidity in group 3c
- SHT15 Temperature and Humidity in group 3c
You can add I<sup>2</sup>C sensors using the following (MQTT) commands:
You can add I<sup>2</sup>C sensors using the following commands:
1. ``modules`` - show supported modules
2. ``module 1`` - select desired module functionality for a Sonoff Basic (Wait for the restart)
3. ``gpios`` - show supported sensor types. We need two pins: I<sup>2</sup>C SCL (5) and I<sup>2</sup>C SDA (6)
4. ``gpio`` - show current defined sensors on supported GPIO pins
5. ``gpio14 5`` - select I<sup>2</sup>C SCL (Wait for the restart)
6. ``gpio4 6`` - select I<sup>2</sup>C SDA (Wait for the restart)
* [`Template`](Commands#template) - select desired template functionality for the device (Wait for the restart)
* [`Modules`](Commands#modules) - show supported modules
* [`Module`](Commands#module) - select desired module functionality for the device (Wait for the restart)
* [`Gpios`](Commands#gpios) - show supported sensor types. We need two pins: I<sup>2</sup>C SCL (5) and I<sup>2</sup>C SDA (6)
* [`GPIO`](Commands#gpio) - show current defined sensors on supported GPIO pins or assign a GPIO function, - e.g., ``Backlog gpio14 5; gpio4 6`` - select I<sup>2</sup>C SCL and SDA respectively (Wait for the restart)
The software will autodetect the connected I<sup>2</sup>C devices. For some sensors to show up a power cycle of Sonoff is needed to reset the devices just configured.
The software will auto-detect the connected I<sup>2</sup>C devices. For some sensors to show up you may need to cycle power to reset the device just configured.
## Device
The following additional device(s) are supported:
- WS2812 led string - ``WS2812 (7)`` in group 4<br/>Using NeoPixelBus library and external 5V power supply
- IR Remote - ``IRremote (8)`` in group 5<br/>Using IRremoteESP8266 library and additional IR led hardware as documented [here](https://github.com/altelch/SonoffIR)
You can add a device using the following (MQTT) commands:
You can add a device using the following commands:
1. ``modules`` - show supported modules
2. ``module 1`` - select desired module functionality for a Sonoff Basic (Wait for the restart)
3. ``gpios`` - show supported sensor types. We need WS2812 (7)
4. ``gpio`` - show current defined sensors on supported GPIO pins
5. ``gpio14 7`` - select WS2812 led string (Wait for the restart)
* [`Template`](Commands#template) - select desired template functionality for the device (Wait for the restart)
* [`Modules`](Commands#modules) - show supported modules
* [`Module`](Commands#module) - select desired module functionality for the device (Wait for the restart)
* [`Gpios`](Commands#gpios) - show supported sensor types. We need WS2812 (7)
* [`GPIO`](Commands#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 devices a power cycle of Sonoff is needed to reset the interface to the devices just configured.
@ -89,16 +85,8 @@ For some devices a power cycle of Sonoff is needed to reset the interface to the
### Temperature Units
The temperature units can be set to report in Fahrenheit with the command:
``SetOption8 1``
to set back to Celsius use:
``SetOption8 0``
The temperature units can be set to report in Celsius or Fahrenheit with the [`SetOption8`](Commands#setoption8) command:
### Update Interval
To change the update interval change the ``TelePeriod``. The default interval is 300 seconds. The interval can be set between 10 and 3600 seconds. To set the update interval to 10 seconds, so the sensor will update 6 times a minute use the command:
``TelePeriod 10``
To change the update interval change the [`TelePeriod`](Commands#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.