forked from tasmota/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
11 lines (11 loc) · 51.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
<!doctype html><html lang=en class=no-js> <head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" href=../_media/favicon.ico><meta name=generator content="mkdocs-1.1, mkdocs-material-5.0.0rc4"><title>MQTT - Tasmota</title><link rel=stylesheet href=../assets/stylesheets/main.c1451e9e.min.css><link rel=stylesheet href=../assets/stylesheets/palette.4444686e.min.css><meta name=theme-color content=#2196f3><link href=https://fonts.gstatic.com rel=preconnect crossorigin><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Barlow:300,400,400i,700%7CRoboto+Mono&display=fallback"><style>body,input{font-family:"Barlow",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono",SFMono-Regular,Consolas,Menlo,monospace}</style><link rel="preconnect dns-prefetch" href=https://www.google-analytics.com><script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-140681905-2","auto"),ga("set","anonymizeIp",!0),ga("send","pageview"),document.addEventListener("DOMContentLoaded",function(){document.forms.search&&document.forms.search.query.addEventListener("blur",function(){if(this.value){var e=document.location.pathname;ga("send","pageview",e+"?q="+this.value)}})}),document.addEventListener("DOMContentSwitch",function(){ga("send","pageview")})</script><script async src=https://www.google-analytics.com/analytics.js></script></head> <body dir=ltr data-md-color-primary=blue data-md-color-accent=indigo> <input class=md-toggle data-md-toggle=drawer type=checkbox id=__drawer autocomplete=off> <input class=md-toggle data-md-toggle=search type=checkbox id=__search autocomplete=off> <label class=md-overlay for=__drawer></label> <div data-md-component=skip> <a href=#configure-mqtt class=md-skip> Skip to content </a> </div> <div data-md-component=announce> </div> <header class=md-header data-md-component=header> <nav class="md-header-nav md-grid" aria-label=Header> <a href=.. title=Tasmota class="md-header-nav__button md-logo" aria-label=Tasmota> <img src=../_media/logo.svg alt=logo> </a> <label class="md-header-nav__button md-icon" for=__drawer> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z /></svg> </label> <div class=md-header-nav__title data-md-component=header-title> <div class=md-header-nav__ellipsis> <span class="md-header-nav__topic md-ellipsis"> Tasmota </span> <span class="md-header-nav__topic md-ellipsis"> MQTT </span> </div> </div> <label class="md-header-nav__button md-icon" for=__search> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"/></svg> </label> <div class=md-search data-md-component=search role=dialog> <label class=md-search__overlay for=__search></label> <div class=md-search__inner role=search> <form class=md-search__form name=search> <input type=text class=md-search__input name=query aria-label=Search placeholder=Search autocapitalize=off autocorrect=off autocomplete=off spellcheck=false data-md-component=search-query data-md-state=active> <label class="md-search__icon md-icon" for=__search> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"/></svg> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </label> <button type=reset class="md-search__icon md-icon" aria-label=Clear data-md-component=search-reset tabindex=-1> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z /></svg> </button> </form> <div class=md-search__output> <div class=md-search__scrollwrap data-md-scrollfix> <div class=md-search-result data-md-component=search-result> <div class=md-search-result__meta> Type to start searching </div> <ol class=md-search-result__list></ol> </div> </div> </div> </div> </div> <div class=md-header-nav__source> <a href=https://github.com/arendst/tasmota/ title="Go to repository" class=md-source> <div class="md-source__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 448 512"><path d="M439.55 236.05L244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg> </div> <div class=md-source__repository> arendst/tasmota </div> </a> </div> </nav> </header> <div class=md-container data-md-component=container> <nav class=md-tabs aria-label=Tabs data-md-component=tabs> <div class="md-tabs__inner md-grid"> <ul class=md-tabs__list> <li class=md-tabs__item> <a href=.. class="md-tabs__link md-tabs__link--active"> Home </a> </li> <li class=md-tabs__item> <a href=../Scripting-Language/ class=md-tabs__link> Features </a> </li> <li class=md-tabs__item> <a href=../Alexa/ class=md-tabs__link> Smart Home Integrations </a> </li> <li class=md-tabs__item> <a href=../Displays/ class=md-tabs__link> Peripherals </a> </li> <li class=md-tabs__item> <a href=../Configuration-Procedure-for-New-Devices/ class=md-tabs__link> Supported Devices </a> </li> <li class=md-tabs__item> <a href=../FAQ/ class=md-tabs__link> Help </a> </li> </ul> </div> </nav> <main class=md-main data-md-component=main> <div class="md-main__inner md-grid"> <div class="md-sidebar md-sidebar--primary" data-md-component=navigation> <div class=md-sidebar__scrollwrap> <div class=md-sidebar__inner> <nav class="md-nav md-nav--primary" aria-label=Navigation data-md-level=0> <label class=md-nav__title for=__drawer> <a href=.. title=Tasmota class="md-nav__button md-logo" aria-label=Tasmota> <img src=../_media/logo.svg alt=logo> </a> Tasmota </label> <div class=md-nav__source> <a href=https://github.com/arendst/tasmota/ title="Go to repository" class=md-source> <div class="md-source__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 448 512"><path d="M439.55 236.05L244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg> </div> <div class=md-source__repository> arendst/tasmota </div> </a> </div> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=.. title=Home class=md-nav__link> Home </a> </li> <li class=md-nav__item> <a href=../About/ title=About class=md-nav__link> About </a> </li> <li class=md-nav__item> <a href=../Getting-Started/ title="Getting Started" class=md-nav__link> Getting Started </a> </li> <li class=md-nav__item> <a href=../Upgrading/ title=Upgrading class=md-nav__link> Upgrading </a> </li> <li class="md-nav__item md-nav__item--active"> <input class="md-nav__toggle md-toggle" data-md-toggle=toc type=checkbox id=__toc> <label class="md-nav__link md-nav__link--active" for=__toc> MQTT <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M3,9H17V7H3V9M3,13H17V11H3V13M3,17H17V15H3V17M19,17H21V15H19V17M19,7V9H21V7H19M19,13H21V11H19V13Z /></svg> </span> </label> <a href=./ title=MQTT class="md-nav__link md-nav__link--active"> MQTT </a> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <label class=md-nav__title for=__toc> <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </span> Table of contents </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=#configure-mqtt class=md-nav__link> Configure MQTT </a> <nav class=md-nav aria-label="Configure MQTT"> <ul class=md-nav__list> <li class=md-nav__item> <a href=#configure-mqtt-using-webui class=md-nav__link> Configure MQTT using WebUI </a> </li> <li class=md-nav__item> <a href=#configure-mqtt-using-backlog class=md-nav__link> Configure MQTT using Backlog </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=#commands-over-mqtt class=md-nav__link> Commands over MQTT </a> <nav class=md-nav aria-label="Commands over MQTT"> <ul class=md-nav__list> <li class=md-nav__item> <a href=#command-flow class=md-nav__link> Command flow </a> </li> <li class=md-nav__item> <a href=#examples class=md-nav__link> Examples </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=#mqtt-topic-definition class=md-nav__link> MQTT Topic Definition </a> <nav class=md-nav aria-label="MQTT Topic Definition"> <ul class=md-nav__list> <li class=md-nav__item> <a href=#fulltopic class=md-nav__link> FullTopic </a> </li> <li class=md-nav__item> <a href=#topic class=md-nav__link> %topic% </a> </li> <li class=md-nav__item> <a href=#grouptopic class=md-nav__link> GroupTopic </a> </li> <li class=md-nav__item> <a href=#fallback-topic class=md-nav__link> FallBack Topic </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=#retained-mqtt-messages class=md-nav__link> Retained MQTT Messages </a> <nav class=md-nav aria-label="Retained MQTT Messages"> <ul class=md-nav__list> <li class=md-nav__item> <a href=#clearing-retained-messages class=md-nav__link> Clearing Retained Messages </a> </li> </ul> </nav> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../Commands/ title=Commands class=md-nav__link> Commands </a> </li> <li class=md-nav__item> <a href=../Templates/ title=Templates class=md-nav__link> Templates </a> </li> <li class=md-nav__item> <a href=../Components/ title=Components class=md-nav__link> Components </a> </li> <li class=md-nav__item> <a href=../Modules/ title=Modules class=md-nav__link> Modules </a> </li> <li class=md-nav__item> <a href=../Rules/ title=Rules class=md-nav__link> Rules </a> </li> <li class=md-nav__item> <a href=../Timers/ title=Timers class=md-nav__link> Timers </a> </li> <li class=md-nav__item> <a href=../Lights/ title=Lights class=md-nav__link> Lights </a> </li> <li class=md-nav__item> <a href=../Buttons-and-Switches/ title="Buttons and Switches" class=md-nav__link> Buttons and Switches </a> </li> <li class=md-nav__item> <a href=../Supported-Peripherals/ title=Peripherals class=md-nav__link> Peripherals </a> </li> <li class=md-nav__item> <a href=../TuyaMCU/ title=TuyaMCU class=md-nav__link> TuyaMCU </a> </li> <li class=md-nav__item> <a href=../Device-groups.md title=None class=md-nav__link> None </a> </li> <li class=md-nav__item> <a href=../Blinds-and-Shutters/ title="Blinds and Shutters" class=md-nav__link> Blinds and Shutters </a> </li> <li class=md-nav__item> <a href=../Shutter-and-Steppers/ title="Shutter and Steppers" class=md-nav__link> Shutter and Steppers </a> </li> <li class=md-nav__item> <a href=../Tasmota-IR/ title="IR Communication" class=md-nav__link> IR Communication </a> </li> <li class=md-nav__item> <a href=../WebUI/ title=WebUI class=md-nav__link> WebUI </a> </li> <li class=md-nav__item> <a href=../Compile-your-build/ title=Compiling class=md-nav__link> Compiling </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=nav-22 type=checkbox id=nav-22> <label class=md-nav__link for=nav-22> Features <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z /></svg> </span> </label> <nav class=md-nav aria-label=Features data-md-level=1> <label class=md-nav__title for=nav-22> <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </span> Features </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../Scripting-Language/ title=Scripting class=md-nav__link> Scripting </a> </li> <li class=md-nav__item> <a href=../Bluetooth/ title=Bluetooth class=md-nav__link> Bluetooth </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=nav-22-3 type=checkbox id=nav-22-3> <label class=md-nav__link for=nav-22-3> Zigbee <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z /></svg> </span> </label> <nav class=md-nav aria-label=Zigbee data-md-level=2> <label class=md-nav__title for=nav-22-3> <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </span> Zigbee </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../Zigbee/ title=Zigbee class=md-nav__link> Zigbee </a> </li> <li class=md-nav__item> <a href=../Zigbee-Internals/ title="Zigbee internals" class=md-nav__link> Zigbee internals </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../TasmotaSlave/ title=TasmotaSlave class=md-nav__link> TasmotaSlave </a> </li> <li class=md-nav__item> <a href=../DeepSleep/ title=DeepSleep class=md-nav__link> DeepSleep </a> </li> <li class=md-nav__item> <a href=../PWM-dimmer-switch/ title="PWM Dimmer" class=md-nav__link> PWM Dimmer </a> </li> <li class=md-nav__item> <a href=../Buzzer/ title=Buzzer class=md-nav__link> Buzzer </a> </li> <li class=md-nav__item> <a href=../Dynamic-Sleep/ title="Dynamic Sleep" class=md-nav__link> Dynamic Sleep </a> </li> <li class=md-nav__item> <a href=../GPS-NTP-server/ title="GPS NTP server" class=md-nav__link> GPS NTP server </a> </li> <li class=md-nav__item> <a href=../I2CDevices/ title="I2C Devices" class=md-nav__link> I2C Devices </a> </li> <li class=md-nav__item> <a href=../Smart-Meter-Interface/ title="Smart Meter Interface" class=md-nav__link> Smart Meter Interface </a> </li> <li class=md-nav__item> <a href=../PIR-Motion-Sensors/ title="PIR Motion Sensors" class=md-nav__link> PIR Motion Sensors </a> </li> <li class=md-nav__item> <a href=../Power-Monitoring-Calibration/ title="Power Monitoring Calibration" class=md-nav__link> Power Monitoring Calibration </a> </li> <li class=md-nav__item> <a href=../Subscribe-%26-Unsubscribe/ title="Subscribe & Unsubscribe" class=md-nav__link> Subscribe & Unsubscribe </a> </li> <li class=md-nav__item> <a href=../TLS/ title="SSL/TLS on Tasmota" class=md-nav__link> SSL/TLS on Tasmota </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=nav-23 type=checkbox id=nav-23> <label class=md-nav__link for=nav-23> Smart Home Integrations <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z /></svg> </span> </label> <nav class=md-nav aria-label="Smart Home Integrations" data-md-level=1> <label class=md-nav__title for=nav-23> <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </span> Smart Home Integrations </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../Alexa/ title=Alexa class=md-nav__link> Alexa </a> </li> <li class=md-nav__item> <a href=../AWS-IoT/ title="AWS IoT" class=md-nav__link> AWS IoT </a> </li> <li class=md-nav__item> <a href=../Domoticz/ title=Domoticz class=md-nav__link> Domoticz </a> </li> <li class=md-nav__item> <a href=../Home-Assistant/ title="Home Assistant" class=md-nav__link> Home Assistant </a> </li> <li class=md-nav__item> <a href=../Homebridge/ title=Homebridge class=md-nav__link> Homebridge </a> </li> <li class=md-nav__item> <a href=../HomeSeer/ title=HomeSeer class=md-nav__link> HomeSeer </a> </li> <li class=md-nav__item> <a href=../IP-Symcon/ title="IP Symcon" class=md-nav__link> IP Symcon </a> </li> <li class=md-nav__item> <a href=../KNX/ title=KNX class=md-nav__link> KNX </a> </li> <li class=md-nav__item> <a href=../NodeRed/ title=NodeRed class=md-nav__link> NodeRed </a> </li> <li class=md-nav__item> <a href=../nymea/ title=nymea class=md-nav__link> nymea </a> </li> <li class=md-nav__item> <a href=../OctoPrint.md title=None class=md-nav__link> None </a> </li> <li class=md-nav__item> <a href=../openHAB/ title=openHAB class=md-nav__link> openHAB </a> </li> <li class=md-nav__item> <a href=../otto/ title=Otto class=md-nav__link> Otto </a> </li> <li class=md-nav__item> <a href=https://github.com/arendst/Tasmota/issues/3769 title=IOBroker class=md-nav__link> IOBroker </a> </li> <li class=md-nav__item> <a href=https://github.com/tim-hellhake/tasmota-adapter title="Mozilla WebThings Adapter" class=md-nav__link> Mozilla WebThings Adapter </a> </li> <li class=md-nav__item> <a href=https://github.com/BrettSheleski/SmartThingsPublic/blob/master/devicetypes/brettsheleski/sonoff-tasmota.src/readme.md title=SmartThings class=md-nav__link> SmartThings </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=nav-24 type=checkbox id=nav-24> <label class=md-nav__link for=nav-24> Peripherals <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z /></svg> </span> </label> <nav class=md-nav aria-label=Peripherals data-md-level=1> <label class=md-nav__title for=nav-24> <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </span> Peripherals </label> <ul class=md-nav__list data-md-scrollfix> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=nav-24-1 type=checkbox id=nav-24-1> <label class=md-nav__link for=nav-24-1> Displays <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z /></svg> </span> </label> <nav class=md-nav aria-label=Displays data-md-level=2> <label class=md-nav__title for=nav-24-1> <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </span> Displays </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../Displays/ title=Displays class=md-nav__link> Displays </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../A4988-Stepper-Motor-Controller/ title="A4988 stepper motor controller" class=md-nav__link> A4988 stepper motor controller </a> </li> <li class=md-nav__item> <a href=../AM2301/ title="AM2301 temperature and humidity sensor" class=md-nav__link> AM2301 temperature and humidity sensor </a> </li> <li class=md-nav__item> <a href=../APDS-9960/ title="APDS 9960" class=md-nav__link> APDS 9960 </a> </li> <li class=md-nav__item> <a href=../AZ-7798/ title="AZ 7798" class=md-nav__link> AZ 7798 </a> </li> <li class=md-nav__item> <a href=../BH1750/ title=BH1750 class=md-nav__link> BH1750 </a> </li> <li class=md-nav__item> <a href=../BME280/ title=None class=md-nav__link> None </a> </li> <li class=md-nav__item> <a href=../BME680/ title=BME680 class=md-nav__link> BME680 </a> </li> <li class=md-nav__item> <a href=../BME280/ title="BMP280 pressure sensor" class=md-nav__link> BMP280 pressure sensor </a> </li> <li class=md-nav__item> <a href=../CC2530/ title=CC2530 class=md-nav__link> CC2530 </a> </li> <li class=md-nav__item> <a href=../Moisture-Sensor-and-Chirp%21-Sensor/ title="Chirp! moisture sensor" class=md-nav__link> Chirp! moisture sensor </a> </li> <li class=md-nav__item> <a href=../DHT11/ title=DHT11 class=md-nav__link> DHT11 </a> </li> <li class=md-nav__item> <a href=../DS18x20/ title=DS18x20 class=md-nav__link> DS18x20 </a> </li> <li class=md-nav__item> <a href=../DS3231/ title=DS3231 class=md-nav__link> DS3231 </a> </li> <li class=md-nav__item> <a href=../HM-10/ title="HM 10" class=md-nav__link> HM 10 </a> </li> <li class=md-nav__item> <a href=../HM-17/ title="HM 17" class=md-nav__link> HM 17 </a> </li> <li class=md-nav__item> <a href=../HC-SR04/ title="HC SR04" class=md-nav__link> HC SR04 </a> </li> <li class=md-nav__item> <a href=../Honeywell-HIH/ title="Honeywell HIH" class=md-nav__link> Honeywell HIH </a> </li> <li class=md-nav__item> <a href=../IR-Remote/ title="IR Remote" class=md-nav__link> IR Remote </a> </li> <li class=md-nav__item> <a href=../LM75AD/ title=LM75AD class=md-nav__link> LM75AD </a> </li> <li class=md-nav__item> <a href=../MCP230xx/ title=MCP230xx class=md-nav__link> MCP230xx </a> </li> <li class=md-nav__item> <a href=../MGC3130/ title=MGC3130 class=md-nav__link> MGC3130 </a> </li> <li class=md-nav__item> <a href=../MH-Z19B/ title="MH Z19B" class=md-nav__link> MH Z19B </a> </li> <li class=md-nav__item> <a href=../MLX90614/ title=MLX90614 class=md-nav__link> MLX90614 </a> </li> <li class=md-nav__item> <a href=../MPR121/ title="MPR121 I2C Proximity Capacitive Touch Sensor Controller" class=md-nav__link> MPR121 I<sup>2</sup>C Proximity Capacitive Touch Sensor Controller </a> </li> <li class=md-nav__item> <a href=../MPU-6050/ title="MPU 6050" class=md-nav__link> MPU 6050 </a> </li> <li class=md-nav__item> <a href=../NRF24L01/ title=NRF24L01 class=md-nav__link> NRF24L01 </a> </li> <li class=md-nav__item> <a href=../P1-Smart-Meter/ title="Kaifa MA105C Energy Meter" class=md-nav__link> Kaifa MA105C Energy Meter </a> </li> <li class=md-nav__item> <a href=../PAJ7620/ title=PAJ7620 class=md-nav__link> PAJ7620 </a> </li> <li class=md-nav__item> <a href=../PCA9685/ title=PCA9685 class=md-nav__link> PCA9685 </a> </li> <li class=md-nav__item> <a href=../PN532/ title=PN532 class=md-nav__link> PN532 </a> </li> <li class=md-nav__item> <a href=../PZEM-0XX/ title="PZEM 0XX" class=md-nav__link> PZEM 0XX </a> </li> <li class=md-nav__item> <a href=../RCWL-0516/ title="RCWL 0516" class=md-nav__link> RCWL 0516 </a> </li> <li class=md-nav__item> <a href=../RDM6300/ title=RDM6300 class=md-nav__link> RDM6300 </a> </li> <li class=md-nav__item> <a href=../SDS011/ title=SDS011 class=md-nav__link> SDS011 </a> </li> <li class=md-nav__item> <a href=../SHT30/ title=SHT30 class=md-nav__link> SHT30 </a> </li> <li class=md-nav__item> <a href=../TX2x/ title=TX2x class=md-nav__link> TX2x </a> </li> <li class=md-nav__item> <a href=../TSL2561/ title=TSL2561 class=md-nav__link> TSL2561 </a> </li> <li class=md-nav__item> <a href=../VEML6070/ title=VEML6070 class=md-nav__link> VEML6070 </a> </li> <li class=md-nav__item> <a href=../VL53L0x/ title=VL53L0x class=md-nav__link> VL53L0x </a> </li> <li class=md-nav__item> <a href=../WS2812B-RGB-Shield/ title="WS2812B RGB Shield" class=md-nav__link> WS2812B RGB Shield </a> </li> <li class=md-nav__item> <a href=../WS2812B-and-WS2813/ title="WS2812B and WS2813" class=md-nav__link> WS2812B and WS2813 </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=nav-25 type=checkbox id=nav-25> <label class=md-nav__link for=nav-25> Supported Devices <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z /></svg> </span> </label> <nav class=md-nav aria-label="Supported Devices" data-md-level=1> <label class=md-nav__title for=nav-25> <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </span> Supported Devices </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../Configuration-Procedure-for-New-Devices/ title="Configuring unknown devices" class=md-nav__link> Configuring unknown devices </a> </li> <li class=md-nav__item> <a href="https://templates.blakadder.com/ " target='_blank""' title="All Supported Devices" class=md-nav__link> All Supported Devices </a> </li> <li class=md-nav__item> <a href=../Supported-Modules/ title="Supported Modules" class=md-nav__link> Supported Modules </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=nav-26 type=checkbox id=nav-26> <label class=md-nav__link for=nav-26> Help <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z /></svg> </span> </label> <nav class=md-nav aria-label=Help data-md-level=1> <label class=md-nav__title for=nav-26> <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </span> Help </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../FAQ/ title=FAQ class=md-nav__link> FAQ </a> </li> <li class=md-nav__item> <a href=../Troubleshooting/ title=Troubleshooting class=md-nav__link> Troubleshooting </a> </li> <li class=md-nav__item> <a href=../Device-Recovery/ title="Device Recovery" class=md-nav__link> Device Recovery </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../Contributing/ title=Contributing class=md-nav__link> Contributing </a> </li> <li class=md-nav__item> <a href="//discord.gg/Ks2Kzd4 " target='_blank""' title="Discord Community" class=md-nav__link> Discord Community </a> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component=toc> <div class=md-sidebar__scrollwrap> <div class=md-sidebar__inner> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <label class=md-nav__title for=__toc> <span class="md-nav__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </span> Table of contents </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=#configure-mqtt class=md-nav__link> Configure MQTT </a> <nav class=md-nav aria-label="Configure MQTT"> <ul class=md-nav__list> <li class=md-nav__item> <a href=#configure-mqtt-using-webui class=md-nav__link> Configure MQTT using WebUI </a> </li> <li class=md-nav__item> <a href=#configure-mqtt-using-backlog class=md-nav__link> Configure MQTT using Backlog </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=#commands-over-mqtt class=md-nav__link> Commands over MQTT </a> <nav class=md-nav aria-label="Commands over MQTT"> <ul class=md-nav__list> <li class=md-nav__item> <a href=#command-flow class=md-nav__link> Command flow </a> </li> <li class=md-nav__item> <a href=#examples class=md-nav__link> Examples </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=#mqtt-topic-definition class=md-nav__link> MQTT Topic Definition </a> <nav class=md-nav aria-label="MQTT Topic Definition"> <ul class=md-nav__list> <li class=md-nav__item> <a href=#fulltopic class=md-nav__link> FullTopic </a> </li> <li class=md-nav__item> <a href=#topic class=md-nav__link> %topic% </a> </li> <li class=md-nav__item> <a href=#grouptopic class=md-nav__link> GroupTopic </a> </li> <li class=md-nav__item> <a href=#fallback-topic class=md-nav__link> FallBack Topic </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=#retained-mqtt-messages class=md-nav__link> Retained MQTT Messages </a> <nav class=md-nav aria-label="Retained MQTT Messages"> <ul class=md-nav__list> <li class=md-nav__item> <a href=#clearing-retained-messages class=md-nav__link> Clearing Retained Messages </a> </li> </ul> </nav> </li> </ul> </nav> </div> </div> </div> <div class=md-content> <article class="md-content__inner md-typeset"> <a href=https://github.com/tasmota/docs/blob/master/docs/MQTT.md title="Edit this page" class="md-content__button md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"/></svg> </a> <h1>MQTT</h1> <div class="admonition info"> <p class=admonition-title>MQTT is the main protocol for controlling Tasmota devices</p> </div> <p>If you have no knowledge of what MQTT is, you can learn about it from <a href=http://www.hivemq.com/mqtt-essentials/ >MQTT Essentials</a> articles. After you have a working <a href="https://www.google.com/search?q=setting+up+an+mqtt+broker">MQTT broker</a> you need to configure Tasmota to communicate with it. </p> <h2 id=configure-mqtt>Configure MQTT<a class=headerlink href=#configure-mqtt title="Permanent link">~</a></h2> <p>If you flashed a precompiled .bin or didn't enter MQTT info in <code>user_config_override.h</code> before compiling you have to configure it on your device first.</p> <h3 id=configure-mqtt-using-webui>Configure MQTT using WebUI<a class=headerlink href=#configure-mqtt-using-webui title="Permanent link">~</a></h3> <p>Go to <strong>Configuration -> Configure Other</strong> and make sure <strong>"MQTT Enable"</strong> box is checked.<br> Once MQTT is enabled you need to set it up using <strong>Configuration -> Configure MQTT</strong>. </p> <div class="admonition tip"> <p class=admonition-title>Tip</p> <p>While here, you might as well change the Friendly Name into something more descriptive than generic "Tasmota".<br><em>This is a must for Home Assistant autodiscovery feature.</em></p> </div> <p><img alt="Enable MQTT" src=https://i.postimg.cc/6QDQnH2X/mqtt-config1.png> <img alt="Configure MQTT " src=https://i.postimg.cc/y8LggXy1/mqtt-config2.png></p> <p>For a basic setup you only need to set <strong>Host</strong>, <strong>User</strong> and <strong>Password</strong> but it is recommended to change <strong>Topic</strong> to avoid issues. Each device should have a unique <strong>Topic</strong>.</p> <ul> <li><strong>Host</strong> = your MQTT broker address or IP (<strong>mDNS is not available in the official Tasmota builds</strong>, means no <code>.local</code> domain!) </li> <li><strong>Port</strong> = your MQTT broker port (default port is set to 1883)</li> <li><strong>Client</strong> = device's unique identifier. In 99% of cases it's okay to leave it as is, however some Cloud-based MQTT brokers require a ClientID connected to your account.</li> <li><strong>User</strong> = username for authenticating on your MQTT broker</li> <li><strong>Password</strong> = password for authenticating on your MQTT broker</li> <li><strong>Topic</strong> = unique identifying topic for your device (e.g. <code>hallswitch</code>, <code>kitchen-light</code>). <code>%topic%</code> in wiki references to this. <strong>It is recommended to use a single word for the topic.</strong></li> <li><strong>FullTopic</strong> = <a href=#mqtt-topic-definition>full topic definition</a>. Modify it if you want to use multi-level topics for your devices, for example <code>lights/%prefix%/%topic%/</code> or <code>%prefix%/top_floor/bathroom/%topic%/</code> etc.</li> </ul> <h3 id=configure-mqtt-using-backlog>Configure MQTT using Backlog<a class=headerlink href=#configure-mqtt-using-backlog title="Permanent link">~</a></h3> <p>Using a serial connection or the WebUI Console you can issue (or even better, paste a premade) Backlog command for quick and easy MQTT setup.</p> <div class=codehilite><pre><span></span><code><span class=kt>Backlog</span> <span class=n>mqtthost</span> <span class=o><</span><span class=n>mqtt_broker_address</span><span class=o>></span><span class=p>;</span> <span class=n>mqttport</span> <span class=o><</span><span class=n>mqtt_broker_port</span><span class=o>></span><span class=p>;</span> <span class=n>mqttuser</span> <span class=o><</span><span class=n>username</span><span class=o>></span><span class=p>;</span> <span class=n>mqttpassword</span> <span class=o><</span><span class=n>password</span><span class=o>></span><span class=p>;</span> <span class=n>topic</span> <span class=o><</span><span class=n>device_topic</span><span class=o>></span>
</code></pre></div> <p>After a reboot all necessary MQTT settings are configured. Don't forget, you can use Backlog for all commands!</p> <h2 id=commands-over-mqtt>Commands over MQTT<a class=headerlink href=#commands-over-mqtt title="Permanent link">~</a></h2> <p>To send commands and view responses you'll need an <a href=http://www.hivemq.com/blog/seven-best-mqtt-client-tools>MQTT client</a>.</p> <p>Commands over MQTT are issued to Tasmota by using <code>cmnd/%topic%/<command> <parameter></code>. If there is no <code><parameter></code> (an empty MQTT message/payload), a query is sent for current status of the <code><command></code>.</p> <div class="admonition tip"> <p class=admonition-title>Tip</p> <p>If you are using <em>mosquitto_pub</em>, you can issue an empty payload using the <code>-n</code> command line option. </p> </div> <blockquote> <p>If your MQTT client cannot issue an empty payload, you can use the single character <code>?</code> instead.</p> </blockquote> <h3 id=command-flow>Command flow<a class=headerlink href=#command-flow title="Permanent link">~</a></h3> <p>The following example will go in depth on what happens when you send an MQTT command.</p> <p>A device was flashed and configured with the <strong>FullTopic</strong> as default <code>%prefix%/%topic%/</code> and the <strong>Topic</strong> set to <code>tasmota_switch</code>. We want to see the current status of the switch and change it.</p> <p>By looking at the commands table we can learn about the <a href=../Commands/#power><code>POWER</code></a> command and options associated with it. </p> <p><strong>Ask the device for status</strong> <code>js cmnd/tasmota_switch/Power ← // an empty message/payload sends a status query ↳ stat/tasmota_switch/RESULT → {"POWER":"OFF"} ↳ stat/tasmota_switch/POWER → OFF</code> We can see that the switch (device's relay) is turned off.</p> <p><strong>Send a command to toggle the relay</strong> <code>js cmnd/tasmota_switch/Power ← "TOGGLE" ↳ // Power for relay 1 is toggled ↳ stat/tasmota_switch/RESULT → {"POWER":"ON"} ↳ stat/tasmota_switch/POWER → ON</code> We've sent the toggle command and received confirmation that the switch is turned on.</p> <div class="admonition tip"> <p class=admonition-title>Tip</p> <p>By default, Tasmota replies to all commands through <code>.../RESULT</code>.</p> </div> <blockquote> <p>This behavior can be changed using <a href=../Commands/#SetOption4>SetOption4</a>, which makes the commands reply on the endpoint matching the command name, ex. <code>cmnd/tasmota/PowerOnState</code> will send a response on <code>cmnd/tasmota/POWERONSTATE</code>.</p> </blockquote> <h3 id=examples>Examples<a class=headerlink href=#examples title="Permanent link">~</a></h3> <p>In the following examples <code>%topic%</code> is <code>tasmota</code>, FullTopic is <code>%prefix%/%topic%/</code>, and prefixes are default <code>cmnd/stat/tele</code>:</p> <ul> <li> <p>The relay can be controlled with <code>cmnd/tasmota/POWER on</code>, <code>cmnd/tasmota/POWER off</code> or <code>cmnd/tasmota/POWER toggle</code>. Tasmota will send a MQTT status message like <code>stat/tasmota/POWER ON</code>.</p> </li> <li> <p>The power state message can be sent with the retain flag set. Enable this with <code>cmnd/tasmota/PowerRetain on</code>.</p> </li> <li> <p>The telemetry messages can also be sent with the retain flag, but this is a compile option. See <a href=https://github.com/arendst/Tasmota/issues/1071>#1071</a>.</p> </li> <li> <p>For Sonoff Dual or Sonoff 4CH the relays need to be addressed with <code>cmnd/tasmota/POWER<x></code>, where {x} is the relay number from 1 to 2 (Sonoff Dual) or from 1 to 4 (Sonoff 4CH). <code>cmnd/tasmota/POWER4 off</code> turns off the 4th relay on a Sonoff 4CH.</p> </li> <li> <p>MQTT topic can be changed with <code>cmnd/tasmota/Topic tasmota1</code> which reboots Tasmota and changes the <code>%topic%</code> to <code>tasmota1</code>. From that point on MQTT commands should look like <code>cmnd/tasmota1/POWER on</code>.</p> </li> <li> <p>The OTA firmware location can be made known to tasmota with <code>cmnd/tasmota/OtaUrl http://thehackbox.org/tasmota/release/tasmota.bin</code>. Reset to default with <code>cmnd/tasmota/OtaUrl 1</code>.</p> </li> <li> <p>Upgrade OTA firmware from the OtaUrl server with <code>cmnd/tasmota/Upgrade 1</code>.</p> </li> <li> <p>Show all status information with <code>cmnd/tasmota/Status 0</code>.</p> </li> <li> <p>The button can send a MQTT message to the broker that in turn will switch the relay. To configure this you need to perform <code>cmnd/tasmota/ButtonTopic tasmota</code> where tasmota equals to Topic. The message can also be provided with the retain flag by <code>cmnd/tasmota/ButtonRetain on</code>.</p> </li> <li> <p>Sonoff Pow (and any device with sensors) status can be requested manually with <code>cmnd/tasmota/status 8</code>. Additionally, Tasmota periodically sends telemetry every <a href=../Commands/#Teleperiod>TelePeriod</a>, which defaults to 300 seconds (5 minutes).</p> </li> <li> <p>When a Sonoff Pow (and any device with power metering sensors) threshold like PowerLow has been met a message <code>tele/tasmota/POWER_LOW ON</code> will be sent. When the error is corrected a message <code>tele/tasmota/POWER_LOW OFF</code> will be sent.</p> </li> </ul> <p>While most MQTT commands will result in a message in JSON format the power status feedback will always be returned like <code>stat/tasmota/POWER ON</code> as well.</p> <p>Telemetry data will be sent by prefix <code>tele</code> like <code>tele/tasmota/SENSOR {"Time":"2017-02-16T10:13:52", "DS18B20":{"Temperature":20.6}}</code></p> <h2 id=mqtt-topic-definition>MQTT Topic Definition<a class=headerlink href=#mqtt-topic-definition title="Permanent link">~</a></h2> <h3 id=fulltopic>FullTopic<a class=headerlink href=#fulltopic title="Permanent link">~</a></h3> <p>This is the MQTT topic used to communicate with Tasmota over MQTT. It is created using tokens placed within a user definable string (100 character limit). The tokens are substituted dynamically at run-time. Available substitution tokens are: - <code>%prefix%</code> = one of three prefixes as defined by commands <code>Prefix1</code> <em>(default = <code>cmnd</code>)</em>, <code>Prefix2</code> <em>(default = <code>stat</code>)</em> and <code>Prefix3</code> <em>(default = <code>tele</code>)</em>. - <code>%topic%</code> = one of five topics as defined by commands <a href=../Commands/#topic><code>Topic</code></a>, <a href=../Commands/#grouptopic><code>GroupTopic</code></a>, <a href=../Commands/#buttontopic><code>ButtonTopic</code></a>, <a href=../Commands/#switchtopic><code>SwitchTopic</code></a> and <a href=../Commands/#mqttclient><code>MqttClient</code></a>. - <code>%hostname%</code> = the hostname of the device as defined through the web UI <em>(default = <code>%s-%04d</code>)</em> or via <a href=../Commands/#hostname><code>Hostname</code></a> command. - <code>%id%</code> = MAC address of the device.</p> <div class="admonition tip"> <p class=admonition-title>Tip</p> <p>These substitution tokens will be used in examples across the documentation</p> </div> <p>If <code>FullTopic</code> does not contain the <code>%topic%</code> token, the device will not subscribe to <code>GroupTopic</code> and <code>FallbackTopic</code>.</p> <div class="admonition tip"> <p class=admonition-title>Tip</p> <p>The order of <em>%prefix%</em> and <em>%topic%</em> doesn't matter, unless you have enabled Auto-discovery for Home Assistant (<a href=../Commands/#setoption19><code>SetOption19</code></a>). Enabling this option re-formats the FullTopic to required order.</p> </div> <p>Using the tokens the following example topics can be made: - <code>FullTopic %prefix%/%topic%/</code> <em>default</em> - <code>FullTopic tasmota/%topic%/%prefix%/</code> - <code>FullTopic tasmota/bedroom/%topic%/%prefix%/</code> - <code>FullTopic penthouse/bedroom1/bathroom2/%topic%/%prefix%/</code> - <code>FullTopic %prefix%/home/cellar/%topic%/</code></p> <h4>%prefix%</h4> <p>Tasmota uses 3 prefixes for forming a FullTopic:</p> <ul> <li><code>cmnd</code> - prefix to issue commands; ask for status</li> <li><code>stat</code> - reports back status or configuration message</li> <li><code>tele</code> - reports telemetry info at specified intervals</li> </ul> <div class="admonition tip"> <p class=admonition-title>Tip</p> </div> <blockquote> <p>To solve possible MQTT topic loops it is strongly suggested that you use the <code>%prefix%</code> token in all of your FullTopics. Status and telemetry do not need a prefix.</p> </blockquote> <h3 id=topic>%topic%<a class=headerlink href=#topic title="Permanent link">~</a></h3> <p>All MQTT status messages will be sent using the configurable <code>%topic%</code> which must be made unique by the user. It can be called <code>bedroom</code> but it could also be called <code>XP-TS_10</code> as long as the user knows what it is and where to find it.</p> <p>?> Default Topic is <code>tasmota_XXXX</code> where <code>XXXX</code> is unique and derives from the MAC address</p> <p>The use of the <code>%topic%</code> token is mandatory in case you want to use <a href=../Commands/#buttontopic><code>ButtonTopic</code></a> and/or <a href=../Commands/#switchtopic><code>SwitchTopic</code></a>. It also provides for GroupTopic and Fallback Topic functionality.</p> <div class="admonition tip"> <p class=admonition-title>Tip</p> <p>Use <code>%prefix%</code> and <code>%topic%</code> tokens at all time within your FullTopic definition!</p> </div> <h3 id=grouptopic>GroupTopic<a class=headerlink href=#grouptopic title="Permanent link">~</a></h3> <p>Having two devices with the same topic allowed for MQTT commands to be sent once to make the devices act in conjunction. That inspired a third topic called GroupTopic. Devices with the same GroupTopic will all listen to that GroupTopic and react to the same MQTT command sent to it. You can use this to take global actions like updating firmware on all devices or split up devices into different groups using a unique GroupTopic for each group.</p> <p>?> Default GroupTopic is <code>tasmotas</code></p> <h3 id=fallback-topic>FallBack Topic<a class=headerlink href=#fallback-topic title="Permanent link">~</a></h3> <p>Initially Tasmota had one MQTT configurable topic planned called Topic. It soon became apparent that when two devices come online with the same topic this would be a challenge, to say the least!</p> <p>Tasmota then introduced a unique, non-configurable "FallBack Topic" that allows MQTT communication regardless of the configurable topic. This fallback topic is just what it is meant to be: <strong>a fallback topic</strong> in case of emergency!</p> <p>By default the Fallback Topic is <code>DVES_XXXXXX_fb</code> where xxxxxx is derived from the last 6 charactes of the device's MAC address (excluding <code>:</code>). It might look something like this: <code>DVES_3D5E26_fb</code>. You can find out the DVES code by looking at <strong>Information</strong> page in the webUI or issuing <code>Status 6</code>:</p> <div class=codehilite><pre><span></span><code><span class=mi>12</span><span class=err>:</span><span class=mi>36</span><span class=err>:</span><span class=mi>17</span> <span class=err>MQT:</span> <span class=err>stat/tasmota/STATUS</span><span class=mi>6</span> <span class=err>=</span> <span class=p>{</span><span class=nt>"StatusMQT"</span><span class=p>:{</span><span class=nt>"MqttHost"</span><span class=p>:</span><span class=s2>"1.1.1.1"</span><span class=p>,</span><span class=nt>"MqttPort"</span><span class=p>:</span><span class=mi>1883</span><span class=p>,</span><span class=nt>"MqttClientMask"</span><span class=p>:</span><span class=s2>"DVES_%06X"</span><span class=p>,</span><span class=nt>"MqttClient"</span><span class=p>:</span><span class=s2>"DVES_3D5E26"</span><span class=p>,</span><span class=nt>"MqttUser"</span><span class=p>:</span><span class=s2>"tasmota"</span><span class=p>,</span><span class=nt>"MqttCount"</span><span class=p>:</span><span class=mi>1</span><span class=p>,</span><span class=nt>"MAX_PACKET_SIZE"</span><span class=p>:</span><span class=mi>1000</span><span class=p>,</span><span class=nt>"KEEPALIVE"</span><span class=p>:</span><span class=mi>30</span><span class=p>}}</span>
</code></pre></div> <h2 id=retained-mqtt-messages>Retained MQTT Messages<a class=headerlink href=#retained-mqtt-messages title="Permanent link">~</a></h2> <p>If MQTT is defined and <a href=../Commands/#powerretain><code>PowerRetain</code></a> is used the last state will be stored permanently in MQTT database.</p> <table> <thead> <tr> <th>Command</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a href=../Commands/#powerretain><code>PowerRetain</code></a></td> <td>Show current MQTT power retain state.<br> <code>0</code> / <code>off</code> = disable MQTT power retain on status update <em>(default)</em> <br> <code>1</code> / <code>on</code> = enable MQTT power retain on status update</td> </tr> </tbody> </table> <p><strong>BUT</strong>, a message in your MQTT broker flagged as 'retained' will <strong><em>always</em> override the <code>PowerOnState</code></strong>. </p> <p>This is usually the main cause for "ghost switching". Learn more in <a href=http://www.steves-internet-guide.com/mqtt-retained-messages-example/ >MQTT retained messages explained</a>. Check out <a href="https://www.youtube.com/watch?v=31IyfM1gygo">this tutorial</a> for troubleshooting switch ghosting.</p> <h3 id=clearing-retained-messages>Clearing Retained Messages<a class=headerlink href=#clearing-retained-messages title="Permanent link">~</a></h3> <p>To check, if there is a retain flag set for the switch's power topic, monitor <code>cmnd/+/power</code> in a MQTT client (recommended <a href=https://mqttfx.jensd.de/ >MQTT.fx</a> for Windows or <a href=https://mosquitto.org/ >Eclipse Mosquitto</a> in linux).</p> <p>You can use <a href=https://github.com/jziolkowski/tdm>Tasmota Device Manager</a> to clear all retained messages for selected device with a single click.</p> <p>![Tasmota Device Manager]_media/tdm-retained.png)</p> <p>or use the following tutorials/forum threads:</p> <ul> <li><a href=https://community.openhab.org/t/clearing-mqtt-retained-messages/58221>Clearing retained messages with mosquitto</a></li> <li><a href=https://community.home-assistant.io/t/mqtt-how-to-remove-retained-messages/79029>Remove retained messages in Home Assistant</a></li> <li><a href=https://community.home-assistant.io/t/clear-hass-io-mosquitto-broker-add-on-retain-messages/57250/3>Remove retained messages in hass.io MQTT addon</a></li> </ul> </article> </div> </div> </main> <footer class=md-footer> <div class=md-footer-nav> <nav class="md-footer-nav__inner md-grid" aria-label=Footer> <a href=../Upgrading/ title=Upgrading class="md-footer-nav__link md-footer-nav__link--prev" rel=prev> <div class="md-footer-nav__button md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z /></svg> </div> <div class=md-footer-nav__title> <div class=md-ellipsis> <span class=md-footer-nav__direction> Previous </span> Upgrading </div> </div> </a> <a href=../Commands/ title=Commands class="md-footer-nav__link md-footer-nav__link--next" rel=next> <div class=md-footer-nav__title> <div class=md-ellipsis> <span class=md-footer-nav__direction> Next </span> Commands </div> </div> <div class="md-footer-nav__button md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d=M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z /></svg> </div> </a> </nav> </div> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class=md-footer-copyright> made with <a href=https://squidfunk.github.io/mkdocs-material/ target=_blank rel=noopener> Material for MkDocs </a> </div> <div class=md-footer-social> <a href=https://discord.gg/Ks2Kzd4 target=_blank rel=noopener title=discord.gg class=md-footer-social__link> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 448 512"><path d="M297.216 243.2c0 15.616-11.52 28.416-26.112 28.416-14.336 0-26.112-12.8-26.112-28.416s11.52-28.416 26.112-28.416c14.592 0 26.112 12.8 26.112 28.416zm-119.552-28.416c-14.592 0-26.112 12.8-26.112 28.416s11.776 28.416 26.112 28.416c14.592 0 26.112-12.8 26.112-28.416.256-15.616-11.52-28.416-26.112-28.416zM448 52.736V512c-64.494-56.994-43.868-38.128-118.784-107.776l13.568 47.36H52.48C23.552 451.584 0 428.032 0 398.848V52.736C0 23.552 23.552 0 52.48 0h343.04C424.448 0 448 23.552 448 52.736zm-72.96 242.688c0-82.432-36.864-149.248-36.864-149.248-36.864-27.648-71.936-26.88-71.936-26.88l-3.584 4.096c43.52 13.312 63.744 32.512 63.744 32.512-60.811-33.329-132.244-33.335-191.232-7.424-9.472 4.352-15.104 7.424-15.104 7.424s21.248-20.224 67.328-33.536l-2.56-3.072s-35.072-.768-71.936 26.88c0 0-36.864 66.816-36.864 149.248 0 0 21.504 37.12 78.08 38.912 0 0 9.472-11.52 17.152-21.248-32.512-9.728-44.8-30.208-44.8-30.208 3.766 2.636 9.976 6.053 10.496 6.4 43.21 24.198 104.588 32.126 159.744 8.96 8.96-3.328 18.944-8.192 29.44-15.104 0 0-12.8 20.992-46.336 30.464 7.68 9.728 16.896 20.736 16.896 20.736 56.576-1.792 78.336-38.912 78.336-38.912z"/></svg> </a> <a href=https://t.me/tasmota target=_blank rel=noopener title=t.me class=md-footer-social__link> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm121.8 169.9l-40.7 191.8c-3 13.6-11.1 16.9-22.4 10.5l-62-45.7-29.9 28.8c-3.3 3.3-6.1 6.1-12.5 6.1l4.4-63.1 114.9-103.8c5-4.4-1.1-6.9-7.7-2.5l-142 89.4-61.2-19.1c-13.3-4.2-13.6-13.3 2.8-19.7l239.1-92.2c11.1-4 20.8 2.7 17.2 19.5z"/></svg> </a> <a href=https://github.com/tasmota target=_blank rel=noopener title=github.com class=md-footer-social__link> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 480 512"><path d="M186.1 328.7c0 20.9-10.9 55.1-36.7 55.1s-36.7-34.2-36.7-55.1 10.9-55.1 36.7-55.1 36.7 34.2 36.7 55.1zM480 278.2c0 31.9-3.2 65.7-17.5 95-37.9 76.6-142.1 74.8-216.7 74.8-75.8 0-186.2 2.7-225.6-74.8-14.6-29-20.2-63.1-20.2-95 0-41.9 13.9-81.5 41.5-113.6-5.2-15.8-7.7-32.4-7.7-48.8 0-21.5 4.9-32.3 14.6-51.8 45.3 0 74.3 9 108.8 36 29-6.9 58.8-10 88.7-10 27 0 54.2 2.9 80.4 9.2 34-26.7 63-35.2 107.8-35.2 9.8 19.5 14.6 30.3 14.6 51.8 0 16.4-2.6 32.7-7.7 48.2 27.5 32.4 39 72.3 39 114.2zm-64.3 50.5c0-43.9-26.7-82.6-73.5-82.6-18.9 0-37 3.4-56 6-14.9 2.3-29.8 3.2-45.1 3.2-15.2 0-30.1-.9-45.1-3.2-18.7-2.6-37-6-56-6-46.8 0-73.5 38.7-73.5 82.6 0 87.8 80.4 101.3 150.4 101.3h48.2c70.3 0 150.6-13.4 150.6-101.3zm-82.6-55.1c-25.8 0-36.7 34.2-36.7 55.1s10.9 55.1 36.7 55.1 36.7-34.2 36.7-55.1-10.9-55.1-36.7-55.1z"/></svg> </a> </div> </div> </div> </footer> </div> <script src=../assets/javascripts/vendor.23350dc5.min.js></script> <script src=../assets/javascripts/bundle.36a8f969.min.js></script><script id=__lang type=application/json>{"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents"}</script> <script>
app = initialize({
base: "..",
features: ["tabs"],
search: Object.assign({
worker: "../assets/javascripts/worker/search.3bc815f0.min.js"
}, typeof search !== "undefined" && search)
})
</script> </body> </html>