TasmotaManager/CONSOLE_COMMANDS.md

100 lines
6.2 KiB
Markdown

# Tasmota Console Commands Documentation
This document provides detailed information about the console commands used in the `network_configuration.json` file, particularly focusing on the SetOptions commands.
## Console Section in network_configuration.json
The `console` section in the `network_configuration.json` file allows you to configure various Tasmota device settings through the TasmotaManager script. These settings are applied to all devices during the version check process.
```json
{
"console": {
"SwitchRetain": "Off",
"ButtonRetain": "Off",
"PowerOnState": "3",
"PowerRetain": "On",
"SetOption1": "0",
"SetOption3": "1",
"SetOption13": "0",
"SetOption19": "0",
"SetOption32": "8",
"SetOption53": "1",
"SetOption73": "1",
"rule1": "on button1#state=10 do power0 toggle endon"
}
}
```
## MQTT Retain Settings
> **Important Note**: For all Retain parameters, the TasmotaManager script automatically sets the opposite state first before applying the final state specified in the configuration. This is necessary because the changes (not the final state) are what create the update of the Retain state at the MQTT server. The values in the configuration represent the final desired state.
| Command | Values | Description |
|---------|--------|-------------|
| `SwitchRetain` | `On`, `Off` | Controls whether MQTT retain flag is used on switch press messages. Default: `Off` |
| `ButtonRetain` | `On`, `Off` | Controls whether MQTT retain flag is used on button press messages. Default: `Off` |
| `PowerRetain` | `On`, `Off` | Controls whether MQTT retain flag is used on power state messages. Default: `Off` |
For example, if you specify `"PowerRetain": "On"` in your configuration:
1. The script will first set `PowerRetain Off`
2. Then set `PowerRetain On`
This ensures that the MQTT broker's retain settings are properly updated.
## Power Settings
| Command | Values | Description |
|---------|--------|-------------|
| `PowerOnState` | `0` to `4` | Controls the power state when the device is powered up:<br>`0` = Off<br>`1` = On<br>`2` = Toggle<br>`3` = Last state (default)<br>`4` = Turn on if off after restart |
## SetOptions
SetOptions are special commands that control various aspects of Tasmota device behavior. Below are the SetOptions currently used in the configuration:
| Command | Values | Description |
|---------|--------|-------------|
| `SetOption1` | `0`, `1` | Controls whether a button press toggles power or sends a MQTT message:<br>`0` = toggle power (default)<br>`1` = send MQTT message |
| `SetOption3` | `0`, `1` | Controls MQTT enabled/disabled:<br>`0` = disable MQTT<br>`1` = enable MQTT (default) |
| `SetOption13` | `0`, `1` | Controls whether a button press clears retained messages:<br>`0` = disable (default)<br>`1` = enable |
| `SetOption19` | `0`, `1` | Controls Home Assistant auto-discovery:<br>`0` = disable (default)<br>`1` = enable |
| `SetOption32` | `1` to `250` | Time in minutes to hold relay latching power before reset. Default: `1` |
| `SetOption53` | `0`, `1` | Controls display of hostname and IP address in GUI:<br>`0` = disable (default)<br>`1` = enable |
| `SetOption73` | `0`, `1` | Controls whether HTTP cross-origin resource sharing is enabled:<br>`0` = disable (default)<br>`1` = enable |
## Additional SetOptions
Here are some other useful SetOptions that can be added to the configuration:
| Command | Values | Description |
|---------|--------|-------------|
| `SetOption0` | `0`, `1` | Save power state and use after restart:<br>`0` = disable<br>`1` = enable (default) |
| `SetOption4` | `0`, `1` | Return MQTT response as RESULT or %COMMAND%:<br>`0` = RESULT (default)<br>`1` = %COMMAND% |
| `SetOption8` | `0`, `1` | Show temperature in Celsius or Fahrenheit:<br>`0` = Celsius (default)<br>`1` = Fahrenheit |
| `SetOption10` | `0`, `1` | When the device restarts, the LWT message is sent:<br>`0` = disable (default)<br>`1` = enable |
| `SetOption11` | `0`, `1` | Swap button single and double press functionality:<br>`0` = disable (default)<br>`1` = enable |
| `SetOption20` | `0`, `1` | Update of Hass discovery messages:<br>`0` = disable (default)<br>`1` = enable |
| `SetOption30` | `0`, `1` | Enforce Home Assistant auto-discovery as light:<br>`0` = disable (default)<br>`1` = enable |
| `SetOption31` | `0`, `1` | Disable status LED blinking during Wi-Fi and MQTT connection issues:<br>`0` = LED enabled (default)<br>`1` = LED disabled |
| `SetOption36` | `0` to `255` | Boot loop control:<br>`0` = disable (default)<br>`1` to `200` = enable with number of boot loops before entering safe mode |
| `SetOption52` | `0`, `1` | Control display of optional time offset from UTC in JSON messages:<br>`0` = disable (default)<br>`1` = enable |
| `SetOption65` | `0`, `1` | Device recovery using fast power cycle detection:<br>`0` = disable (default)<br>`1` = enable |
| `SetOption80` | `0`, `1` | Enable Alexa support for devices with an ESP8266 over 1M flash:<br>`0` = disable<br>`1` = enable (default) |
| `SetOption82` | `0`, `1` | Reduce the CT range from 153..500 to 200..380 to accommodate with Alexa:<br>`0` = CT ranges from 153 to 500 (default)<br>`1` = CT ranges from 200 to 380 (Alexa compatible) |
## Rules
Rules allow you to create simple automations directly on the Tasmota device.
### Automatic Rule Enabling
When you define a rule (e.g., `rule1`, `rule2`, `rule3`), the TasmotaManager script will automatically enable it by sending the corresponding enable command (`Rule1 1`, `Rule2 1`, `Rule3 1`) to the device. This means you only need to include the rule definition in your configuration, and the script will handle enabling it.
| Command | Values | Description |
|---------|--------|-------------|
| `rule1` | Rule expression | Defines the first rule. Example: `on button1#state=10 do power0 toggle endon` |
| `rule2` | Rule expression | Defines the second rule. |
| `rule3` | Rule expression | Defines the third rule. |
Note: You no longer need to include the `Rule1`, `Rule2`, or `Rule3` commands in your configuration as they are automatically applied. If you do include them, they will still be processed, but they are redundant.
For more information about Tasmota commands, visit the [official Tasmota documentation](https://tasmota.github.io/docs/Commands/).