Hello, thx for reply.
First of all, i want to say that You did GREAT JOB with this project- RANDOMNERD TUTORIALS!!!
I combined you2 examples- password protected webserver and MQTT Project- MQTT CLIENT ESP32 #1
All works GREAT except that WEB SERVER USE ETHERNET BUT THE MQTT USE WIFI- AND I CANNOT MAKE IT WORK BOTH ON ETHERNET
Need your help to make MQTT working on ethernet
Thank You
I understand now. Thanks for providing all the details Vitalie. Unfortunately I don’t have one of those boards myself, so I can’t actually test anything or ensure that it works.
As you’ve mentioned it’s quite easy to setup a web server with Ethernet: https://forum.arduino.cc/index.php?topic=626891.0
However, I don’t think the MQTT library works with Ethernet… I think this library will only support Ethernet on Arduino shields: https://github.com/knolleary/pubsubclient
Can you ask the board seller, if they know MQTT Ethernet integration for that board?
Thanks!
Thank You for reply. think need to make few changes to MQTT library to make it working on Ethernet- like W5100 works great with pubsubclient
You might try to run this examples that uses Ethernet: https://github.com/knolleary/pubsubclient/blob/master/examples/mqtt_basic/mqtt_basic.ino
I’m not sure, but it might work with small changes in the initialization
i make changes to your project- “MQTT CLIENT ESP32 #1” to be working on ETHERNET!!!! So its possible. I just want to HELP ME TO COMBINE YOUR 2 PROJECTS- “PASSWORD PROTECTED ESP32 WEBSERVER & EDITED BY ME ( that WORKS MQTT ON ETHERNET- YOUR PROJECT-) “MQTT CLENT ESP32 #1
Need your help to COMBINE THAT 2 PROJECTS
Rui, In few words- what i need- to add mqtt publish/subscribe to buttons from the project “PASSWORD PROTECTED ESP32 WEBSERVER” to can PUBLISH and SUBSCRIBE buttons to MQTT topic messages- EVEN ON WIFI, i will make changes myself to make it working on Ethernet- BUT WILL BE VERY HELPFULL IF YOU JUST COMBINE YOUR 2 PROJECTS THAT I WAS DESCRIBED ABOVE ( OR add to project “Password Protected esp32 webserver”- an option to Publish and Subscribe to MQTT TOPIC
Please NEED YOUR HELP!!!
Hello again, thank you for the detailed explanation. As I’ve mentioned before unfortunately I don’t have that exact board and I can’t do custom coding due to time constraints.
When you tried to combine the code, is it compiling? Are you receiving any errors? What’s exactly not working?
If you provide error messages, I might be able to help you make it work!
Thanks for your patience.
Hello. Thank You for reply. I have not combined, i take your project “PASSWORD PROTECTED ESP32 WEBSERVER” and added MQTT publish/subscribe and i made few changes to library to can use it by ETHERNET. All is working!!!
What i want to ask you- TO ADD AJAX TO YOUR GREAT PROJECT “PASSWORD PROTECTED ESP32 WEBSERVER”- mean the buttons to change status when pins 26 27 change his statuses, also if the 26 27 was changed by MQTT or url- from browser- THE BUTTONS TO CHANGE STATUS TOO- IN ANY WORDS TO ADD AJAX TO THAT 2 BUTTONS. Will waiting for your quick help!!!
That’s a bit tricky to setup… It should possible to do it, but even though MQTT is a two way communication, it can interact directly with your JavaScript variables in your web page.
You could use AJAX to change the button state when pressed on the web server, but I don’t know/have examples on how to update the button with Ajax upon changing the state with an MQTT publish…
The best way – is to monitor 26 27 pins. When pin change status (low to high or high to low)- doesent matter from what source- mqtt url webpage button press- the web servers button- change status too
Yes, but it’s hard to push that information to the ESP static web page. You will need to constantly request the current state of your GPIO using AJAX to know if has changed state or not… It’s possible to do it, but I’m not sure if your web server will be reliable with so many requests