Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PubSubClient: Allow clean disconnection as optional. #7231

Merged
merged 2 commits into from
Dec 28, 2019

Conversation

ascillato
Copy link
Contributor

Description:

PubSubClient Library: Allow clean disconnection as optional.

This avoid the automatic deletion of the LWT message in the MQTT broker for clean disconnections in order to let LWT to work on all disconnections cases (Wifi disconnection, wifi bad comms, Normal Restart, Config Changes, unintended or intentional crash, OTA updates, ArduinoOTA, etc) and showing the Tasmota device as OFF-LINE in the home automation software until it reconnects and the LWT with ONLINE is sent again.

Related issue (if applicable): fixes #7189

Checklist:

  • The pull request is done against the latest dev branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR.
  • The code change is tested and works on core 2.6.1
  • The code change pass travis tests. Your PR cannot be merged unless tests pass
  • I accept the CLA.

Allow clean disconnect as optional.
This avoid the automatic deletion of LWT message in the broker for clean disconnections, in order to let LWT work also on all cases (Restart, Config Changes, etc) See arendst#7189
@arendst arendst added the on hold by dev team Result - Feature request put on hold by member of development team label Dec 17, 2019
@arendst arendst added this to the v8.2.0 milestone Dec 17, 2019
@arendst
Copy link
Owner

arendst commented Dec 28, 2019

I still can't see why we have to deviate from the standard. A clean disconnect tells the broker we're done for now.

Pls convince me.

@ascillato
Copy link
Contributor Author

Hi Theo,

We wouldn't be deviating from the standard. The issue is that Tasmota is sending a close package to the broker on clean disconnections (restarts, ota flash process, etc.) That close package is not needed because that tells the broker to dismiss the LWT. So, when the LWT is dismissed by the broker, Tasmota device will keep been showed, in the home automation software, as ONLINE while in reality is OFFLINE. This happens because as the LWT was dismissed by the broker (due to the closing package) the broker never publish the LWT as OFFLINE.

So, an easy test is to change the topic in Tasmota of a fully configured and working device. After the Tasmota's restart you will still see as ONLINE the old topic as long as the new topic.

That is why, the use of closing package for clean disconnections is not useful for Tasmota.

@arendst
Copy link
Owner

arendst commented Dec 28, 2019

Makes sense. Thx.

@arendst arendst merged commit 8369467 into arendst:development Dec 28, 2019
@ascillato ascillato deleted the patch-2 branch December 28, 2019 21:05
s-hadinger added a commit to s-hadinger/Tasmota that referenced this pull request Apr 21, 2020
arendst added a commit that referenced this pull request Apr 22, 2020
Change PWM implementation to Arduino #7231
Jason2866 added a commit to Jason2866/Tasmota that referenced this pull request Apr 22, 2020
* Format code with cpplint

Signed-off-by: Mickael Gaillard <mickael.gaillard@tactfactory.com>

* Change PWM implementation to Arduino arendst#7231

* Support for setting the time in the Tuya MCU

Switch on with USE_TUYA_TIME

* Fix wrong setting of free_range after reset or restart (arendst#8120)

* Fix ESP32 SCD30 compile error

* USE_TUYA_TIME deactivated by default

* Fix ESP32 compile errors

* Fix compilation

Co-authored-by: Mickael Gaillard <mickael.gaillard@tactfactory.com>
Co-authored-by: Stephan Hadinger <stephan.hadinger@gmail.com>
Co-authored-by: Walter Zengel <w.zengel@gmx.de>
Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>
Jason2866 pushed a commit to Jason2866/Tasmota that referenced this pull request Apr 22, 2020
s-hadinger added a commit to s-hadinger/Tasmota that referenced this pull request May 8, 2020
s-hadinger added a commit to s-hadinger/Tasmota that referenced this pull request May 8, 2020
arendst added a commit that referenced this pull request May 8, 2020
Update to latest PWM version of Arduino #7231
@grizewald grizewald mentioned this pull request Jun 11, 2020
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold by dev team Result - Feature request put on hold by member of development team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MQTT: Send Offline message to LWT on clean disconnect
2 participants