I have been looking for guides and I have come up with a light switch which I can controll from my phone (Via WiFi) Which works. But now I tried to controll several devices (Slaves), but that does not seem to work for me.
The two devices should be controlled from the Master webpage(ip).
The Slave switch work it self, so when I press the switch from the slaves webpage it clicks, but not from the masters webpage.
I dont know what to do and need help with getting the slave to to work from the Master webpage.
Thanks in advance.
The ESP32-modules offer a much simpler to use wireless communication protocol called ESP-NOW.
My sugestion is: the master coomunicates with the slaves through ESP-NOW messages which would be as simple as
"Relais1On" "Relais1OFF" instead of all these HTML-tag-hassling. Though something new to learn how ESP-NOW works.
You keep the masters-website and design the masterwebsite that way that ESP-NOW messages are send to the slaves.
The slaves can also send back ESP-NOW-messages to the master so it is poosible to request the status of the slaves.
If you would like to stay with the html-code and want to switch something on a slave through the master
the master must do the exact same thing as if you are clicking on the button on the shown website.
a command like
digitalWrite(pin, !_state);
acts on the IO-pins of the master. Not on the IO-pins of a slave
You have two ESP32 based devices. Each run a web server and control their own relay. The web server is contacted over a phone based browser. That all works.
You have another ESP32 based device (the master). That serves up a web page for controlling the two slaves.
Is that about right ?
How is the master connected to the two slaves ? Physically over a pin on the master or over a wifi connection ?
If it is over a wifi connection, what does the URL look like which the master issues to the slaves to operate their relays ?