new template images

blakadder 2019-10-31 17:44:07 +01:00
parent f925be91a8
commit 67adf05505
1 changed files with 31 additions and 47 deletions

@ -2,7 +2,7 @@ Starting with Tasmota version **6.5**, devices can be configured by users using
These are intended to be an easy way for users to create and share configurations for devices that are unsupported in Tasmota but have common characteristics with existing modules. We encourage everyone who creates a template for a [new unknown device](Configuration-Procedure-for-New-Devices) to [add it to the database](https://blakadder.github.io/templates/) with an image of the device, links to the manufacturer or where it can be found and, of course, the template for it.
To provide easy processing by Tasmota, a user template is written as a JSON text and could look like this:
To provide easy processing by Tasmota, a user template is written as a JSON string and could look like this:
```
{"NAME":"UserModule1","GPIO":[17,148,29,149,7,255,255,255,138,255,139,255,255],"FLAG":0,"BASE":18}
```
@ -13,41 +13,32 @@ More about [template properties](Templates#explanation-of-template-properties) a
Go to **Configuration - Configure Template** ...
![How to get to template config](https://i.postimg.cc/8ctGc97L/templat-step0.png)
![How to get to template config](https://i.postimg.cc/Z5QP4q7C/template1.png)
... and you'll end up looking at this screen.
![Configure Template](https://i.postimg.cc/J03FJbwH/templat-step1.png)
![Configure Template](https://i.postimg.cc/SR9375nG/template2.png)
Time to create your template.
### Creating your template <img src="https://i.postimg.cc/3xwMStdc/templat-step2.png" align="right">
1. Change the template name (also defines the name for `Module 0`).
### Creating your template
1. Change<img src="https://i.postimg.cc/SQwp2Lnr/template4.png" align="right"> the template name (also defines the name for the module).
2. Select a module to [**BASE** your template on](Templates#base). If you're not sure, `Module 18` is the best choice. In this example the device is based on Blitzwolf SHP (45) module.
3. Configure the components assigned to the [**GPIOs**](Templates#gpio) to match your device. If you do not know what pins your device uses, employ the [new device configuration procedure](Configuration-Procedure-for-New-Devices) to determine the correct pin assignments.
4. Any GPIO that have no component connected should be set to `None (0)`.
3. Configure the components assigned to the [**GPIOs**](Templates#gpio) to match your device. If you do not know what pins your device uses, read about the [new device configuration procedure](Configuration-Procedure-for-New-Devices) to determine the correct pin assignments.
![GPIO configuration](https://i.postimg.cc/d1j4sYZp/template5.png)
> Component `User (255)` is used for GPIO that are to be configurable. In fact, with a Template, every GPIO is easily configurable. So, why ever use `255`? When a Template is declared and activated, it becomes known to the device as `Module 0`. Any GPIO assigned as `255` become GPIO that can be configured through the Module dialog.
>
> Take, for example, a `Sonoff TH`. The design of the device exposes a jack that allows a user to plug in a sensor. The jack on the Sonoff TH is connected to GPIO4. Assigning GPIO4 as `255` allows a Template to be generic for this class of devices. Yet, when a user decides to connect a sensor using the jack, GPIO4 can be configured easily through the Module dialog to be set to the type of sensor connected to the device.
- Any unused GPIO that has cannot have a peripheral connected should be set to `None (0)`. In our example the device has no exposed GPIO's so the unused ones are set to `0` compared to the original BlitzWolf module.
- GPIOs can have peripherals connected to (exposed GPIOs) should be set tio `User (255)`. This allows future configuration through the **Configure Module** dialog without the need to create a new template.
![GPIO configuration](https://i.postimg.cc/44r41GDJ/templat-step3.png)
> A `Sonoff TH` is a good example. It has a jack connected to GPIO4 that allows a user to plug in a sensor. Assigning GPIO4 as `255` allows a Template to have correct for this device even if nothing is plugged in. But, when a user decides to connect a sensor using the jack, GPIO4 can be set to the type of sensor through the Configure Module page.
[Explanation of ADC](#ADC)
4. Click on **Save** and you'll see this message
5. Click on **Save**.
![](https://i.postimg.cc/4dqjcZxd/template6.png)
![](https://i.postimg.cc/nVvtCsy0/templat-step4.png)
5. Finally, the device will reboot with the new template name
6. Select `Module 0` in **Configuration - Configure Module**.
In the example dropdown menu you see the template name that is defined in step 1 (in this case `RGB Smart Plug`) always followed by `(0)`.
![](https://i.postimg.cc/gksFHCkh/templat-step5.png)
After clicking **Save**, your device will reboot with the new settings.
![](https://i.postimg.cc/mgnndBxP/templat-step6.png)
![](https://i.postimg.cc/NjxhzWpJ/template-finished.png)
## Exporting your Template
@ -57,32 +48,32 @@ Now that you've set up your previously unsupported device in Tasmota it is time
2. Open up **Console** and issue command `Template` which will output a string with the configuration of your currently active template. Our example gives the following:
```
MQT: stat/sonoff/RESULT = {"NAME":"RGB Smart Plug","GPIO":[37,0,39,0,38,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
MQT: stat/tasmota/RESULT = {"NAME":"RGB Smart Plug","GPIO":[37,0,39,0,38,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}
```
Copy the string `{"NAME":"RGB Smart Plug","GPIO":[37,0,39,0,38,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}` and share it on our [device template repository](https://blakadder.github.io/templates/) page.
### Merge Template and module settings
You can set up your device in module **Configuration - Configure Module** and use command `Template 255` to merge the settings from Configure Module with current template into a new Template named "Merged".
Copy the string `{"NAME":"RGB Smart Plug","GPIO":[37,0,39,0,38,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}` and share it on the [Tasmota Device Templates Repository](https://blakadder.github.io/templates/).
## Importing Templates
Go to **Configuration - Configure Other**
![How to get to template config](https://i.postimg.cc/TP4XKFZ0/templat-step1.png)
![How to get to template config](https://i.postimg.cc/25Hsznpn/template-import1.png)
When there:
1. Paste your template into the Template field
1. Paste the template string into the Template field
2. Make sure you **check Activate**
3. Click on **Save**.
![Template configuration](https://i.postimg.cc/sxfCBzTM/templat-step3.png)
![Template configuration](https://i.postimg.cc/P5HsKtzv/template-import2.png)
The device will reboot with a name reflecting your template name and `Module 0` selected which has your new template stored.
![It is finished](https://i.postimg.cc/8kqMRCRQ/templat-step4.png)
![It is finished](https://i.postimg.cc/28hN4qvf/template-import3.png
)
### Merge Template and module settings
You can set up your device in module **Configuration - Configure Module** and use command `Template 255` to merge the settings of the Module with current template into a new Template named "Merged".
## Template configuration with commands
A user provided template can be stored in Tasmota using the [`Template`](commands#template) command. It has the following parameters.
@ -97,11 +88,11 @@ A user provided template can be stored in Tasmota using the [`Template`](command
``Template {"NAME":"AnotherModuleName"}`` updates the name of a stored template
``Template {"FLAG":1}`` updates the flag of a stored template
``Template {"FLAG":0}`` deprecated legacy option
``Template {"BASE":0}`` updates the base of a stored template to Generic
After setting a template in command line it is necessary to issue `Module 0` command if the device doesn't reboot on its own.
**After setting a template in command line it is necessary to issue `Module 0` command if the device doesn't reboot on its own.**
# Explanation of template properties
Let's look again at our example template:
@ -140,19 +131,12 @@ See [Components](Components) for a complete list
[Google Sheet](https://docs.google.com/spreadsheets/d/10aYCaR3P09omn_vryFGyyq7dS-XK54K2fGAcb4gruik) with the components by number or alphabetically.
## FLAG
**This parameter is deprecated and should always be `0`**
The FLAG value is an 8-bit mask where each bit controls a feature. Add FLAG values to set multiple bits.
FLAG | Mask | Feature description
-----|----------|------------------------------
0 | xxxxxxxx | No features
1 | xxxxxxx1 | Use [ADC](ADC) as device voltage mter (only if [USE_ADC_VCC](ADC#ADC_VCC) is enabled)
2 | xxxxxx1x | Allow ADC0 as Temperature sensor (default in most precompiled builds)
4 | xxxxx1xx | Not used
8 | xxxx1xxx | Not used
16 | xxx1xxxx | Not used
32 | xx1xxxxx | Not used
64 | x1xxxxxx | Not used
128 | 1xxxxxxx | Not used
0 | xxxxxxxx | No special features
## BASE
BASE is the starting module setup for the custom template. Some modules include special programming. If your device is similar to an existing built-in module it is best to use that as a starting point. When you're not sure which BASE module is suitable for your device use the `Generic (18)` module. A list of hard-coded devices can be found in [Modules](Modules).