Skip to content

Commit bf1f8a7

Browse files
committed
mqtt retained moved to mqtt article
1 parent 8146215 commit bf1f8a7

10 files changed

+45
-33
lines changed

Commands.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ LedPower<x\>|LED<x\> power state control. **Enabled only when LedLink(i) is conf
106106
LedState<a id="ledstate"></a>|Manage LED state<BR> `0` = disable use of LED as much as possible <BR> `1` = show power state on LED (LED on when power on) *(default)* *(inverted for Sonoff Touch/T1)*<BR> `2` = show MQTT subscriptions as a LED blink<BR> `3` = show power state and MQTT subscriptions as a LED blink<BR> `4` = show MQTT publications as a LED blink<BR> `5` = show power state and MQTT publications as a LED blink<BR> `6` = show all MQTT messages as a LED blink<BR> `7` = show power state and MQTT messages as a LED blink<BR>`8` = LED on when Wi-Fi and MQTT are connected.<BR>_*Cannot* be issued directly and is only activated when `LedPower` is switched from `0` to `1` due to a software function_
107107
Power0<a id="Power0"></a>|Control the power state simultaneously for all relays on the device<BR> `0` / `off` = turn OFF <BR> `1` / `on` = turn ON <BR> `2` / `toggle` = if relay is `ON` switch to `OFF` and vice versa
108108
Power<x\><a id="power"></a>|Control the corresponding Relay (enumerated) power state and also restart PulseTime<x\><BR> `0` / `off` / `false` = turn OFF <BR> `1` / `on` / `true` = turn ON <BR> `2` / `toggle` = if relay is `ON` switch to `OFF` and vice versa<BR> `3` / `blink` = toggle power for [BlinkCount](#blinkcount) times each [BlinkTime](#blinktime) duration (at the end of `blink`, relay power is returned to pre-blink state)<BR> `4` / `blinkoff` = stop blink sequence and return relay power to pre-blink state
109-
PowerOnState<a id="poweronstate"></a>|Control relay state when the device is _**powered up**_. [More information](PowerOnState-Configuration)<BR> `0` / `OFF` = keep relay(s) OFF after power up <BR> `1` / `ON` = turn relay(s) ON after power up <BR> `2` / `TOGGLE` = toggle relay(s) from last saved state <BR> `3` = switch relay(s) to their last saved state *(default)* <BR> `4` = turn relay(s) ON and disable further relay control <BR> `5` = after a `PulseTime` period turn relay(s) ON (acts as inverted [`PulseTime`](Commands#pulsetime) mode)
109+
PowerOnState<a id="poweronstate"></a>|Control relay state when the device is _**powered up**_. [More information](PowerOnState)<BR> `0` / `OFF` = keep relay(s) OFF after power up <BR> `1` / `ON` = turn relay(s) ON after power up <BR> `2` / `TOGGLE` = toggle relay(s) from last saved state <BR> `3` = switch relay(s) to their last saved state *(default)* <BR> `4` = turn relay(s) ON and disable further relay control <BR> `5` = after a `PulseTime` period turn relay(s) ON (acts as inverted [`PulseTime`](Commands#pulsetime) mode)
110110
PulseTime<x\><a id="pulsetime"></a>|Display the amount of `PulseTime` remaining on the corresponding Relay (enumerated)<BR>`<value>` Set the duration to keep the corresponding Relay `ON` when `Power<x> ON` command is issued. After this amount of time, the relay will be turned `OFF`.<BR>`0` / `OFF` = disable use of PulseTime for the corresponding Relay<BR>`1..111` = set PulseTime for the corresponding Relay in 0.1 second increments<BR>`112..64900` = set PulseTime for the corresponding Relay, offset by 100, in 1 second increments. Add 100 to desired interval in seconds, e.g., `PulseTime 113` = 13 seconds and `PulseTime 460` = 6 minutes (i.e., 360 seconds)<BR>
111111
SwitchDebounce<a id="switchdebounce"></a>|User control over switch debounce timing <BR>`40..1000` = set switch debounce time in milliseconds *(default = `50`)*
112112
SwitchMode<x\><a id="switchmode"></a>|[Switch mode](Buttons-and-Switches#switchmode) <BR> `0` = toggle *(default)* <BR> `1` = follow (0 = off, 1 = on) <BR> `2` = inverted follow (0 = on, 1 = off) <BR> `3` = pushbutton (default 1, 0 = toggle) <BR> `4` = inverted pushbutton (default 0, 1 = toggle) <BR> `5` = pushbutton with hold (default 1, 0 = toggle, Hold = hold) <BR> `6` = inverted pushbutton with hold (default 0, 1 = toggle, hold = hold) <BR> `7` = pushbutton toggle (0 = toggle, 1 = toggle)
@@ -187,7 +187,7 @@ MqttPassword<a id="mqttpassword"></a>|`0` = clear MQTT password<BR>`1` = reset M
187187
MqttPort<a id="mqttport"></a>|`1` = reset MQTT port to firmware default (`MQTT_PORT`) and restart<BR>`<value>` = set MQTT port between 2 and 32766 and restart
188188
MqttRetry<a id="mqttretry"></a>|`10..32000` = set MQTT connection retry timer in seconds *(default = `10`)*
189189
MqttUser<a id="mqttuser"></a>|`0` = clear MQTT user name<BR>`1` = reset MQTT user name to firmware default (`MQTT_USER`) and restart<BR>`<value>` = set MQTT user name (32 chars max) and restart
190-
PowerRetain<a id="powerretain"></a>|MQTT [power retain state](PowerOnState-Configuration#side-effects-with-using-mqtt-messages)<BR> `0` / `off` = disable MQTT power retain on status update *(default)* <BR> `1` / `on` = enable MQTT power retain on status update <BR>
190+
PowerRetain<a id="powerretain"></a>|MQTT [power retain state](PowerOnState#side-effects-with-using-mqtt-messages)<BR> `0` / `off` = disable MQTT power retain on status update *(default)* <BR> `1` / `on` = enable MQTT power retain on status update <BR>
191191
Prefix1<a id="Prefix1"></a>|`1` = reset MQTT command subscription prefix to firmware default (`SUB_PREFIX`) and restart<BR>`<value>` = set MQTT command subscription prefix (10 chars max) and restart
192192
Prefix2<a id="Prefix2"></a>|`1` = reset MQTT status prefix to firmware default (`PUB_PREFIX`) and restart<BR>`<value>` = set MQTT status prefix (10 chars max) and restart
193193
Prefix3<a id="Prefix3"></a>|`1` = Reset MQTT telemetry prefix to firmware default (`PUB_PREFIX2`) and restart<BR>`<value>` = set MQTT telemetry prefix (10 chars max) and restart

Flash-Sonoff-using-Raspberry-Pi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Summarizing the process and needed connections based on the above blog, please r
1111
2. Prepare serial connection.
1212
_Note: Use the correct serial connection as per your version of the Raspberry Pi._
1313

14-
| Device | Serial Connection |
14+
| Device | Serial Connection |
1515
| ------------- |---------------|
1616
| RaspberryPi 1/2/3 (BT disabled or miniuart) | /dev/ttyAMA0 |
1717
| RaspberryPi 3 | /dev/ttyS0 |

How-to-Flash-the-RF-Bridge.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
Someone asked me on here a more detailed explanation of how to do this, so I thought I would post (as best as I can recall) how to do it with a Windows PC.
3+
4+
- The Sonoff RF Bridge firmware is uploaded Like any other ESP device. Please refer to the [flashing](Flashing) instructions.
5+
6+
- Ensure the switch on your RF Bridge is switched of the OFF position (change it back to ON position AFTER flashing your Bridge).
7+
8+
- Connect up your USB serial adapter to the correct pins on the bridge. Hold DOWN the pairing button while connecting the USB serial adapter to your computer (the bridge should now go into the correct mode where you can flash it). (Pin out etc on the below image)
9+
![pin](https://i.imgur.com/djhr2Jg.jpg)
10+
11+
- At the top right of the Arduio IDE software, click on the right arrow (UPLOAD) to upload the firmware. This should take about 2-3 minutes as it compiles the firmware then uploads it.
12+
13+
When compete, disconnect the cables etc, switch the switch back to the ON position (away from the 5 pin header) and it should now be working as you expect.
14+
15+
Credits @erew123 #1841

MQTT.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,26 @@ By default the Fallback Topic is `DVES_XXXXXX_fb` where xxxxxx is derived from t
150150
00:00:00 MQT: stat/tasmota/STATUS6 = {"StatusMQT":{"MqttHost":"1.1.1.1","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_3D5E26","MqttUser":"tasmota","MqttCount":1,"MAX_PACKET_SIZE":1000,"KEEPALIVE":30}}
151151
```
152152

153+
## Retained MQTT Messages
153154

155+
If MQTT is defined and [`PowerRetain`](Commands#powerretain) is used the last state will be stored permanently in MQTT database.
156+
157+
|Command | Description |
158+
|-|-|
159+
[`PowerRetain`](Commands#powerretain) | Show current MQTT power retain state.<BR> `0` / `off` = disable MQTT power retain on status update *(default)* <BR> `1` / `on` = enable MQTT power retain on status update
160+
161+
**BUT**, a message in your MQTT broker flagged as 'retained' will ***_always_ override the `PowerOnState`***.
162+
163+
This is usually the main cause for "ghost switching". Learn more in [MQTT retained messages explained](http://www.steves-internet-guide.com/mqtt-retained-messages-example/). Check out [this tutorial](https://www.youtube.com/watch?v=31IyfM1gygo) for troubleshooting switch ghosting.
164+
165+
### Clearing Retained Messages
166+
To check, if there is a retain flag set for the switch's power topic, monitor `cmnd/+/power` in a MQTT client (recommended [MQTT.fx](https://mqttfx.jensd.de/) for Windows or [Eclipse Mosquitto](https://mosquitto.org/) in linux).
167+
168+
You can use [Tasmota Device Manager](https://github.com/jziolkowski/tdm) to clear all retained messages for selected device with a single click.
169+
170+
![Tasmota Device Manager](_media/tdm-retained.png)
171+
172+
or use the following tutorials/forum threads:
173+
* [Clearing retained messages with mosquitto](https://community.openhab.org/t/clearing-mqtt-retained-messages/58221)
174+
* [Remove retained messages in Home Assistant](https://community.home-assistant.io/t/mqtt-how-to-remove-retained-messages/79029)
175+
* [Remove retained messages in hass.io MQTT addon](https://community.home-assistant.io/t/clear-hass-io-mosquitto-broker-add-on-retain-messages/57250/3)

PowerOnState-Configuration.md renamed to PowerOnState.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,4 @@
1-
## Side effects with using MQTT messages
2-
3-
If MQTT is defined and [`PowerRetain`](Commands#powerretain) is used the last state will be stored permanently in MQTT database.
4-
5-
|Command | Description |
6-
|-|-|
7-
[`PowerRetain`](Commands#powerretain) | Show current MQTT power retain state.<BR> `0` / `off` = disable MQTT power retain on status update *(default)* <BR> `1` / `on` = enable MQTT power retain on status update
8-
9-
**BUT**, a message in your MQTT broker flagged as 'retained' will ***_always_ override the `PowerOnState`***.
10-
11-
This is usually the main cause for "ghost switching". Learn more in [MQTT retained messages explained](http://www.steves-internet-guide.com/mqtt-retained-messages-example/). Check out [this tutorial](https://www.youtube.com/watch?v=31IyfM1gygo) for troubleshooting switch ghosting.
12-
13-
### Clearing Retained Messages
14-
To check, if there is a retain flag set for the switch's power topic, monitor `cmnd/+/power` in a MQTT client (recommended [MQTT.fx](https://mqttfx.jensd.de/) for Windows or [Eclipse Mosquitto](https://mosquitto.org/) in linux).
15-
16-
You can use [Tasmota Device Manager](https://github.com/jziolkowski/tdm) to clear all retained messages for selected device with a single click.
17-
18-
![Tasmota Device Manager](https://user-images.githubusercontent.com/5904370/54465515-cd27d500-477b-11e9-92b8-bfda02325686.png)
19-
20-
or use the following tutorials/forum threads:
21-
* [Clearing retained messages with mosquitto](https://community.openhab.org/t/clearing-mqtt-retained-messages/58221)
22-
* [Remove retained messages in Home Assistant](https://community.home-assistant.io/t/mqtt-how-to-remove-retained-messages/79029)
23-
* [Remove retained messages in hass.io MQTT addon](https://community.home-assistant.io/t/clear-hass-io-mosquitto-broker-add-on-retain-messages/57250/3)
24-
25-
## Predefined PowerOnState functionality
1+
## PowerOnState Functionality
262

273
| Command | Description |
284
|-|-|

Tutorials.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Installation Tutorials
22
* [How to Flash the RF Bridge](How-to-Flash-the-RF-Bridge)
3-
* [Flash your Sonoff switch using a RaspberryPi instead of USB-to-TTL serial connector](Flash-Sonoff-using-Raspberry-Pi)
3+
* [Flash your device using a RaspberryPi instead of USB-to-TTL serial connector](Flash-Sonoff-using-Raspberry-Pi)
44
* [Flashing over the original firmware via OTA update](https://github.com/codetheweb/tuyapi/issues/49#issuecomment-452512186)
55

66
### Video tutorials

_media/tdm-retained.png

5.31 KB
Loading

_sidebar.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
* [Web UI](WebUI)
2323
* [Supported Modules](/devices/)
2424
* **Useful Topics**
25-
* [Tutorials](Tutorials)
2625
* [Cool Projects](Cool-Projects)
2726
* [Securing Your Setup](Securing-your-IoT-from-hacking)
28-
* [MQTT Retained Messages](PowerOnState-Configuration)
27+
* [Tutorials](Tutorials)
2928
* [Energy Saving](Energy-Saving)
3029
* [Theo'sTips](Tips)
3130
* [What's New!](What's-New)

help/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ You can disable status LED blinking using:
211211
`Backlog LedPower 0; SetOption31 1`
212212

213213
### My device randomly switches on and off. Do I have ghosts in my house?
214-
Most of the issues with random, or "ghost", switching are related to MQTT retain settings. In short, your MQTT broker is retaining a message with the POWER status of the device which gets applied on reboots. [Solution here](PowerOnState-Configuration#side-effects-with-using-mqtt-messages)
214+
Most of the issues with random, or "ghost", switching are related to MQTT retain settings. In short, your MQTT broker is retaining a message with the POWER status of the device which gets applied on reboots. [Solution here](PowerOnState#side-effects-with-using-mqtt-messages)
215215

216216
In some cases, adding a switch to a device causes ghost switching. In this case, you may need to add a [low pass filter](https://www.youtube.com/watch?v=aq8_os6g13s&ab_channel=DrZzs) to dampen any spikes on the input. In the case of the Sonoff T1, a modification to [change the filter capacitor](https://github.com/arendst/Tasmota/issues/5449#issuecomment-478471697) on the PCB may be required.
217217

sidebar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Installation
3030

3131
[](Cool-Projects)
3232
[](MQTT-Overview)
33-
[](PowerOnState-Configuration)
33+
[](PowerOnState)
3434
[](Energy-Saving)
3535
[](Securing-your-IoT-from-hacking)
3636
[](For-Developers)

0 commit comments

Comments
 (0)