Use templates for probing GPIO configuration

Michael Ingraham 2019-11-14 08:38:13 -05:00
parent 3b20083475
commit 7affaabeb9
1 changed files with 18 additions and 11 deletions

@ -4,33 +4,40 @@ Some smart devices have additional functionality which may be handled by codes s
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 successive `Relay<x>` components.
1. Assign every available GPIO to successive `Relay<x>` components. For the initial GPIO probe, exclude "dedicated" GPIO such as GPIO0/GPIO2 and Tx/Rx, etc.) You can use a [Template](Templates) to easily perform these assignments:
`{"NAME":"ID Components","GPIO":[0,0,0,0,21,22,0,0,23,24,25,26,27],"FLAG":0,"BASE":18}`
_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 virtual buttons on the web UI to find which of the assigned GPIO actually control the physical relays and LEDs on the device. Make note of which GPIO act on which device peripheral.
- If you are unable to control some of the relays or LEDs on the device, they may be attached to the "dedicated" GPIO skipped in the initial probe. Now assign those GPIO:
`{"NAME":"ID Components","GPIO":[21,22,23,24,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}`
- Repeat step _1a_.
- If you device is based on the ESP8285 and you are still unable to control some of the relays or LEDs on the device, they may be attached to GPIO9 or GPIO10. Now assign those remaining GPIO:
`{"NAME":"ID Components","GPIO":[0,0,0,0,0,0,21,22,0,0,0,0,0],"FLAG":0,"BASE":18}`
- 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 GPIOs control the relays and LEDs, set these "active" GPIO to associate them with the corresponding `Relay<x>`, `LED<x>`, or `LEDLink` (Some may require the use of inverted (i.e., `Relay<x>i`/`LED<x>i`/`LEDLinki`) component).
_b._ Once you have found which GPIOs control which relay and LED, set these "active" GPIO to associate them with the corresponding `Relay<x>`, `LED<x>`, or `LEDLink` (Some may require the use of inverted (i.e., `Relay<x>i`/`LED<x>i`/`LEDLinki`) component).
**Make sure you have all relays assigned in order**, starting from 1 (`Relay1`, then `Relay2` and so on (you can mix regular and inverted ones))!
**For proper operation, in the final device configuration, assignment of like components must begin from `1` and be assigned sequentially!** Regular and inverted components can be intermixed.
(e.g., `Relay1`, then `Relay2`; `Led1`, then `Led2i` and so on)
2. Now, assign every remaining GPIO (excluding, once again, remaining "dedicated" like Tx/Rx & GPIO0/GPIO2, etc.) to successive `Switch<x>` components.
2. Now, assign every remaining GPIO (excluding, once again, remaining "dedicated" GPIO like GPIO0/GPIO2 and Tx/Rx, etc.) to successive `Switch1`..`Switch8` components (`9`..`16`). You can once again use a Template using `0` for the GPIO identified in step 1.
_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.
_a._ Save the configuration. Once the device reboots, use the web UI Console to run the `Status 8` (sensors) command. This will display the current state of each GPIO.
_b._ Then, while either holding down the button or having flipped the position of the switch, display `Status 8` again. Whichever GPIO changes state from what was shown in step _2a_ is the GPIO connected to the input.
_b._ Then, while either holding down the physical button or having flipped the position of the physical switch, display `Status 8` again. Whichever GPIO changes state from what was shown in step _2a_ is the GPIO connected to the input.
- If none of the GPIO change state, then assign the "dedicated" GPIO and retry step _2a_.
- If none of the GPIO change state, then assign the remaining GPIO and retry step _2a_.
_c._ Once you have found which GPIO are connected to each input, change the GPIO setting in the configuration to a `Button<x>` or `Switch<x>` according to your input component or use case. Proper operation may dictate the use regular or inverted (i.e., `Switch<x>i`/`Button<x>i`) settings. For buttons, you may need to determine whether the internal pull-up is used or not. If so, select `Button<x>`_**n**_, where _**n**_ indicates no pull-up.
- See [Using a physical pushbutton with single press, double press, and hold](https://github.com/arendst/Tasmota/wiki/Rule-cookbook#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 GPIO your device uses, set any remaining GPIO to `None (0)`.
- Save the configuration.
4. Once the device reboots, your device hardware is configured for use.
5. Since you have now configured a device not previously known to the TASMOTA user base, you may want to [export the template](https://github.com/arendst/Tasmota/wiki/Templates#exporting-your-template) and contribute it to the [templates database](https://blakadder.github.io/templates/).
5. Since you have now configured a device not previously known to the TASMOTA user base, you may want to [export the template](Templates#exporting-your-template) and contribute it to the [templates database](https://blakadder.github.io/templates/).
View this [Digiblur DIY video](https://youtu.be/5Oa27pCHtYo?t=518) for a tutorial on this procedure.