I have two great sources that I check every few days. One is the Scargill Tech Blog and the other is this channel. I am never disappointed by what I see here. Thanks to Mr. Spiess for his great and informative work.
Excellent video again Andreas and yet again a very concise summary, many thanks. As you may recall from a previous comment this effectively maps my home automation methods over the last 18 months where I have up to a dozen or so Wemos D1's and Sonoff switches "in the wild" with Node-RED supervision bia MQTT. Two other Node-RED gifts worthy of mention are Pete Scargill's "Big Timer" node and the "Pushbullet" API node. Petes node is a very configurable timer/scheduler node with daylight compensation, just perfect for your fake TV project. The pushbullet API allows you to instantly push notifications to your chosen devices in the scenario where you play an audio file. My experience with this is 100% good with my home security system pushing me a message within a fraction of a second of activation and again it is free. Well done again on a great video! Garry
I knew about Peter's Bigtimer (I am also one of his fans...)and I will give it a try. And I put Pushbullet on my list of "services" which I might review in the future...
Super useful and interesting! Thanks Andreas! I'm happy you mention it's important the "like" button. I was not taking so much importance to it, now thanks to your message, I will make sure to press it always. Maybe it will be good you remember us monthly until the likes go up to 30% or more. Thanks for the passion and great patience to explain all these new technologies!
I try to always give your videos a "Thumbs up", they have been very useful for me as a newbie to Node-Red and MQTT, as well as 8266 subject. Thank-you for taking the time to make these videos!
Regarding QOS 2: as because MQTT first was invented for Sattelites, a message like "gurn left by 10 degrees" is important to only do it once. so always for relative changes, a QOS 2 is needed. Or toggles instead of switches, if toggles are done twice... you know, not so super ;-) I hav a few implementations with QOS 2 like mechanism (not in MQTT, but other technologies) hope this helped. greetings from Interlaken.
Thanks for your explanation. I did not think of toggling (probably because I also do not like it for "remote stuff"... The direction thing is very understandable.
Just got an Alexa, also a NodeMCU, so am starting to get to grips with this stuff, your explanations are clear and concise, thank you Andreas, keep up the good work my friend.... (Off to find a Rasp Pi zero!)
MQTT and Node-Red are a perfect match. You have explained this very well. Take a look at TouchOSC and explore the ways Node-Red can bridge OSC and MQTT to turn your Android or iDevice into a very powerful remote control. TouchOSC is to OSC what Node-Red is to node.js.
Excellent video! Thanks again for all your great work. _"I could stop the video now ...but because I am Swiss, the fun just starts now."_ That gave me a very deep and respectful laugh. 😎
Node-Red with Mosquitto is awesome! I am using the same setup in my homeautomation system. I am also turning on/off my sonoff switches via MQTT. Very useful video for beginners. BTW: your Github folder includes no Sketch
Thank you friend with the Swiss accent. I have enjoyed many of your videos and was excited to see you get a Pi Zero W, now MQTT. I will probably have to watch these videos many times until I understand since I'm new at coding. Thanks for the good tutorial, Hope to see many more. I need help!
Thank's again for this video, with your first introduction of ESP8266 MQTT, I started my project and had some issues with the Web interfacing, this video answer exactly to my issue and I will be able to finish my project (chicken automatic door with alarm if the door still closed). I hope that you will continue with your "vision" of your channel, it's exactly my way on thinking. Are you a soothsayer :-) Best regards
Liked, thanks! One small thing, your topics don't need the leading slash; it won't hurt it but it declares the first part of the topic as blank or null or something like that. Keep up the excellent work!
I think there is some confusion regarding the retain flag. The retain flag tells the broker to save the topic's most recent message when the broker is restarted. So for example a sonoff switch will be able to receive it's last state from the broker after a power outage that affects both the client and the broker. The retain flag works well in the Mosquitto broker.
That's what I thought, too. But in the video, you see, that this happens also if I do not use the retain flag. That's why I did not understand it. Maybe, it would be different if I restart mosquitto.
The retain flag does two important things. One, if a message is published before a subscriber is online, the subscriber will receive that message when it does come online and subscribe to it. Two, if they broker is offline (restarted, rebooted, power failure) retained messages will be saved and can be sent to subscribers when the broker comes back on line. There is a good description of it here: www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages I highly recommend the hivemq essentials blog posts, they are very informative.
Thanks for your info. I also found your link very useful. I understood how the retain flag should work, but I did not see any difference in behavior of mosquitto if it was switched on-or off (without rebooting the raspberry). There comes my comment...
I'm amazed that so few people use the like button. This is another fantastic video - exactly what I need to move my systems to the next level. I have 8 ESP's around my house and they talk to each other by using Http which works fine but it is not as responsive or robust as what you have shown with MQTT. I have also brought an Amazon Echo which is a lovely device so I'm looking forward to the next instalment. Your work has saved me so much time putting things together it's worth much more than just a Like. Other people use Pateron (not sure about the spelling) - have you considered this? Best wishes Arthur
I also used HTTP for my light in the lab. But I replaced it now with MQTT. It is much simpler, faster, and more secure (without programming). I only resisted because I have to have a Raspby on all the time... Concerning Patreon: I am thinking about that, but so far, I still am able to finance my hobby myself. And with the sponsored link to Bangood and my few dollars from google I can calm my wife ;-)
Just ordered my Pi Zero W for £12.50 including shipping. Looks like excellent value for money. Looking forward to getting MQTT up and running. Best wishes Arthur
Arthur; Can you provide some examples of your coding somewhere, So I can learn from them. I am teaching myself arduino.ide. Stumbled across Wemos D-1 minis(love them), now I have a Raspberry Pi zero W, running Mosquitto MQTT broker. Having difficulty tying it all together. Turning off the LEDs via HTTP is ok but a bit sluggish at times. As I have it right now with MQTT, It is lightning fast but can only seem to get two Wemos to connect to the broker. Thanks. Nick
I don't have any problems with the likes on this channel. I automatically click the like, THEN the play button. Every time. Haven't had any reason not to!
I have enjoyed watching a number of your videos while picking up some electronics projects. QOS2 is something you would need if you had idempotency concerns - and often those types of concerns pop up when you have distributed systems Depending on the use cases scenarios with ESP32 mesh networks or possibly bridged brokers might fall into an architectural space where this would matter. Idempotency is definitely something looked at carefully when dealing in banking payment systems. The concept isn't too hard to understand, but isolating the root cause of the bugs the phenomena can produce can make my head spin. For example, in a distributed system, if a message is sent to a queue and the receiver processes it, but the acknowledgment is lost, the message might be redelivered (resulting in 2 payments for a payments systems possibly). If the operation is idempotent, the receiver can safely process the message again without causing any unintended side effects. Thanks again for sharing your knowledge - I will keep watching them!
Indeed, "transaction save" is not easy to get. And particularly not in high speed. I used to implement SAP ERP systems where we had to deal with this issue. With many thousand users creating business transactions, the speeds were mind-boggling for global systems...
Andreas, i use a lot mqqt with mosquitto on my home automation. Retain is very usefull. Let's assume your client only wakes up one time per hour, and check mqtt for messages/actions. You then send that command and it's retained in your mosquitto. But, (and that's the fun part) it's retained even if you reboot your raspberry. That way it will not loose any pending messages. ;)
This is, what I also understood. But in my video, this functionality (without rebooting the Raspberry) was also available without the retain flag set. That is, what I did not understand...
It was there, maybe, because it was sent again to mosquitto from a client that did failed sending during reboot. Is that possible? Well, i would not say you're right... but in my tests, retain was there for that :)
great videos keep em up, please continue to do thourough tutorials on mqtt and node red. its starting to get a bit easier to understand, there is a serious lack of good content on youtube. Thanks again. my friend :)
I think the reason why you get only 10% likes is a bug in Android RUclips application. When watching YT videos on android I have to press thumb-up icon for a few times because pressing it once or twice does not have any effect. It's not specific to your channel, it just works like this for every YT video which is a pity because I suspect YT to do this intentionally. I love your videos and your ideas. please keep doing them this way, thanks!
Great video ... I was unclear though on where the broker and 2nd client were implemented. It seems that three processors were needed and running but I wasn't aware of where and how. Gave you a thumbs up as usual as I learned & enjoyed! Bye
There is only an ESP8266 board and a Raspberry Pi in my video. Mosquitto and Node-Red are installed on the Raspberry. I connected to Node-Red from my PC, but just, because I cannot screen capture on the Raspberry. You can use also the built-in Browser on the Pi
Great video as usual. I noticed weird characters on your serial monitor when you are testing retained flag (video: 12:53). Only last two received "payload" are OK. I tested your scenario and I got the same thing. This only happens when ESP is reset, or powerd up, when "onMqttConnect" subscribing. It could be a bug in library.
I know that, but weird characters comes when the sketch is alredy in loop and running. Look what you get in serial monitor when you pressed buttons for six thimes. First four "payloads" aren't clean. Found this link: github.com/marvinroger/async-mqtt-client/issues/35
i am very new to all things computing but found if you change Serial.begin(74800); and also the serial monitor to the same you see the esp8266 is displaying info about itself . when started or reset button pressed mine puts out ets Jan 8 2013,rst cause:2, boot mode:(3,7) load 0x40100000, len 2408, room 16 tail 8 chksum 0xe5 load 0x3ffe8000, len 776, room 0 tail 8 chksum 0x84 load 0x3ffe8310, len 632, room 0 tail 8 chksum 0xd8 csum 0xd8 2nd boot version : 1.6 SPI Speed : 40MHz SPI Mode : QIO SPI Flash Size & Map: 32Mbit(512KB+512KB) jump to run user1 @ 1000 hope this is of interest.
i always like your videos and recommend them to my students and friends.. i gave exactly the same youtube example to explain my students... as always cheers and thanks for sharing the video
Good video. Recently heard about mongoose-OS for esp8266. To my surprise it took less than two minutes to setup, program and go live of an mqtt button. Waiting to see a brief video and review of mongoose-os from you.
Thank you for sharing information at a level that I not can only follow but build my understanding. Peter Scargill spiked my interest in IOT but much of his work is at a level that leaves me with many unanswered questions as he caters to people with much more advanced understanding than my own. I am so glad that you deal with much of the sexy stuff that he covers while bringing the required comprehension level down to that which I can build from. Keep up the excellent work. I also have a request. I purchased some capacitive light switches with 433 Mhz remote control features however the switches only toggle making it impossible, as I also have 433Mhz remote switches (toggle mode only), for Node red to determine if the switch is on or off. I thought of reading the power consumption after the switch with an esp8266 and an ACS712 but my efforts have failed dismally. If you have a solution to this I would be most grateful a video of how you manage it.
I do not like toggle buttons for automation and I avoid them. Your workaround might work at the end. But maybe it is simpler to replace the switch with one with on and off positions.
just a comment because I recently learned this. MQTT topics don't actually have to start with a `/` and it is actually better not to include this leading slash, because it means the server has to use more memory for the empty topic '' before the leading slash. so `/my-topic/subtopic` is not the same as `my-topic/subtopic` but `my-topic/subtopic` is apparently preferable
The difference isn't relative vs absolute paths, but that mqtt paths don't actually start with a `/` so when you write `/a/b/c` mqtt has to allocate resources to keep track of 4 levels instead of the three you actually meant, because the first one is the level before the first `/`. Does that help?
'Please help me I have problems' 😂😂😂😂 Ohh Andreas, why does the wife always get the money? Bravo, another fantastic piece of knowledge. Andreas, I've been following and attempting to setup a database to record these values using Node Red. To say it's been a bit confusing would be an understatement. Could you make a video using MQTT the ESP and in the wonderful way you do show us how to record this to a simple database. Bless you
Damn you 'guy with the Swiss accent'! You've gone and preempted me - with the 'topic' of my forthcoming video (see what I did there)?. But thanks for the reference and excellent dual between Broker and UTube. I'll go back and 'like' furiously!
There is always somebody faster... But with MQTT, I am really slow. This stuff started 4 years ago on RUclips. So, nobody can blame me to be fast (the contrary might be true...). I just got lost with all this QoS stuff and did not find a proper demo. So, I did it... Your videos are very nicely done, BTW. And you get also likes from me...
people like me who can't be pterion supporters this is least thing you can do to your favorite channel , Also if you have joined communities on reddit or discord you can always recommend related video where possible. Thank you, Andreas
Good sir, I love your channel, you really explained a lot in an understandable manner. A request for a short video: I'd love it if you could take a crack at the Esp8266 in regards to external resets. Timings needed, components used and the base logics to get a successful reset. I've read about it a lot looking at solutions using capacitors and transistors to generate a negative pulse. While I do understand a lot of it, an video from you is surely to answer the last bits of questions.
Andreas Spiess, I'm using the Esp8266 for a lot of battery powered projects. The current one is door monitoring, ie when was the door opened, what is the state of the deadbolt, locked/unlocked I'm using a magnetic reed switch for the doors that upon opening of the door will create a low pulse on rst pin to wake up my ESP. But it only needs to create the signal when the door is opened, and not do anything whilst the door is left open or closed. Mostly replicating circuitry from this guy github.com/chaeplin/esp8266_and_arduino/blob/master/_48-door-alarm-deepsleep/README.md But he leaves only the solution without, for me, a proper explanation on what is happening and how it works. Working scenario: 1 door opens 2 esp wakes (can't be reset during operation) 3 logs time stamp and deadbolt state 4 few short sleeps to recheck states 5 sleep forever
If the solution is working, it is already good. Then, you can watch my videos about deep sleep to unterstand more about this state. Just use my ESP8266 playlist.
Thanks for another great video! I hope I can get a mgtt server up and running on the Orange pi zero I have under way. I did not plan for it when I ordered, but having seen this video, I will have to give it a try 😀
One bit of feedback. Could you increase the font size in your text editors/arduino IDE or use a mouse cursor zoom or something? It's a bit hard to read casually
I know the problem, but so far, I have no "magnification glass" functionality. And this time, I had to have many things in parallel. I will try to do it better in the future...
Andreas, Look into using Camtasia from TechSmith. Its what Lynda.com uses to produce ALL their videos. I played with a pirated version from the link below. It installs and runs fine and the most powerful out there. goo.gl/5VYTIr I don't use it, since I don't produce any tutorial or videos, but apparently, it is the defacto of the industry.
Andreas installs MQTT EXPLORER on Windows and you will understand the retained message if qos =0. use retained only with status topics. example = stat/light/power . CMND topic only without retained!!! example = cmnd/light/power the explorer has a funktion to delete retained mesage from brocker :) i have home 30 tasmota devices :)
Just finished updating my script to handle the RPI Zero WIFI - and this includes setup of Node-Red, Mosquitto and MQTT etc. Found Raspbrian to be very SLOWWW - - so installed DIETPI instead for a much speedier little board. tech.scargill.net/raspberry-pi-zero-wifi/
Good stuff Andeas! I wonder if it's worth closing the loop with node red dashboard so that you can press a button and then visualise the feedback? (And other exciting stuff 😎)
Hi Andreas - another great video! I was looking at your sketch, and I had concerns about the very first function: char* buildTopic(char* topic) { char* hi = ""; sprintf(hi, "/%s%s", boardName, topic); return hi; } Where is the memory that the sprintf() writes the two strings into? Unless I'm missing something, your function creates a pointer named 'hi' that points to a single byte on the stack, a NULL character that terminates your empty string "". Then you write the boardName and topic into this memory space (that only allocated the single byte), and you return a pointer to that new string. First, shouldn't you allocate enough memory in your string to hold the entire new, formatted string? Otherwise, you don't know what else on the stack you're going to stomp on. It's asking for trouble. Second, after your function returns, the variable called 'hi' goes out of scope and is destroyed. It's not good practice (it will cause random hard-to-diagnose errors) when you continue to use a variable that has gone out of scope. Not sure if this has caused you trouble already, but I'd suggest fixing it. Maybe since there are no other variables created in this function, you got lucky that the sprintf() didn't overwrite them, and if you use the returned string immediately before calling any other function, you might get away with using an expired variable that no longer exists, but like I said, you're playing with fire.... :-) Better would be for the calling function to provide buildTopic() with a pointer to where the combined string should go (along with the size of the buffer being passed).
Thanks for your feedback. You see, I am a bad programmer (especially I do not like the lacking or confusing string handling in C++). Can you tell me, houw to do it right? Then, I will change it.
No problem -- by contrast, I'm an old-school guy who LOVES the absolute control you get with the C/C++ language, and the danger that comes with it! :-) Whichever solution you use, what you want to do is to make sure that the memory you're writing into with the sprintf() is not a temporary variable inside the function. You also want to make sure that you allocate as much memory as you're going to need for the final, combined string. One simple way to do the first part would be to add the "static" specifier in front of the char *hi = ""; like this: static char *hi = ""; What that does is it allocates memory for your string in a permanent location, not on the stack. (There are better ways to solve this, though....) Don't confuse static with const. Const means that you can't change the value of the variable. One simple way to make sure you allocate enough memory is to add as many spaces between your double quotes as you think you're going to ultimately need. Like this: static char *hi = " "; // a long string of spaces You should also be able to do this in a shorter way by creating a character array called hi. When you do this, the name hi by itself (without square brackets) is treated like a char *, because it's the address of the array (or the address of the first element of the array, to be specific). Like this: static char hi[30]; // assuming you'll never need more than 30 characters That should be enough to remove the danger in the way it was done before. Like I said, it might be better for the calling function to allocate the memory, pass this function a pointer to that memory, etc. but let's not overcomplicate things. Keep up the good work! I have three LoRaWAN gateways being delivered to my office next week... Looking forward to getting those on The Things Network and doing more with our LoPy node devices!
Another great video, sir! I stumbled across your channel about a month ago, and you have some really good, informative videos. The only downside is that now I want to go play with all this stuff and blow off all my responsibilities (my wife and kids would not appreciate that... 8-) I played around with MQTT, a Raspberry Pi and some Kankun plug-in modules last year, but ran out of time and never fully implemented the whole setup like I wanted to. Watching your videos has inspired me to go back to finish the project. Are you going to do anything special for Arduino Day 2017? I had an idea for a fun project for you to do, based off what you've done so far: - Build a simple box that has a push button on it. The box would subscribe to an MQTT broker, and when the button is pressed, it would send a message to the broker. - Build a simple box that has an LED and push button on it. This box would subscribe to the same channel as the first box, and when this box receives an MQTT message, it would turn on the LED. When the push button is pressed, the LED would be turned off, and if the LED changed from 'on' to 'off', the box would also send a message back to the broker to say that the button was pressed (i.e., the box would not send the message if the LED was already off). How would this be used? Well, you build the push button box and run it with a publicly accessible MQTT server. We, as your subscribers, would each build the LED box. Then, when you publish a new video, you just push the push button on your box, which would cause the LED on our boxes to turn on so we know there's a new video to watch. When we watch it, we push the button on our box which would send a message back to you to let you know people are watching your video (you could keep a tally of how many people have watched your new video). Yeah, I know it's silly, but it could be a neat, simple, silly way of demonstrating how MQTT could be used across the globe. Something to think about... Take care, and have a great weekend!
Nice idea. I once offered my subscribers to light a LED on my desk through adafruit.io, but nobody really tried... So, I still have to use RUclips to get the connections between my viewers and me...
Great vids, but a little over my head atm. Im starting to learn how to build my own smarthome, for now Im focusing on plugging in lights and using my Google home for voice control. I use the stock Sonoff fw and ewelink app. It all works great, but I would like to also use apple HomeKit switches on my devices (and not the ewelink app). I read that there is a bridge that I can install on a PI that can talk to a MQTT device (flashed sonoff), but Im worried that then I won't be able to control the sonoff with my Google home. Could you tell me: How to setup a PI, Sonoffs to use Google Home for voice control and HomeKit switches on iOS devices (and Siri?) also? Thanks
I think you experience the frustration of many home Automation users: Incompatibility. For the moment I do not know an easy way out. So far, I do not own a Google home, just an Alexa. So I do not know how to connect it to a Raspberry or to MQTT. Maybe you find information on more "home automation" related channels.
Hi Andreas and the rest! Quick question, in the long run, would you recommend the PubSub (knolleary), the PubSub (Imroy), or the Async? Or another one. Cheers!
Hi Andreas! Thanks for your great videos! I'm a new fan of Wemos d1 mini and Blynk ( and obviously of your channel) . Can you point me a video or a guide that help me in the comprehension of Blynk or MQTT and Node Red .. I must start from basis! Thank you in advance !
So far, I never used Blynk. Just google node-red or MQTT and you will find many interesting tutorials. It depends also a little on how much you are in Linux. If you watch my videos about the topics, you will find a link to a script and even an image for a raspberry Pi which includes all needed stuff. It usually works out of the box.
Hi Andreas, one question. I am trying to connect my ESPs to two different brokers, one is local (raspberry pi) and the other one is on Internet (ubidots). Both are using PubsubClient library. I have noticed that even having them in different ports, they keep connecting and disconnecting. I have tried having different options like creating different PubsubClient instances and even with different WifiClient instances with no success, they keep disconnecting and connecting. Is there any solution for this problem? Thanks and keep on the good work.
Hello Andreas, do you know a good Tutorial or Video how to change a buttons background color or even let the "switch" at node-red dashboard change its state when i change a leds state from other place? If you create a switch at node-red, place it at the dashboard and turn on the led with that switch, you can turn off the led with a smartphone with another app (for example) and the switchs state will still be "on". So there have to be a function to let the switch change the state also when you send a message from another place. thanks
I just have my credentials in this file to not share them on github. So, you can delete this line. I think, the newest version of the sketch is already corrected.
I really like using retained messages for purposes like this, because then, when I power on the device again, it immediately recieves a message with the current state from the server. This works even with QOS 0. I wonder what you think about it.
I know that the retain flag works properly in mosquitto, but it is possible that the async library is not handling it properly. I don't think I have used arduino + MQTT, so I'll have to check.
Hello Andreas i have a question I know it is possible to all this withou using MQTT what are the other options? I know you can do it with a raspberry pi and ESP8266 link over different or the same networks.
Grüezi Andreas Ich hab ein kleine frage ich hab in Zurich mein Balkon mit pflanzen :D ich hab gerade dein tutorials gebraucht um mein relay zu steuren fur mein wasser tonne funktioniert mit handy aber jetz wol ich ein billige soil sensor brauchen um zu schauen ob my pflanzen überhaupt wasser brauchen Ultiem solte natürlich sein Soil Messure und Wasser Pumpe activeren und mit zeit und wie lang der pumpe must laufen bin gerade and shauen ob ich episode #71 kann brauchen Wetter vorslag veileicht fur andere leute Ich wolte gerne dir noch danken fur diese supi channel wo ich viel lerne Btw ich wolte alles standalone bauen :D
Hello! I manually installed the AsyncMQTTclient libary (because i din't find it :/ ) but after it arduino stell need some other *.h and dont want to compile. Can you help me how to install dependencies at arduino ide? Thank you!
Yes. It is bull blood to make it stronger ;-) Actually, It is just a mark (red, blue, green) for my different boards, because I often use them with IOTappStory.com. Then, I do not want to lookup the MAC address everytime I use another board.
But only for the whole screen. This is what I already do. My normal screen is 4K and for programming screens I only use 1200x1000. If I go lower the overview is lost.
supose there are 4 devices 1 sender, 3 receivers(r1,r2,r3 all subscrbing to same topic t1). sender 1 publishes to t1. and r1 is online connected to broker. but r2 and r3 are offline or lost power so went offline. will broker send r2, r3 all messages that were sent by sender? if r2 comes online before r3. will r3 be servered with same messages that it missed?
HI, i am having problems with tasmota firmware being able to receive the value of a bmp180 sensor attached to my sonoff, BMP180 is connected up and works i can see the temperature,baro pressure on the webinterface with no problem and updating in realtime, I want to be able to view this data on my android device and have installed mqtt dashboard, this gives me buttons where i can turn on and off lights alter led colors etc these work great, i am using a cloudmqtt server... the only thing i cant seem to get right is be able to display the temperature on mqtt dashboard android i have parsed the json sring and got a value but no way will mqtt display the temperature surely it cant be this hard to get temperature on my android phone...? Please Help... Show less REPLY
Unfortunately, I do not know Tasmota and hardly use Android. Maybe you experiment with transferring artificial data via JSON to find the right format which displays a number on the smartphone.
Adrian Hein Node-Red opens the door to Postgres, MySQL, MySQL lite, flat files. I use Postgres on a Raspberry Pi. But you could also run a cloud server running Postgres and push your messages using MQTT.
Dear Andreas. Question: The payload coming from my device {"ON"} doesn't have the exact format required by the IoT platform that I am using {"value": "ON"}. This means that I will need to modify/adjust the msgs coming from the devices before sending them to the broker (hosted by the IoT platform that I use). Any idea how to do this? I found this: github.com/robertsLando/Mqtt2Mqtt Any other recommendation? Thanks!
You still only have a 10% like rate for this video unfortunately I can only like it once. My question is I'm running power over Ethernet to an esp8266 so I might as well run data to the esp8266. How would I connect it so that I can use it over my network instead of the WiFi?
You should be more specific when you're talking about programming an ESP8266 or ESP32. Micropython, lua, Arduino or espressif API are all programming options for the ESP modules.
I "liked" your video. To improve your video, next time zoom in to your sketch for better readability. Not everybody has a really big monitor. Keep posting!
I know the problem, but so far, I have no "magnification glass" functionality. And this time, I had to have many things in parallel. I will try to do it better in the future...
Hallo Andreas, hast Du Dir schon mal TASMOTA angeschaut? github.com/arendst/Sonoff-Tasmota. Das scheint eine extrem coole Lösung zu sein. Hier sind viele Dinge sehr professionell gelöst
Nein, noch nicht. Ich experimentiere im Moment mit Espurna von Tinkerman. Aber ich werde mal in TASMOTA reischauen...
7 лет назад
also there is an orange pi wifi for £5 on a site i saw last night i might do a vid on it if you sub it may help you out with loads of cheap new parts :)
Vielen Dank! Die Videos sind in Englisch weil global fast niemand Deutsch versteht. Und von denen verstehen noch fast alle (technisch orientierten) Englisch. Und meine Muttersprache ist es ja auch nicht. Wir Schweizer verstehen zwar Deutsch, aber wir sprechen es nicht ;-) Great Scott ist ja selbst Deutscher und macht seine Videos ebenfalls in Englisch.
I build a simple example how to make a Sonoofff/LCH switched to a IoT platform and make them secure and really private : github.com/i4things/NodeAPI/tree/master/examples/ESP8266-01/1CH_RELAY/thing
do NOT use asyncMqttClient!!!! It is seriously broken, see rhe recent post on its github. I have written a replacement that works, its in alpha at the moment, but will be released soon.
I went back and liked your videos too. keep making content. your stuff is great and informative. it's been saving me lots of time
good idea. i will do the same!
StopLossLOL Me too. We have to play ball with RUclips, Andreas's channel is a valuable asset!
Thank you very much for your support!
I have two great sources that I check every few days. One is the Scargill Tech Blog and the other is this channel. I am never disappointed by what I see here. Thanks to Mr. Spiess for his great and informative work.
Thank you for your nice words. The two actually maybe will come closer as I will try out his new script as soon as my Pi Zero arrives...
Excellent video again Andreas and yet again a very concise summary, many thanks. As you may recall from a previous comment this effectively maps my home automation methods over the last 18 months where I have up to a dozen or so Wemos D1's and Sonoff switches "in the wild" with Node-RED supervision bia MQTT.
Two other Node-RED gifts worthy of mention are Pete Scargill's "Big Timer" node and the "Pushbullet" API node. Petes node is a very configurable timer/scheduler node with daylight compensation, just perfect for your fake TV project. The pushbullet API allows you to instantly push notifications to your chosen devices in the scenario where you play an audio file. My experience with this is 100% good with my home security system pushing me a message within a fraction of a second of activation and again it is free.
Well done again on a great video! Garry
I knew about Peter's Bigtimer (I am also one of his fans...)and I will give it a try.
And I put Pushbullet on my list of "services" which I might review in the future...
Super useful and interesting! Thanks Andreas!
I'm happy you mention it's important the "like" button. I was not taking so much importance to it, now thanks to your message, I will make sure to press it always. Maybe it will be good you remember us monthly until the likes go up to 30% or more.
Thanks for the passion and great patience to explain all these new technologies!
Welcome aboard the channel!
I try to always give your videos a "Thumbs up", they have been very useful for me as a newbie to Node-Red and MQTT, as well as 8266 subject. Thank-you for taking the time to make these videos!
Thanks for the likes and for your feedback!
Regarding QOS 2: as because MQTT first was invented for Sattelites, a message like "gurn left by 10 degrees" is important to only do it once.
so always for relative changes, a QOS 2 is needed. Or toggles instead of switches, if toggles are done twice... you know, not so super ;-)
I hav a few implementations with QOS 2 like mechanism (not in MQTT, but other technologies)
hope this helped.
greetings from Interlaken.
Thanks for your explanation. I did not think of toggling (probably because I also do not like it for "remote stuff"... The direction thing is very understandable.
Just got an Alexa, also a NodeMCU, so am starting to get to grips with this stuff, your explanations are clear and concise, thank you Andreas, keep up the good work my friend.... (Off to find a Rasp Pi zero!)
Hopefully, everything works fine. Usually, a steep learning curve is necessary here. Have fun!
MQTT and Node-Red are a perfect match. You have explained this very well. Take a look at TouchOSC and explore the ways Node-Red can bridge OSC and MQTT to turn your Android or iDevice into a very powerful remote control. TouchOSC is to OSC what Node-Red is to node.js.
Thanks for the tip. I will look at it.
Excellent video! Thanks again for all your great work.
_"I could stop the video now ...but because I am Swiss, the fun just starts now."_ That gave me a very deep and respectful laugh. 😎
Thanks for your nice comment!
Another awesome video! Thank you Herr Spiess!
:-)
Node-Red with Mosquitto is awesome!
I am using the same setup in my homeautomation system. I am also turning on/off my sonoff switches via MQTT.
Very useful video for beginners.
BTW: your Github folder includes no Sketch
Thanks for the info about Github. It is now there. ;-)
Thank you friend with the Swiss accent. I have enjoyed many of your videos and was excited to see you get a Pi Zero W, now MQTT. I will probably have to watch these videos many times until I understand since I'm new at coding. Thanks for the good tutorial, Hope to see many more. I need help!
Thank you for your nice words! The advantage of videos is, that you can watch them a few times (or at least, parts)
Thank's again for this video, with your first introduction of ESP8266 MQTT, I started my project and had some issues with the Web interfacing, this video answer exactly to my issue and I will be able to finish my project (chicken automatic door with alarm if the door still closed). I hope that you will continue with your "vision" of your channel, it's exactly my way on thinking. Are you a soothsayer :-)
Best regards
Thank you for your nice words. I hope, you get a few more eggs from your chickens for this "comfort"...
Liked, thanks!
One small thing, your topics don't need the leading slash; it won't hurt it but it declares the first part of the topic as blank or null or something like that.
Keep up the excellent work!
Thanks for the info. I did not know that and I will change it.
I think there is some confusion regarding the retain flag. The retain flag tells the broker to save the topic's most recent message when the broker is restarted. So for example a sonoff switch will be able to receive it's last state from the broker after a power outage that affects both the client and the broker. The retain flag works well in the Mosquitto broker.
That's what I thought, too. But in the video, you see, that this happens also if I do not use the retain flag. That's why I did not understand it. Maybe, it would be different if I restart mosquitto.
The retain flag does two important things. One, if a message is published before a subscriber is online, the subscriber will receive that message when it does come online and subscribe to it. Two, if they broker is offline (restarted, rebooted, power failure) retained messages will be saved and can be sent to subscribers when the broker comes back on line. There is a good description of it here: www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages I highly recommend the hivemq essentials blog posts, they are very informative.
Thanks for your info. I also found your link very useful. I understood how the retain flag should work, but I did not see any difference in behavior of mosquitto if it was switched on-or off (without rebooting the raspberry). There comes my comment...
I'm amazed that so few people use the like button. This is another fantastic video - exactly what I need to move my systems to the next level. I have 8 ESP's around my house and they talk to each other by using Http which works fine but it is not as responsive or robust as what you have shown with MQTT. I have also brought an Amazon Echo which is a lovely device so I'm looking forward to the next instalment. Your work has saved me so much time putting things together it's worth much more than just a Like. Other people use Pateron (not sure about the spelling) - have you considered this?
Best wishes
Arthur
I also used HTTP for my light in the lab. But I replaced it now with MQTT. It is much simpler, faster, and more secure (without programming). I only resisted because I have to have a Raspby on all the time...
Concerning Patreon: I am thinking about that, but so far, I still am able to finance my hobby myself. And with the sponsored link to Bangood and my few dollars from google I can calm my wife ;-)
Just ordered my Pi Zero W for £12.50 including shipping. Looks like excellent value for money. Looking forward to getting MQTT up and running.
Best wishes
Arthur
+Arthur Yarnell Maybe you get some help next Sunday (If I am successful)
Arthur;
Can you provide some examples of your coding somewhere, So I can learn from them. I am teaching myself arduino.ide. Stumbled across Wemos D-1 minis(love them), now I have a Raspberry Pi zero W, running Mosquitto MQTT broker. Having difficulty tying it all together. Turning off the LEDs via HTTP is ok but a bit sluggish at times. As I have it right now with MQTT, It is lightning fast but can only seem to get two Wemos to connect to the broker. Thanks. Nick
Hi Nick
Andreas has some fantastic code on his GitHub page at github.com/SensorsIot
Best wishes
Arthur
I don't have any problems with the likes on this channel.
I automatically click the like, THEN the play button. Every time. Haven't had any reason not to!
Thank you for your support! Mentioning to not forget for all others helps to increase the percentage. We are all humans...
I have enjoyed watching a number of your videos while picking up some electronics projects. QOS2 is something you would need if you had idempotency concerns - and often those types of concerns pop up when you have distributed systems Depending on the use cases scenarios with ESP32 mesh networks or possibly bridged brokers might fall into an architectural space where this would matter.
Idempotency is definitely something looked at carefully when dealing in banking payment systems. The concept isn't too hard to understand, but isolating the root cause of the bugs the phenomena can produce can make my head spin.
For example, in a distributed system, if a message is sent to a queue and the receiver processes it, but the acknowledgment is lost, the message might be redelivered (resulting in 2 payments for a payments systems possibly). If the operation is idempotent, the receiver can safely process the message again without causing any unintended side effects.
Thanks again for sharing your knowledge - I will keep watching them!
Indeed, "transaction save" is not easy to get. And particularly not in high speed. I used to implement SAP ERP systems where we had to deal with this issue. With many thousand users creating business transactions, the speeds were mind-boggling for global systems...
And again you provide a well paced informative video.
Thank you for your time and effort here. You've got me up and running and inspired, again!
Thanks for your feedback!
Mr. Andreas thanks for your videos, are really informative and inspirational.
You are welcome!
You started to use Node Red, I waited that :) Now I just wait your next videos adout Node Red and also adout solar panels. Thank you for all!
The sun was out on the weekend (14 degrees C). So, the chance for a solar video is increasing...
Andreas, i use a lot mqqt with mosquitto on my home automation. Retain is very usefull. Let's assume your client only wakes up one time per hour, and check mqtt for messages/actions. You then send that command and it's retained in your mosquitto. But, (and that's the fun part) it's retained even if you reboot your raspberry. That way it will not loose any pending messages. ;)
This is, what I also understood. But in my video, this functionality (without rebooting the Raspberry) was also available without the retain flag set. That is, what I did not understand...
It was there, maybe, because it was sent again to mosquitto from a client that did failed sending during reboot. Is that possible? Well, i would not say you're right... but in my tests, retain was there for that :)
Not so important. I think, we both know what to do that it works, or where to look, if it dosen't ;-)
That was a good tutorial on how MQTT works. Really liked the video!
Thank you!
great videos keep em up, please continue to do thourough tutorials on mqtt and node red. its starting to get a bit easier to understand, there is a serious lack of good content on youtube. Thanks again. my friend :)
There are a few other videos with aspects of MQTT and node-red on the channel.
I think the reason why you get only 10% likes is a bug in Android RUclips application. When watching YT videos on android I have to press thumb-up icon for a few times because pressing it once or twice does not have any effect. It's not specific to your channel, it just works like this for every YT video which is a pity because I suspect YT to do this intentionally.
I love your videos and your ideas. please keep doing them this way, thanks!
Thanks for this info. I mostly use my Iphone, so I did not know.
wonderful, thanks for your time and pedagogical explanation. keep up the good work👍😀
:-)
Again a excellent video Andreas, Thanks!
You are welcome!
Finally... MQTT, Node-RED, ESP-8266, it all comes together...
Took a while for me...
Great video ... I was unclear though on where the broker and 2nd client were implemented. It seems that three processors were needed and running but I wasn't aware of where and how. Gave you a thumbs up as usual as I learned & enjoyed! Bye
There is only an ESP8266 board and a Raspberry Pi in my video. Mosquitto and Node-Red are installed on the Raspberry. I connected to Node-Red from my PC, but just, because I cannot screen capture on the Raspberry. You can use also the built-in Browser on the Pi
Great video as usual. I noticed weird characters on your serial monitor when you are testing retained flag (video: 12:53). Only last two received "payload" are OK. I tested your scenario and I got the same thing. This only happens when ESP is reset, or powerd up, when "onMqttConnect" subscribing. It could be a bug in library.
These weird stuff always comes during boot-up of the ESP and has nothing to do with MQTT
I know that, but weird characters comes when the sketch is alredy in loop and running. Look what you get in serial monitor when you pressed buttons for six thimes. First four "payloads" aren't clean. Found this link: github.com/marvinroger/async-mqtt-client/issues/35
i am very new to all things computing but found if you change Serial.begin(74800); and also the serial monitor to the same you see the esp8266 is displaying info about itself .
when started or reset button pressed
mine puts out
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8
2nd boot version : 1.6
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user1 @ 1000
hope this is of interest.
i always like your videos and recommend them to my students and friends.. i gave exactly the same youtube example to explain my students...
as always cheers and thanks for sharing the video
You are welcome!
Good video.
Recently heard about mongoose-OS for esp8266. To my surprise it took less than two minutes to setup, program and go live of an mqtt button.
Waiting to see a brief video and review of mongoose-os from you.
I also heard about it, but so far, I did not want to invest my time, because I first want to go towards MicroPython
Excellent video with good explanation as always.
Thanks!
Andreas congratulations for you channel, I enjoy it very much ! Keep it going. Cheers from a Swiss born in Brazil :-)
Thanks for the nice words!
As always.. simple and to the point videos.. No unnecessary bullshit... Can you do a secured mqtt connection?
Another viewer said: Yes. But I did not try because I have my Raspby on my private LAN
Congrats on the pending 20k subs! Keep up the great content.
My counter currently says: 19869...
Thank you for sharing information at a level that I not can only follow but build my understanding. Peter Scargill spiked my interest in IOT but much of his work is at a level that leaves me with many unanswered questions as he caters to people with much more advanced understanding than my own. I am so glad that you deal with much of the sexy stuff that he covers while bringing the required comprehension level down to that which I can build from. Keep up the excellent work. I also have a request. I purchased some capacitive light switches with 433 Mhz remote control features however the switches only toggle making it impossible, as I also have 433Mhz remote switches (toggle mode only), for Node red to determine if the switch is on or off. I thought of reading the power consumption after the switch with an esp8266 and an ACS712 but my efforts have failed dismally. If you have a solution to this I would be most grateful a video of how you manage it.
I do not like toggle buttons for automation and I avoid them. Your workaround might work at the end. But maybe it is simpler to replace the switch with one with on and off positions.
Thank you for the rapid response.
Nice work as always. I really want to get an MQQT setup for my iOT system. This video will help. Thank you
You are welcome!
MQTT is great, thanks for the video!
You are welcome!
just a comment because I recently learned this. MQTT topics don't actually have to start with a `/` and it is actually better not to include this leading slash, because it means the server has to use more memory for the empty topic '' before the leading slash.
so `/my-topic/subtopic` is not the same as `my-topic/subtopic` but `my-topic/subtopic` is apparently preferable
Yes, not starting the topic with a / is considered a best practice.
Thanks. I did not know that. So, I will change it.
glad I could help.
Could you elaborate as to the reason why it is preferable? It seems logical that it should be the other way around, as it spells out the full path!
The difference isn't relative vs absolute paths, but that mqtt paths don't actually start with a `/` so when you write `/a/b/c` mqtt has to allocate resources to keep track of 4 levels instead of the three you actually meant, because the first one is the level before the first `/`. Does that help?
LOL I love the finally - “please help me I have problems”.
:-)
'Please help me I have problems' 😂😂😂😂
Ohh Andreas, why does the wife always get the money?
Bravo, another fantastic piece of knowledge.
Andreas, I've been following and attempting to setup a database to record these values using Node Red.
To say it's been a bit confusing would be an understatement.
Could you make a video using MQTT the ESP and in the wonderful way you do show us how to record this to a simple database.
Bless you
1. Why the wives: Because we love them?
2. I am experimenting with influxDB and Grafana. But so far, was not successful. But I am keep pushing...
I Learn form you a Lot..Thank you.
Glad to hear that!
Damn you 'guy with the Swiss accent'! You've gone and preempted me - with the 'topic' of my forthcoming video (see what I did there)?. But thanks for the reference and excellent dual between Broker and UTube. I'll go back and 'like' furiously!
There is always somebody faster... But with MQTT, I am really slow. This stuff started 4 years ago on RUclips. So, nobody can blame me to be fast (the contrary might be true...).
I just got lost with all this QoS stuff and did not find a proper demo. So, I did it...
Your videos are very nicely done, BTW. And you get also likes from me...
Awesome content as usual Andreas! Can only like once per video though :-(
That is enough! Thanks.
people like me who can't be pterion supporters this is least thing you can do to your favorite channel , Also if you have joined communities on reddit or discord you can always recommend related video where possible.
Thank you, Andreas
Thank you for your help! I appreciate it.
Great video! Keep up the good work! Unfortunately last will does not work with PubSubClient library...
You still can use the Async MQTT library if it is important for you
Would be happy to use it, but Async MQTT lib has no SSL... (yet) :(
You are the best 👌 thx for your videos 👍
Glad you like my videos!
Good sir, I love your channel, you really explained a lot in an understandable manner.
A request for a short video: I'd love it if you could take a crack at the Esp8266 in regards to external resets.
Timings needed, components used and the base logics to get a successful reset. I've read about it a lot looking at solutions using capacitors and transistors to generate a negative pulse. While I do understand a lot of it, an video from you is surely to answer the last bits of questions.
+Fettkeewl Which problem do you want to solve with this external reset?
Andreas Spiess, I'm using the Esp8266 for a lot of battery powered projects. The current one is door monitoring, ie when was the door opened, what is the state of the deadbolt, locked/unlocked
I'm using a magnetic reed switch for the doors that upon opening of the door will create a low pulse on rst pin to wake up my ESP. But it only needs to create the signal when the door is opened, and not do anything whilst the door is left open or closed.
Mostly replicating circuitry from this guy
github.com/chaeplin/esp8266_and_arduino/blob/master/_48-door-alarm-deepsleep/README.md
But he leaves only the solution without, for me, a proper explanation on what is happening and how it works.
Working scenario:
1 door opens
2 esp wakes (can't be reset during operation)
3 logs time stamp and deadbolt state
4 few short sleeps to recheck states
5 sleep forever
If the solution is working, it is already good. Then, you can watch my videos about deep sleep to unterstand more about this state. Just use my ESP8266 playlist.
Thanks for another great video! I hope I can get a mgtt server up and running on the Orange pi zero I have under way. I did not plan for it when I ordered, but having seen this video, I will have to give it a try 😀
Maybe you watch my other videos about MQTT. There, you find a nice script and even a working image for the Orange Pi zero...
I have watched quite a lot of your videos already, but I do not recall seeing an orange pi, only the raspberry pi. I'll see if I can find it though :)
You are right, the image is for the Raspi, but the script worked also on a Orange Pi zero (I think, I covered it shortly in a Mailbag video)
It's probably #129, I'm just watching it :)
One bit of feedback. Could you increase the font size in your text editors/arduino IDE or use a mouse cursor zoom or something? It's a bit hard to read casually
I know the problem, but so far, I have no "magnification glass" functionality. And this time, I had to have many things in parallel. I will try to do it better in the future...
Andreas, Look into using Camtasia from TechSmith. Its what Lynda.com uses to produce ALL their videos.
I played with a pirated version from the link below. It installs and runs fine and the most powerful out there.
goo.gl/5VYTIr
I don't use it, since I don't produce any tutorial or videos, but apparently, it is the defacto of the industry.
Andreas installs MQTT EXPLORER on Windows and you will understand the retained message if qos =0. use retained only with status topics. example = stat/light/power . CMND topic only without retained!!! example = cmnd/light/power the explorer has a funktion to delete retained mesage from brocker :) i have home 30 tasmota devices :)
I use the explorer but did not know of this functionality. Thanks!
Great video!. You have a new subscriber from Spain.
Welcome and thank you for your support!
Just finished updating my script to handle the RPI Zero WIFI - and this includes setup of Node-Red, Mosquitto and MQTT etc. Found Raspbrian to be very SLOWWW - - so installed DIETPI instead for a much speedier little board. tech.scargill.net/raspberry-pi-zero-wifi/
Thanks for the link. I will try it as soon as my new Pi zero arrives from the UK...
As usual I liked it, so a simple mouse click to support your channel. Message understood ;-)
Thank you for your support!
I enjoy your videos very much as well, good job
Thanks!
Good stuff Andeas! I wonder if it's worth closing the loop with node red dashboard so that you can press a button and then visualise the feedback? (And other exciting stuff 😎)
One thing at a time... I just started with the videos about MQTT and Node-Red. Stay tuned!
Hi Andreas - another great video! I was looking at your sketch, and I had concerns about the very first function:
char* buildTopic(char* topic) {
char* hi = "";
sprintf(hi, "/%s%s", boardName, topic);
return hi;
}
Where is the memory that the sprintf() writes the two strings into? Unless I'm missing something, your function creates a pointer named 'hi' that points to a single byte on the stack, a NULL character that terminates your empty string "". Then you write the boardName and topic into this memory space (that only allocated the single byte), and you return a pointer to that new string.
First, shouldn't you allocate enough memory in your string to hold the entire new, formatted string? Otherwise, you don't know what else on the stack you're going to stomp on. It's asking for trouble.
Second, after your function returns, the variable called 'hi' goes out of scope and is destroyed. It's not good practice (it will cause random hard-to-diagnose errors) when you continue to use a variable that has gone out of scope.
Not sure if this has caused you trouble already, but I'd suggest fixing it. Maybe since there are no other variables created in this function, you got lucky that the sprintf() didn't overwrite them, and if you use the returned string immediately before calling any other function, you might get away with using an expired variable that no longer exists, but like I said, you're playing with fire.... :-) Better would be for the calling function to provide buildTopic() with a pointer to where the combined string should go (along with the size of the buffer being passed).
Thanks for your feedback. You see, I am a bad programmer (especially I do not like the lacking or confusing string handling in C++). Can you tell me, houw to do it right? Then, I will change it.
No problem -- by contrast, I'm an old-school guy who LOVES the absolute control you get with the C/C++ language, and the danger that comes with it! :-)
Whichever solution you use, what you want to do is to make sure that the memory you're writing into with the sprintf() is not a temporary variable inside the function. You also want to make sure that you allocate as much memory as you're going to need for the final, combined string.
One simple way to do the first part would be to add the "static" specifier in front of the char *hi = ""; like this:
static char *hi = "";
What that does is it allocates memory for your string in a permanent location, not on the stack. (There are better ways to solve this, though....) Don't confuse static with const. Const means that you can't change the value of the variable.
One simple way to make sure you allocate enough memory is to add as many spaces between your double quotes as you think you're going to ultimately need. Like this:
static char *hi = " "; // a long string of spaces
You should also be able to do this in a shorter way by creating a character array called hi. When you do this, the name hi by itself (without square brackets) is treated like a char *, because it's the address of the array (or the address of the first element of the array, to be specific). Like this:
static char hi[30]; // assuming you'll never need more than 30 characters
That should be enough to remove the danger in the way it was done before. Like I said, it might be better for the calling function to allocate the memory, pass this function a pointer to that memory, etc. but let's not overcomplicate things.
Keep up the good work! I have three LoRaWAN gateways being delivered to my office next week... Looking forward to getting those on The Things Network and doing more with our LoPy node devices!
Thanks for your explanations. I changed my sketch accordingly and will pay more attention in the future...
Another great video, sir! I stumbled across your channel about a month ago, and you have some really good, informative videos. The only downside is that now I want to go play with all this stuff and blow off all my responsibilities (my wife and kids would not appreciate that... 8-) I played around with MQTT, a Raspberry Pi and some Kankun plug-in modules last year, but ran out of time and never fully implemented the whole setup like I wanted to. Watching your videos has inspired me to go back to finish the project.
Are you going to do anything special for Arduino Day 2017?
I had an idea for a fun project for you to do, based off what you've done so far:
- Build a simple box that has a push button on it. The box would subscribe to an MQTT broker, and when the button is pressed, it would send a message to the broker.
- Build a simple box that has an LED and push button on it. This box would subscribe to the same channel as the first box, and when this box receives an MQTT message, it would turn on the LED. When the push button is pressed, the LED would be turned off, and if the LED changed from 'on' to 'off', the box would also send a message back to the broker to say that the button was pressed (i.e., the box would not send the message if the LED was already off).
How would this be used? Well, you build the push button box and run it with a publicly accessible MQTT server.
We, as your subscribers, would each build the LED box. Then, when you publish a new video, you just push the push button on your box, which would cause the LED on our boxes to turn on so we know there's a new video to watch. When we watch it, we push the button on our box which would send a message back to you to let you know people are watching your video (you could keep a tally of how many people have watched your new video).
Yeah, I know it's silly, but it could be a neat, simple, silly way of demonstrating how MQTT could be used across the globe. Something to think about...
Take care, and have a great weekend!
Nice idea. I once offered my subscribers to light a LED on my desk through adafruit.io, but nobody really tried... So, I still have to use RUclips to get the connections between my viewers and me...
Great vids, but a little over my head atm. Im starting to learn how to build my own smarthome, for now Im focusing on plugging in lights and using my Google home for voice control. I use the stock Sonoff fw and ewelink app. It all works great, but I would like to also use apple HomeKit switches on my devices (and not the ewelink app). I read that there is a bridge that I can install on a PI that can talk to a MQTT device (flashed sonoff), but Im worried that then I won't be able to control the sonoff with my Google home.
Could you tell me: How to setup a PI, Sonoffs to use Google Home for voice control and HomeKit switches on iOS devices (and Siri?) also?
Thanks
I think you experience the frustration of many home Automation users: Incompatibility. For the moment I do not know an easy way out. So far, I do not own a Google home, just an Alexa. So I do not know how to connect it to a Raspberry or to MQTT. Maybe you find information on more "home automation" related channels.
Andreas, Do you have any tutorial on how to flash ESPurna firmware on a Sonoff switch?
Hi Andreas and the rest! Quick question, in the long run, would you recommend the PubSub (knolleary), the PubSub (Imroy), or the Async? Or another one. Cheers!
I have no preference. I used the "knolleary" and the "async". Both worked.
Andreas Spiess Thank you!
QoS 2 may be important for counting occurrences of a specific event.
That is right. Did not think about that.
Hi Andreas! Thanks for your great videos! I'm a new fan of Wemos d1 mini and Blynk ( and obviously of your channel) . Can you point me a video or a guide that help me in the comprehension of Blynk or MQTT and Node Red .. I must start from basis! Thank you in advance !
So far, I never used Blynk. Just google node-red or MQTT and you will find many interesting tutorials. It depends also a little on how much you are in Linux.
If you watch my videos about the topics, you will find a link to a script and even an image for a raspberry Pi which includes all needed stuff. It usually works out of the box.
@yt great idea to explain mqtt!
I liked ;-)
Thanks for your support!
Hi Andreas, one question. I am trying to connect my ESPs to two different brokers, one is local (raspberry pi) and the other one is on Internet (ubidots). Both are using PubsubClient library. I have noticed that even having them in different ports, they keep connecting and disconnecting. I have tried having different options like creating different PubsubClient instances and even with different WifiClient instances with no success, they keep disconnecting and connecting. Is there any solution for this problem? Thanks and keep on the good work.
I do not know if this scenario is supported by the pubsub library, but I never heard of anybody using this scenario
Hello Andreas,
do you know a good Tutorial or Video how to change a buttons background color or even let the "switch" at node-red dashboard change its state when i change a leds state from other place?
If you create a switch at node-red, place it at the dashboard and turn on the led with that switch, you can turn off the led with a smartphone with another app (for example) and the switchs state will still be "on".
So there have to be a function to let the switch change the state also when you send a message from another place.
thanks
I am not a Node-red specialist and do not use it with the dashboard. So I do not know.
#include where does this come from or what does it look like pls?
I just have my credentials in this file to not share them on github. So, you can delete this line. I think, the newest version of the sketch is already corrected.
okay - it was the format not the content that I had expected - will go back and look - thanks
+Richard Wenner just two #defines: #define mySSID and myPASSWORD. Nothing more
I really like using retained messages for purposes like this, because then, when I power on the device again, it immediately recieves a message with the current state from the server. This works even with QOS 0. I wonder what you think about it.
In my video, you see, that this happened also with retain=false. So, I saw no difference...
I know that the retain flag works properly in mosquitto, but it is possible that the async library is not handling it properly. I don't think I have used arduino + MQTT, so I'll have to check.
Hello Andreas i have a question I know it is possible to all this withou using MQTT what are the other options? I know you can do it with a raspberry pi and ESP8266 link over different or the same networks.
You can use web services (like REST APIs). But I think, MQTT has lots of advantages if you want to do machine-to-machine communication
have you ever work on android broker such as moquette or something like that ?
No. Only with Mosquitto
Great tutorial! Thanx
You are welcome!
Grüezi Andreas Ich hab ein kleine frage ich hab in Zurich mein Balkon mit pflanzen :D ich hab gerade dein tutorials gebraucht um mein relay zu steuren fur mein wasser tonne funktioniert mit handy aber jetz wol ich ein billige soil sensor brauchen um zu schauen ob my pflanzen überhaupt wasser brauchen
Ultiem solte natürlich sein Soil Messure und Wasser Pumpe activeren und mit zeit und wie lang der pumpe must laufen
bin gerade and shauen ob ich episode #71 kann brauchen Wetter vorslag veileicht fur andere leute
Ich wolte gerne dir noch danken fur diese supi channel wo ich viel lerne
Btw ich wolte alles standalone bauen :D
Schönes Projekt. Viel Vergnügen und Erfolg!
another great video!
:-)
I am trying to follow this i downloaded your sketch and added the libraries but cant work out the error #include no such file or directory how
Just delete this line and add the credentials in your sketch.
Hello!
I manually installed the AsyncMQTTclient libary (because i din't find it :/ ) but after it arduino stell need some other *.h and dont want to compile.
Can you help me how to install dependencies at arduino ide?
Thank you!
Usually, it is quite easy to find the needed libraries using Google.
The red thing on your esp board, is that blood?
Yes. It is bull blood to make it stronger ;-)
Actually, It is just a mark (red, blue, green) for my different boards, because I often use them with IOTappStory.com. Then, I do not want to lookup the MAC address everytime I use another board.
Good job.
:-)
Can't see text (code part) pls zoom in particular window when you explain.
And keep up the good work.
Unfortunately, I have no software to zoom in :-(
@@AndreasSpiess Cntrl + Plus or Mouse Scroll. Works on chrome as well as arduino ide :)
But only for the whole screen. This is what I already do. My normal screen is 4K and for programming screens I only use 1200x1000. If I go lower the overview is lost.
pubsubclient only supports QoS 1 & 2 when I checkade last timme.
I think, QoS 0 is default and it supports also this mode. I always used QoS 0 with this library
supose there are 4 devices 1 sender, 3 receivers(r1,r2,r3 all subscrbing to same topic t1). sender 1 publishes to t1. and r1 is online connected to broker. but r2 and r3 are offline or lost power so went offline.
will broker send r2, r3 all messages that were sent by sender?
if r2 comes online before r3. will r3 be servered with same messages that it missed?
In QOS1 or 2, the broker will make sure each subscriber will get its messages.
HI, i am having problems with tasmota firmware being able to receive the value of a bmp180 sensor attached to my sonoff, BMP180 is connected up and works i can see the temperature,baro pressure on the webinterface with no problem and updating in realtime, I want to be able to view this data on my android device and have installed mqtt dashboard, this gives me buttons where i can turn on and off lights alter led colors etc these work great, i am using a cloudmqtt server... the only thing i cant seem to get right is be able to display the temperature on mqtt dashboard android i have parsed the json sring and got a value but no way will mqtt display the temperature surely it cant be this hard to get temperature on my android phone...? Please Help...
Show less
REPLY
Unfortunately, I do not know Tasmota and hardly use Android. Maybe you experiment with transferring artificial data via JSON to find the right format which displays a number on the smartphone.
got this working now.... thanks i found the correct .json string and it works.
:-)
Great video as always! does someone knows how to store mqtt messages in a database? and what will be the best database for Raspberry Pi? thank you!
Adrian Hein Node-Red opens the door to Postgres, MySQL, MySQL lite, flat files. I use Postgres on a Raspberry Pi. But you could also run a cloud server running Postgres and push your messages using MQTT.
great! Thanks for the advice
Dear Andreas.
Question: The payload coming from my device {"ON"} doesn't have the exact format required by the IoT platform that I am using {"value": "ON"}. This means that I will need to modify/adjust the msgs coming from the devices before sending them to the broker (hosted by the IoT platform that I use).
Any idea how to do this? I found this: github.com/robertsLando/Mqtt2Mqtt
Any other recommendation? Thanks!
You have to change the device or include a translator like node-red.
Nice video.
:-)
My mqtt client disconnects and reconnects at particular interval.
So I assume you have to find the error. Make sure you have a stable power supply.
You still only have a 10% like rate for this video unfortunately I can only like it once. My question is I'm running power over Ethernet to an esp8266 so I might as well run data to the esp8266. How would I connect it so that I can use it over my network instead of the WiFi?
I do not know that the ESP8266 has Ethernet pins. So Wi-Fi is probably the best way
@@AndreasSpiess I believe there is an Ethernet shield for it so I should only need a sketch to run it.
Is it possible to somehow use ssl on esp8266 mqtt?
Satanizo Just use WiFiClientSecure and the SSL port of the broker.
Thanks for the tip! Will there be enough memory?
I think so
You should be more specific when you're talking about programming an ESP8266 or ESP32. Micropython, lua, Arduino or espressif API are all programming options for the ESP modules.
For the moment, I use ESP8266 and Arduino IDE for all of my projects. All Sonoffs have this chip. And I use Arduino IDE .You see it here: 15:52
I "liked" your video. To improve your video, next time zoom in to your sketch for better readability. Not everybody has a really big monitor. Keep posting!
I know the problem, but so far, I have no "magnification glass" functionality. And this time, I had to have many things in parallel. I will try to do it better in the future...
Hallo Andreas, hast Du Dir schon mal TASMOTA angeschaut? github.com/arendst/Sonoff-Tasmota. Das scheint eine extrem coole Lösung zu sein. Hier sind viele Dinge sehr professionell gelöst
Nein, noch nicht. Ich experimentiere im Moment mit Espurna von Tinkerman. Aber ich werde mal in TASMOTA reischauen...
also there is an orange pi wifi for £5 on a site i saw last night i might do a vid on it if you sub it may help you out with loads of cheap new parts :)
A Orange Pi Zero is already in the mail. But as a Linux beginner, I like the Raspberry community.
I don't like rPi zero, because you can buy 1 piece/buy. Instead I recommend Orange Pc, specially the Orange Pi Zero.
I also do not like the limitation and I ordered also a Orange Zero. But as a Linux beginner, I like the big Raspby community.
Ich würde auch zwei Daumen hoch machen (wenn das ginge), wenn die Videos in Deutsch wären.....
Vielen Dank! Die Videos sind in Englisch weil global fast niemand Deutsch versteht. Und von denen verstehen noch fast alle (technisch orientierten) Englisch. Und meine Muttersprache ist es ja auch nicht. Wir Schweizer verstehen zwar Deutsch, aber wir sprechen es nicht ;-)
Great Scott ist ja selbst Deutscher und macht seine Videos ebenfalls in Englisch.
Yes, get people to turn off autoplay as they will never get the chance to like.
liked
:-)
I build a simple example how to make a Sonoofff/LCH switched to a IoT platform and make them secure and really private : github.com/i4things/NodeAPI/tree/master/examples/ESP8266-01/1CH_RELAY/thing
Thank you for the link
LOL my wife get all my money.
how about open up a 'Patreon' account for your channel?
I am thinking about Patreon. Maybe. For the moment, I still can afford my hobby...
do NOT use asyncMqttClient!!!! It is seriously broken, see rhe recent post on its github. I have written a replacement that works, its in alpha at the moment, but will be released soon.
I also had troubles with it in my new project. I use pubsub and it works .
Re my previous comment: I'd be very grateful if you would try my replacement library: github.com/philbowles/asyncmqtt
Thanks for the link!