In Home Automation Tutorials Edition 4, there are two EspAsyncWebServer projects, one displaying the pressure, humidity, temperature, and gas remotely and the other one toggling a LED with button and displaying its state remotely.
How may I combine these two projects in one and if there is any sample code?
There isn’t any sample code for that you are trying to do.
You can try combining both projects.
First, start by creating the HTML text to build the web page you want. And then, you just have to try to merge the code for both projects.
I can’t create the code for you. But, I can help you if you have more specific doubts.
I was combining both projects before I sent you an email. I was getting weird issues such as runtime “stack over flow” and compile issue such as “function type is not defined” and I could not find any solutions for any of them even though others have experienced the same problems. However, after getting your email, I was then confident it was the correct way to combine two projects with WebSockets. One creates a websocket as a server and keeps sending events for temperature, humidity, etc and the other one creates button events and therefore a combination of both projects will create a full duplex communication. I am using ESP8266 and finally got it to work.
Now, I would like to make it to control from anywhere and any Network but in a professional way. In your eBook you mentioned about ngrok tool. Unfortunately, it is not a safe tool and I cannot connect to my device with my cell phone, and through my pc browsers it does not allow me due to unknown server alert. I know to create a tunnel to your router you also could set you DNS on your router but now sure if is the right way, you also mentioned about MQTT and cloud MQTT in your tutorials. I was wondering what is the best way to access your device over the websocket or web page from any device (client) in the world. I even not sure about the WebSocket or WebServer. I know there are home thermostats, or remote power switches, or garaged door openers as an example that can be controlled from anywhere. These devices accompany with an App to be installed on your cell phone probably to configure the device with your routher information or network information on your cell or even create automatically the DNS. Do you know how the access to these devices over the WiFi works? I would appreciate if you would direct me to the right direction.
- what exact message do you receive? Is it from your anti-virus?
If you are using an anti-virus, it will likely not recognize that domain from nogrk.io and send you an alert message. It doesn’t mean ngrok is unsafe, it just means your anti-virus is to sensitive to unknown domains.
Doing router port forwarding and setting up a DNS service is way more unsafe than using ngrok.
Thanks for your patience!