MQTT Retained Messages - The Love Hate Relationship - Tasmota Tips Episode 1

  Рет қаралды 26,318

digiblur DIY

digiblur DIY

Күн бұрын

Пікірлер: 102
@mikealport2065
@mikealport2065 Ай бұрын
This is an old one - but still very relevant and very clearly explained - thanks very much. I've bookmarked it.
@iot_enthusiast
@iot_enthusiast 5 жыл бұрын
Retain is a subtle, mostly misunderstood mqtt concept, until I saw this explanation. As I look forward to more tips and tricks, this one , is brilliantly done.
@jimbrewer5821
@jimbrewer5821 5 жыл бұрын
Travis, thanks! How timely! This has been driving me CRAZY! (as well as worried that a reboot or reconnect would inadvertently open my garage doors while I was away from home). Great video (as usual). I think I am finally beginning to understand MQTT with helpful well-explained videos like this. When people (and I also include myself) first start off in Home Assistant, it's easy to overlook developing a fundamental understanding of MQTT and go right to "making stuff work". This ultimately comes back to bite you 6 months down the road when you're trying to figure out why certain devices behave differently than others. I'm looking forward to more of your Tasmota Tips videos. Thanks again - well done!
@dannewcomb8810
@dannewcomb8810 5 жыл бұрын
The timeliness of this video is uncanny. I was just experiencing this issue on that exact same model power strip. I had flipped some flags, but hadn't figured the rest out yet. Thanks for the great videos, and keep it up.
@dadrad
@dadrad 5 жыл бұрын
This is a great explanation of MQTT retain. I found that I had it enabled on three of my Sonoffs, but only really needed it on one of them. Thanks Travis!
@1binlids
@1binlids 5 жыл бұрын
What a fantastic explanation of retained messages Travis, easiest way to check & clear out I have seen, keep up the great videos.
@snowchaser75
@snowchaser75 5 жыл бұрын
Thanks mate. I knew I had a retain issue, thanks to The Hookup video, but his method to clear it didn't work. This way worked perfectly.
@paulmurphy3735
@paulmurphy3735 3 жыл бұрын
Just love both of your mqtt videos. So clear and packed with really helpful tips and advice. Just keep learning watching your tutorials. Many thanks again 🙏
@digiblurDIY
@digiblurDIY 3 жыл бұрын
Glad you like them!
@stang70man
@stang70man 5 жыл бұрын
Thank you so much for the great video! I watched this the day it came out. Last night at 12:38am, our bedroom lights came on. Sure enough, retain was set and it lost wifi for a moment and came on. You saved me!
@digiblurDIY
@digiblurDIY 5 жыл бұрын
Thanks for the feedback and real life scenario! Makes this hobby enjoying and time to teach this all worth it!
@cleberam
@cleberam 5 жыл бұрын
Really good and informative, excellent job, thanks! Those 20 minutes save hours of troubleshooting and frustration.
@digiblurDIY
@digiblurDIY 5 жыл бұрын
Thanks! I had plans for a 10 minute or less video but then I wanted to show the problem, the why, the fix and then the show it solved so it got kinda long.
@AnoNymous-lp5tb
@AnoNymous-lp5tb 5 жыл бұрын
Holy shit! You always gave us enlightenment! I should call you budha for tasmota! I had inching switch flash with tasmota and i used it as a garage opener but I found my garage wide open one day so i disconnected it and never put it back again. You might solved my problem. Will mess with it later this afternoon and will see if that's the problem.
@bulldog3494
@bulldog3494 5 жыл бұрын
Thanks Travis, you answered a couple of problems I was dealing with. I think you should change your name to Dr. Tasmota!
@shaunwhiteley3544
@shaunwhiteley3544 5 жыл бұрын
Excellent, just excellent! Thank you so much for this! Cheers
@ufootje
@ufootje 3 жыл бұрын
very good. this was a real eye opener for me!
@laurentmathivet1214
@laurentmathivet1214 3 жыл бұрын
Really nice video ! You're a naturally born teacher :D ! Merry Christmas to all
@digiblurDIY
@digiblurDIY 3 жыл бұрын
Thank you! 😃
@squalazzo
@squalazzo 5 жыл бұрын
excellent, very clear, thanks Travis! :)
@Rickr522
@Rickr522 5 жыл бұрын
Super helpful and another video well done. Thanks!
@imike964
@imike964 4 жыл бұрын
Dude, you are awesome!
@kevincostner8536
@kevincostner8536 5 жыл бұрын
Nice video, man! Thanks!
@lmamakos
@lmamakos 5 жыл бұрын
One reason why you'd want to have Home Assistant send MQTT messages with the RETAIN option is to arrange to have the device you're controlling restore its state when it reboots. Say you have a power switch or a light bulb that doesn't have any local storage that remembers if it's "ON" or "OFF". And then power in your house glitches and the device reboots. Would you like it to come back up with the same state as before (e.g., the light is turned back on?) That's when you'd like the last command that was sent to the device have the RETAIN option set. Then the broker will keep the last retained message to the topic stored and when a device connects and subscribes to the topic, it will get that retained message sent it. And that will restore it to the last commanded state. It really has little to do with an interruption in network connectivity; I'm not sure what exactly that was trying to provoke.
@JimDumser
@JimDumser 5 жыл бұрын
If the retained message was TOGGLE, it still wouldn't work as desired. Only if you could ensure that ON or OFF were retained would it work as desired.
@lmamakos
@lmamakos 5 жыл бұрын
@@JimDumser There is no TOGGLE message to the MQTT command topic for a light or switch. TOGGLE is a local concept that inverts the current state and commands the device to the inverse. If you look at, for example, www.home-assistant.io/components/switch.mqtt/ you'll see that you can specify the payload for "ON" and "OFF" and there is no notion of a toggle operation at this level.
@aliaghil1
@aliaghil1 5 жыл бұрын
well done, thanks for your good video.
@ilducedimas
@ilducedimas 4 жыл бұрын
You rock ! Thanks so much
@jc-zh9kl
@jc-zh9kl 3 жыл бұрын
awesome thanks youre the man, worked perfect! Rob needs to put a link to this video in his video so people are bashing their heads trying to figure out why it aint workin haha
@digiblurDIY
@digiblurDIY 3 жыл бұрын
I had to show the why and the how on this one to show the issue as that is my way of things. The various guides out there that do nothing except randomly copy and paste some commands is quite laughable as the creator of said guide doesn't even understand it him/herself so how can they teach it? Hmmm...
@madrian_hello
@madrian_hello 5 жыл бұрын
Very nice guide. 👍
@crazywux
@crazywux 5 жыл бұрын
very helpful, you mention esphome. For those that wish to dodge MQTT can you follow up video how retains work with esphomes native API.
@digiblurDIY
@digiblurDIY 5 жыл бұрын
I use MQTT with Esphome myself as I skip going through home assistant to control my devices. I don't think there are any retain issues with the way the API is designed. That does raise a question now though if I flashed a switch with Esphome does it have its own powerretain option and not have the retain command message issues.
@nigelholland24
@nigelholland24 5 жыл бұрын
Another great video thanks
@reiserx
@reiserx Жыл бұрын
I have a similar issue of an esp32 hooked to my old alarm box to use as a door and window sensor switch. It doesn't use the power cmnd because it's used for 11 switches. I have rules to make it output as a switch. i.e. "Rule1 on Switch1#State do Publish2 stat/door_sensor/1 %value% endon on Switch2#State do Publish2 stat/door_sensor/2 %value% endon" etc. Any idea on the difference in the yaml automation to make that work. I tried switch1 ;switch2 ; instead of power1; power2 ; . didn't work. Upon restart they are always unknown until opened or closed.
@nvdwalt
@nvdwalt 3 жыл бұрын
I love this one awesome bud
@digiblurDIY
@digiblurDIY 3 жыл бұрын
Glad you like it
@waynenocton
@waynenocton 3 жыл бұрын
Oh man this is a good one!
@waynenocton
@waynenocton 3 жыл бұрын
My switches are now correct, all the time as far as I can tell, love it! You're the best!
5 жыл бұрын
You're a life saver!
@stephennutt2565
@stephennutt2565 4 жыл бұрын
I swear I saw a video of you flashing this Teckin power strip but I cannot find it. Am I crazy? I even remember a discussion that the Ground Tx Rx and Power are mis-labeled on some.
@digiblurDIY
@digiblurDIY 4 жыл бұрын
Hmm... maybe a live stream or something? I don't recall the RX/TX being backwards though, thought was a sonoff thing on some of their devices.
@tota5
@tota5 5 жыл бұрын
hey, great video! Ive been having some serious problems with my espurna lights with mqtt! From time to time, when a reboot happens, when it gets back up, those lights just stop being responsive to the mqtt commands. I opened the mqtt explorer to see whats going on, and hooked up into the espurna debug to see what might be happening, and as it seems, its like the lights didnt get connected again after the broker rebooted. That does not happen with my tasmotized sonoffs, ever...they are always responsive. Do you have an idea on how to start tackling this? This problem is making the smartlights unusable as a true alternative to regular lights, as my wife is not happy at all about having the lights completelly stop working once a week... Thank you!
@gmaclean1
@gmaclean1 3 жыл бұрын
With more recent versions (9.4 currently) is there any benefit to retain now? It looks like my states are kept through reboot by default now :)
@digiblurDIY
@digiblurDIY 3 жыл бұрын
Depends on how you are doing integrations and such. MQTT retains will always be a thing even if automatically done for you.
@rabidbunny3025
@rabidbunny3025 2 жыл бұрын
Very informative, I have an issue with some of the newer Tasmota Builds though. On the later versions (12+) it seems that the Sonoff 4ch Pro R3 - always powers ON Channel 4 Relay, but when looking at HA, it shows the Channel 4 Relay is OFF, this is also true when being connected to the device through the Tasmota WebUI, but on the actual device it shows that Channel 4 is powered ON, and testing the relay it is actually ON. I have checked logs and there are no retain messages, how will I go about to raise this issue with the guys over at Tasmota? (previous firmware versions did not do this) ... thanks for you help! PS: you can easily simulate the scenario, just power the 4CH Pro R3 wait for a successful network connection, then disconnect the power and return power after a minute or two and you will also note the same on the newer Tasmota firmware versions. Side-note: SO0 = OFF (so even on software level / firmware level the state should not be "remembered")
@digiblurDIY
@digiblurDIY 2 жыл бұрын
I would try their github issues or discussions section if you want to raise something over there. I don't have the Pro model to try this out myself. I assume you are using the HA Tasmota integration?
@rabidbunny3025
@rabidbunny3025 2 жыл бұрын
@@digiblurDIY ... yes, using Tasmota HA integration. I'll try raise an issue there. Oddly it used to work on previous firmware versions ... :) And It's an issue on 5 x of those units always Channel 4 Relay being turned ON after a power failure restore. I can't replicate the issue with stock Sonoff firmware though.
@rubenhackar
@rubenhackar 4 жыл бұрын
hiiii, how can i put the correct percentage of my covers when the wifi goes down and back again? HA keeps the old percentage.
@mikebusch9307
@mikebusch9307 4 жыл бұрын
Brilliant ;0))) best explanation heard until now ;0))) and it works ;0))))
@rvfortwo5565
@rvfortwo5565 5 жыл бұрын
Hey, Travis. Thanks for the helpful video. Can you share the Tasmota template for the strip you are using? I have the same strip, but the button only turns on outlet 1 and I can't figure out how to configure the module for the USB off/on. Thanks.
@digiblurDIY
@digiblurDIY 5 жыл бұрын
That can get to be more of something with rules. What do you want to turn on and off with the button?
@rvfortwo5565
@rvfortwo5565 5 жыл бұрын
@@digiblurDIY I found your post about the module settings on GITHUB. I think I have it figured out. Thanks for the fast response.
@digiblurDIY
@digiblurDIY 5 жыл бұрын
Good deal. The Tasmota template site is great for device configs.
@johnbrumfield6212
@johnbrumfield6212 3 жыл бұрын
Awesome!!! Awesome! Regarding retain, I did the shelly 1 garage project. Under the use-case when the shelly loses power when the door is down, before it is powered up, the door is put up manually. After it is powered up how do you obtain the initial state of the sensor contact (open) when it was (closed) before it lose power?
@digiblurDIY
@digiblurDIY 3 жыл бұрын
You'd need a rule to fire on boot/mqtt connect the state of the reed switch.
@johnbrumfield6212
@johnbrumfield6212 3 жыл бұрын
@@digiblurDIY Thank you!!!
@drreality1
@drreality1 5 жыл бұрын
Great video again thanks so much. I wonder how esphome handle power and state changes during WiFi and restart scenario? Cheers man
@digiblurDIY
@digiblurDIY 5 жыл бұрын
Not really sure on that one as all of my esphome installs are mainly sensor based and don't have power states.
@vaughanza
@vaughanza 4 жыл бұрын
Thanks for another great video. I am trying this with my Sonoff Bridge and the door sensors but unable to get it to work. My door sensors ( on & off sensor ) shows a closed-door after a restart. Please can you do a video on the RF Bridge and be able to get the correct state of the door after a restart. Would really appreciate it.
@digiblurDIY
@digiblurDIY 4 жыл бұрын
I have one on the Sonoff RF bridge and the publish2 command should accomplish that.
@PersonXes
@PersonXes 4 жыл бұрын
Very helpful video. Your automation to get the states of the devices after a reboot in case a device sent a message during the reboot isn't necessary when you set QOS to level 2 right? The device would keep trying to send the message untill the MQTT broker in home assistant has rebooted and is ready to receive the message.
@digiblurDIY
@digiblurDIY 4 жыл бұрын
That issue isn't due to QOS.
@abbv2x
@abbv2x 4 жыл бұрын
Howdy Travis, I've recently purchased one of these power strips and started to go through the OTA flashing process (which has worked well for me with Gosund plugs and some other switches). This guy refused to work so I figured it was OTA blocked. No worries, your vid's are awesome for showing how to manually flash devices which I've also done with great success. When I pulled this guy apart I noticed they have drastically changed up the design and I would like to share that to the community/tasmota group however I'm not sure of the best way to do this. any suggestions? Thanks!
@digiblurDIY
@digiblurDIY 4 жыл бұрын
Do you have a discord account? You can come share stuff in there. Is that the new model they changed the design and switched to RTL?
@olegafanasiev9959
@olegafanasiev9959 5 жыл бұрын
Хорошее видео. ! )
@tuinjie
@tuinjie 4 жыл бұрын
Hi Travis, brilliant video thank you, I'm a noob to HA, just installed 4 weeks ago, frantically watched many hours of KZbin videos/read docs to get me up to speed. I think I have fixed 'most' of my issues regarding the retain status, but I have this particular problem on 2 Lohas E27 lamps. Have few others Lohas B22's same Tasmota firmware (7.0.0.3) and those work perfectly. Each time you toggle switch in HA to 'ON' within
@digiblurDIY
@digiblurDIY 4 жыл бұрын
Did you turn on setoption59?
@tuinjie
@tuinjie 4 жыл бұрын
@@digiblurDIY Absolutely brilliant Travis, thought I had, clearly not. Love your channel and thank you.
@shaunwhiteley3544
@shaunwhiteley3544 5 жыл бұрын
On this series, could you show how to run 2 separate Hassio sessions on one MQTT broker, I really want a dev setup so I’m not annoying my partner when I’m experimenting 😢. Cheers
@alex10pty
@alex10pty 4 жыл бұрын
Hi thanks for the video it was really helpfull. In that power strip (or any other) is possible to read the power comsumption of each induvidual plug or it reports the total of all the devices connected?
@digiblurDIY
@digiblurDIY 4 жыл бұрын
No power monitoring on that strip.
@StePhanMckillen
@StePhanMckillen 5 жыл бұрын
10 out 10
@johnathanwee6334
@johnathanwee6334 5 жыл бұрын
This clears up the frustrating mystery whenever I restart my openhab. Can anyone help with an openhab rule that does the same for the HA automation?
@DrDrewsAdventures
@DrDrewsAdventures 5 жыл бұрын
I have my living room light and fan configured with setoption19 but would like to switch to manually entered in my config file. Is there a way to remove an auto discovered device through this method and later re-add it?
@digiblurDIY
@digiblurDIY 5 жыл бұрын
Type setoption19 0 and it removes it.
@waynenocton
@waynenocton 2 жыл бұрын
I'm having an issue where one tasmota device, always turns on when I restart my Home Assistant Supervised, suggestions anyone?
@digiblurDIY
@digiblurDIY 2 жыл бұрын
Retained mqtt command? Turn on weblog 4 on the console of the device. Watch the console of it and restart HA. Look for the SRC
@keithc397
@keithc397 4 жыл бұрын
Hi, do i use my duck dns for mqtt-explore or my local IP when adding a connection?
@digiblurDIY
@digiblurDIY 4 жыл бұрын
Your local mqtt IP.
@georgelza
@georgelza 3 жыл бұрын
I checked my grouptopic is still sonoffs. but I did change all my devices a bit... of course I did ;) they either */home/light// or */home/plug/ the command did not do anything, so I pushed it via Tasmota admin the HA plug in. so mission accomplished, just wondering what should my publish command be?
@digiblurDIY
@digiblurDIY 3 жыл бұрын
Which publish command?
@georgelza
@georgelza 3 жыл бұрын
@@digiblurDIY publish cmd/sonoff/powerretain 1
@georgelza
@georgelza 3 жыл бұрын
@@digiblurDIY ... once we get the publish working, then I need to move onto the automation, will ping you on discord tomorrow, easier there.
@digiblurDIY
@digiblurDIY 3 жыл бұрын
It's cmnd not cmd
@georgelza
@georgelza 3 жыл бұрын
@@digiblurDIY that was just a type/auto correct here, it was correct when I entered the command in the console.
@JordanReese
@JordanReese 5 жыл бұрын
Why use retain if you're just going to poll all the states on reboot anyway?
@digiblurDIY
@digiblurDIY 5 жыл бұрын
To retain all the power states for any reads of MQTT from any application without the need to have HA rebooted.
@jayare7750
@jayare7750 5 жыл бұрын
So I'm confused, is setoption19 1 bad or good?
@digiblurDIY
@digiblurDIY 5 жыл бұрын
That really depends on your setup. SetOption19 is easier but you lose some flexibility and possibly some reliability of staying put. The other method it will always be that name/topic but of course more work and you lose some advanced tunability features you might need on some switches like 3 ways. Try both and pick what works for you.
@jayare7750
@jayare7750 5 жыл бұрын
@@digiblurDIY Thanks, mostly a complete noob, but I was able to get Tuya-Convert working and currently have about 18 TreatLife SS01S wall switches 2 Treatlife DS01 dimmers and 4 Teckin wall plugs on tasmota. I had read that setoption19 1 would help with the auto-discovery, but that was only true with the dimmers. none of my other wall switches were discovered even with setoption19 1. I'm thinking of setting it back to 0 through a group topic, but I don't know what affect that will have on my dimmers. if it does, I'll just enable it on the dimmers only. As a noob, I really have no idea what setoption19 1 does, even after reading the setoption list a few times.
@digiblurDIY
@digiblurDIY 5 жыл бұрын
Are you running the full Sonoff build or the one right after tuya-convert? Setoption19 might not be built into that bin file you are running. Come jump into discord and a few of us can help. Don't worry, everyone was a noob at one point. discord.gg/bNtTF2v
@stoneobscurity
@stoneobscurity 5 жыл бұрын
BECAUSE you are using "toggle", of course it's gonna get out of sync. using retained is fine as long as you use ON/OFF in the retained.
@digiblurDIY
@digiblurDIY 5 жыл бұрын
Right I used toggle on purpose as it would get toggled every time instead of half the time. With an ON or OFF retain it only fails you half the time.
@lmamakos
@lmamakos 5 жыл бұрын
But there is no "TOGGLE" command ever sent to a device. "Toggle" is an operation that Home Assistant implements, referencing its local state for the device. It then sends a payload_on or payload_off command to the device (as you've configured) to switch it to the other state. See www.home-assistant.io/components/switch.mqtt/
@digiblurDIY
@digiblurDIY 5 жыл бұрын
This was a mock up to cause it to shift each disconnect. Otherwise I would have had to put a retained ON then go toggle it off every time then force the reconnect and that would have made the video longer than it already needed to be.
@jobarjo78
@jobarjo78 5 жыл бұрын
I don't understand why the switch toggles with the retained message. If the retained message is the previous state, then it shouldn't switch. Can someone explain please?
@digiblurDIY
@digiblurDIY 5 жыл бұрын
Right. It would only switch 50 percent of the time. Only when it differs. Something being broke half the time is better than all the time but still not a good thing.
@onkel_joerg
@onkel_joerg 4 жыл бұрын
Tasmot AAAAAAA
@digiblurDIY
@digiblurDIY 4 жыл бұрын
Khhaaaaannnnnn
DIY ESPHome Multisensor - Temp, Humidity, RGB LED, Motion and LUX
27:16
Seja Gentil com os Pequenos Animais 😿
00:20
Los Wagners
Рет қаралды 61 МЛН
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 124 МЛН
Алиса от Яндекс - Настройка Управления по MQTT
11:07
Уголок технаря
Рет қаралды 68 М.
Smart 3-way Switching with Tasmota Device Groups
19:55
ResinChem Tech
Рет қаралды 3 М.
MQTT 101: Integrate your DIY Devices into Home Assistant
28:06
ResinChem Tech
Рет қаралды 75 М.
MQTT and Home Assistant
11:38
Home Automation Guy
Рет қаралды 114 М.
DIY Whole Home Power Monitoring with ESPHome & Home Assistant
30:39
digiblur DIY
Рет қаралды 256 М.
Manage your Tasmota Devices Centrally with Tasmo Admin
20:28
Hive Mind Automation
Рет қаралды 4,6 М.
Blog. Home Assistant. MQTT Bridge - Mosquitto broker synchronization
8:10
Alex Kvazis - технологии умного дома
Рет қаралды 12 М.
15 Home Assistant Tips You MUST Do
14:28
Everything Smart Home
Рет қаралды 398 М.