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.
@mikealport2065Ай бұрын
This is an old one - but still very relevant and very clearly explained - thanks very much. I've bookmarked it.
@jimbrewer58215 жыл бұрын
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!
@dannewcomb88105 жыл бұрын
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.
@dadrad5 жыл бұрын
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!
@1binlids5 жыл бұрын
What a fantastic explanation of retained messages Travis, easiest way to check & clear out I have seen, keep up the great videos.
@snowchaser755 жыл бұрын
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.
@paulmurphy37353 жыл бұрын
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 🙏
@digiblurDIY3 жыл бұрын
Glad you like them!
@stang70man5 жыл бұрын
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!
@digiblurDIY5 жыл бұрын
Thanks for the feedback and real life scenario! Makes this hobby enjoying and time to teach this all worth it!
@cleberam5 жыл бұрын
Really good and informative, excellent job, thanks! Those 20 minutes save hours of troubleshooting and frustration.
@digiblurDIY5 жыл бұрын
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.
@bulldog34945 жыл бұрын
Thanks Travis, you answered a couple of problems I was dealing with. I think you should change your name to Dr. Tasmota!
@AnoNymous-lp5tb5 жыл бұрын
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.
@shaunwhiteley35445 жыл бұрын
Excellent, just excellent! Thank you so much for this! Cheers
@ufootje3 жыл бұрын
very good. this was a real eye opener for me!
@laurentmathivet12143 жыл бұрын
Really nice video ! You're a naturally born teacher :D ! Merry Christmas to all
@digiblurDIY3 жыл бұрын
Thank you! 😃
@squalazzo5 жыл бұрын
excellent, very clear, thanks Travis! :)
@crazywux5 жыл бұрын
very helpful, you mention esphome. For those that wish to dodge MQTT can you follow up video how retains work with esphomes native API.
@digiblurDIY5 жыл бұрын
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.
@imike9644 жыл бұрын
Dude, you are awesome!
@Rickr5225 жыл бұрын
Super helpful and another video well done. Thanks!
@lmamakos5 жыл бұрын
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.
@JimDumser5 жыл бұрын
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.
@lmamakos5 жыл бұрын
@@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.
@jc-zh9kl3 жыл бұрын
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
@digiblurDIY3 жыл бұрын
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...
@kevincostner85365 жыл бұрын
Nice video, man! Thanks!
@ilducedimas4 жыл бұрын
You rock ! Thanks so much
@gmaclean13 жыл бұрын
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 :)
@digiblurDIY3 жыл бұрын
Depends on how you are doing integrations and such. MQTT retains will always be a thing even if automatically done for you.
@aliaghil15 жыл бұрын
well done, thanks for your good video.
@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.
@johnbrumfield62123 жыл бұрын
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?
@digiblurDIY3 жыл бұрын
You'd need a rule to fire on boot/mqtt connect the state of the reed switch.
@johnbrumfield62123 жыл бұрын
@@digiblurDIY Thank you!!!
@madrian_hello5 жыл бұрын
Very nice guide. 👍
5 жыл бұрын
You're a life saver!
@nigelholland245 жыл бұрын
Another great video thanks
@tota55 жыл бұрын
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!
@nvdwalt3 жыл бұрын
I love this one awesome bud
@digiblurDIY3 жыл бұрын
Glad you like it
@mikebusch93075 жыл бұрын
Brilliant ;0))) best explanation heard until now ;0))) and it works ;0))))
@rabidbunny30252 жыл бұрын
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")
@digiblurDIY2 жыл бұрын
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?
@rabidbunny30252 жыл бұрын
@@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.
@waynenocton3 жыл бұрын
Oh man this is a good one!
@waynenocton3 жыл бұрын
My switches are now correct, all the time as far as I can tell, love it! You're the best!
@rvfortwo55655 жыл бұрын
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.
@digiblurDIY5 жыл бұрын
That can get to be more of something with rules. What do you want to turn on and off with the button?
@rvfortwo55655 жыл бұрын
@@digiblurDIY I found your post about the module settings on GITHUB. I think I have it figured out. Thanks for the fast response.
@digiblurDIY5 жыл бұрын
Good deal. The Tasmota template site is great for device configs.
@drreality15 жыл бұрын
Great video again thanks so much. I wonder how esphome handle power and state changes during WiFi and restart scenario? Cheers man
@digiblurDIY5 жыл бұрын
Not really sure on that one as all of my esphome installs are mainly sensor based and don't have power states.
@vaughanza4 жыл бұрын
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.
@digiblurDIY4 жыл бұрын
I have one on the Sonoff RF bridge and the publish2 command should accomplish that.
@stephennutt25654 жыл бұрын
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.
@digiblurDIY4 жыл бұрын
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.
@PersonXes4 жыл бұрын
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.
@digiblurDIY4 жыл бұрын
That issue isn't due to QOS.
@alex10pty4 жыл бұрын
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?
@digiblurDIY4 жыл бұрын
No power monitoring on that strip.
@abbv2x4 жыл бұрын
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!
@digiblurDIY4 жыл бұрын
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?
@rubenhackar4 жыл бұрын
hiiii, how can i put the correct percentage of my covers when the wifi goes down and back again? HA keeps the old percentage.
@tuinjie4 жыл бұрын
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
@digiblurDIY4 жыл бұрын
Did you turn on setoption59?
@tuinjie4 жыл бұрын
@@digiblurDIY Absolutely brilliant Travis, thought I had, clearly not. Love your channel and thank you.
@shaunwhiteley35445 жыл бұрын
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
@johnathanwee63345 жыл бұрын
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?
@olegafanasiev99595 жыл бұрын
Хорошее видео. ! )
@keithc3974 жыл бұрын
Hi, do i use my duck dns for mqtt-explore or my local IP when adding a connection?
@digiblurDIY4 жыл бұрын
Your local mqtt IP.
@georgelza3 жыл бұрын
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?
@digiblurDIY3 жыл бұрын
Which publish command?
@georgelza3 жыл бұрын
@@digiblurDIY publish cmd/sonoff/powerretain 1
@georgelza3 жыл бұрын
@@digiblurDIY ... once we get the publish working, then I need to move onto the automation, will ping you on discord tomorrow, easier there.
@digiblurDIY3 жыл бұрын
It's cmnd not cmd
@georgelza3 жыл бұрын
@@digiblurDIY that was just a type/auto correct here, it was correct when I entered the command in the console.
@DrDrewsAdventures5 жыл бұрын
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?
@digiblurDIY5 жыл бұрын
Type setoption19 0 and it removes it.
@StePhanMckillen5 жыл бұрын
10 out 10
@waynenocton2 жыл бұрын
I'm having an issue where one tasmota device, always turns on when I restart my Home Assistant Supervised, suggestions anyone?
@digiblurDIY2 жыл бұрын
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
@JordanReese5 жыл бұрын
Why use retain if you're just going to poll all the states on reboot anyway?
@digiblurDIY5 жыл бұрын
To retain all the power states for any reads of MQTT from any application without the need to have HA rebooted.
@jayare77505 жыл бұрын
So I'm confused, is setoption19 1 bad or good?
@digiblurDIY5 жыл бұрын
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.
@jayare77505 жыл бұрын
@@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.
@digiblurDIY5 жыл бұрын
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
@onkel_joerg4 жыл бұрын
Tasmot AAAAAAA
@digiblurDIY4 жыл бұрын
Khhaaaaannnnnn
@stoneobscurity5 жыл бұрын
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.
@digiblurDIY5 жыл бұрын
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.
@lmamakos5 жыл бұрын
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/
@digiblurDIY5 жыл бұрын
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.
@jobarjo785 жыл бұрын
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?
@digiblurDIY5 жыл бұрын
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.