LED1/LED2 explanation. Information re: devices with additional MCU controls.

Michael Ingraham 2019-04-22 08:30:46 -04:00
parent adc19972d8
commit 2d339819d8
1 changed files with 13 additions and 9 deletions

@ -1,28 +1,32 @@
If your device is not a built-in module listed in the module configuration menu, a [user contributed device template](https://blakadder.github.io/templates/) ([explanation](Templates)) may be available. Otherwise, follow this procedure for configuring your device. If your device is not a built-in module listed in the module configuration menu, a [user contributed device template](https://blakadder.github.io/templates/) ([explanation](Templates)) may be available. Otherwise, follow this procedure for configuring the ESP chip pins used by your device.
If your device is similar to the existing built-in module it is best to use that as a starting point. When you're not sure which module is suitable for your device, use Generic module (18). Once you have selected the module type and saved the configuration, return to the module type configuration dialog. Some smart devices have additional functionality which may be handled by codes send to a separate MCU in the device. Devices with functions offloaded to a separate MCU require additional coding in the software. Certain supported Tasmota [BASE](Templates#base) devices have built-in code to handle MCU controlled devices. Using a template with an appropriate BASE device may have the programming logic required to manage the MCU commands for your device. If an existing BASE device with the logic for your device is **_not_** available, a modified device driver will be required. This case is outside of the scope of this article.
1. Set every GPIO (excluding, at first, "dedicated" GPIO such as Tx/Rx & GPIO0/GPIO2, etc.) each assigned to one of the available `Relay<x>` relays. If your device is similar to the existing built-in module (e.g., a particular MCU or power monitoring algorithm) it is best to use that as a starting point. When you are not sure which module is suitable for your device, use `Generic module (18)`. Once you have selected the module type and saved the configuration, return to the module type configuration dialog.
1. Assign every available GPIO (excluding, at first, "dedicated" GPIO such as Tx/Rx & GPIO0/GPIO2, etc.) to one of the `Relay<x>` relays.
_a._ Save the configuration. Once the device reboots, use the web GUI virtual buttons to find which of the buttons assigned to GPIO actually control relays and LEDs on the device. _a._ Save the configuration. Once the device reboots, use the web GUI virtual buttons to find which of the buttons assigned to GPIO actually control relays and LEDs on the device.
- If you are unable to control some of the relays or LEDs on the device, they may be attached to the "dedicated" GPIO. Set those GPIO to an unused `Relay<x>` and repeat step _1a_. - If you are unable to control some of the relays or LEDs on the device, they may be attached to the "dedicated" GPIO. Assign those GPIO to an unused `Relay<x>` and repeat step _1a_.
_b._ Once you have found which GPIO control which relays and LEDs, set these "active" GPIO to associate them with the corresponding `Relay<x>` or `LED<x>`. Proper operation may dictate the use regular or inverted (`Relay<x>i`/`LED<x>i`) settings. _b._ Once you have found which GPIO control which relays and LEDs, set these "active" GPIO to associate them with the corresponding `Relay<x>` or `LED<x>`. Proper operation may dictate the use regular or inverted (`Relay<x>i`/`LED<x>i`) settings.
2. Now, set every remaining GPIO (excluding, once again, remaining "dedicated" like Tx/Rx & GPIO0/GPIO2, etc.) to `Switch`es. _c._ Currently, Tasmota only supports up two GPIO configured as LEDs to indicate relay state and connectivity status. If only one LED is configured it will act as both the Wi-Fi/MQTT status LED (see [`SetOption31`](Commands#SetOption31)) and/or the LED that indicates relay power (see [`LedState`](Commands#LedState)/[`LedMask`](Commands#LedMask)). If two LEDs are defined, LED1 will act as the Wi-Fi/MQTT status LED and LED2 will act as the LED that indicates relay power.
_a._ Save the configuration. Once the device reboots, use the web GUI Console to run the<br>`Status 8` (sensors) command. This will display the current state of each GPIO. 2. Now, assign every remaining GPIO (excluding, once again, remaining "dedicated" like Tx/Rx & GPIO0/GPIO2, etc.) to `Switch`es.
_b._ Then, while pressing each button, display `Status 8` again. Whichever GPIO changes state from what was shown in step _2a_ is the GPIO tied to the button. _a._ Save the configuration. Once the device reboots, use the web GUI Console to run the `Status 8` (sensors) command. This will display the current state of each GPIO.
- If none of the GPIO change state, then configure the "dedicated" GPIO and retry. _b._ Then, while pressing each button, display `Status 8` again. Whichever GPIO changes state from what was shown in step _2a_ is the GPIO connected to the button.
- If none of the GPIO change state, then assign the "dedicated" GPIO and retry step _2a_.
_c._ Once you have found which GPIO are connected to each button, change the GPIO setting in the configuration to a `Button<x>`. You may need to determine whether the internal pull-up is used or not. If so, select `Button<x>`_**n**_. _**n**_ indicates no pull-up or normally-closed. _c._ Once you have found which GPIO are connected to each button, change the GPIO setting in the configuration to a `Button<x>`. You may need to determine whether the internal pull-up is used or not. If so, select `Button<x>`_**n**_. _**n**_ indicates no pull-up or normally-closed.
- See [Using a physical pushbutton with single press, double press, and hold](https://github.com/arendst/Sonoff-Tasmota/wiki/Rules#16-using-an-external-button-with-single-press---double-press-and-hold) to control multiple devices with one button. - See [Using a physical pushbutton with single press, double press, and hold](https://github.com/arendst/Sonoff-Tasmota/wiki/Rules#16-using-an-external-button-with-single-press---double-press-and-hold) to control multiple devices with one button.
3. Once you have determined which GPIO your device uses, set any remaining GPIO to `None`. 3. Once you have determined which pins your device uses, set any remaining pins to `None`.
- Save the configuration. - Save the configuration.