ESP32 device and wifi repeater


I am new in the HA community and I have already configured a lot with the help of this forum but I am facing an issue I can not solve myself so I need your help

I have HA installed on a raspberry pi 4 connected to my router via ethernet (address of my HA:

I use an ESP32 to get some binary sensors for HA. I have configured this ESP32 on my wifi network and it works.
Problem, the installation location of the ESP32 is too far from my wifi network and I need to extand it. So I use another ESP32 to make a wifi repeater (GitHub - martin-ger/esp32_nat_router: A simple NAT Router for the ESP32).
The repeater is also working fine. I can connect my phone to the generated AP and I have internet access and local network access.
So I changed the configuration in ESPhome to connect to the wifi repeater instead of the wifi router. Since then I am no able to get the binary sensors working.

I suppose that there is a configuration issue due to the IP addresses used. My local network has IP: 192.168.0.XX and the repeater the address: 192.168.4.XX

Right now the binary sensors are connected on the address (I can see it in the ESPhome logs)
Why are the binary sensors data not coming to HA? Should I configure my router to redirect some ports?


I cannot say I a super expert on the type of TCPIP ‘pipes’ that a ESPHome device requires between itself and the Home Assistant server, however in my quick look at the documentation for the ‘wifi extender’ software you are running on the ESP32 in the middle, I see it being called a ‘NAT Router’. Any time you are traversing data packets via any type NAT device you are trading off some TCPIP functionality for ‘other’ features such as firewalling, private address use/translation and others. I wonder if some of this is blocking your traffic.

Have a look at this thread and possible answer:

Good hunting!

1 Like

You cannot tell HA to connect to an ESP behind a nat. That is just not how networks work. NAT by design makes it impossible for machines on the “public” side of the NAT to connect to machines on the private side.

Buy a cheap wired/wireless AP / wireless repeater and extend your network that way.

I found already this topic but I was unable to configure my repeater. The repeater software used in this topic is for an ESP8266. I have an ESP32 so it is another software which is a bit different.

If I understand well, I need to buy a wifi repeater with an ethernet connection. I connect via ethernet the repeater to my internet box and configure a new access point. Am I right? If yes, it will be better to have an ESP32 with an ethernet port. I will then direct connect the ethernet cable if I need to use one anyway

I am not versed in this firmware, however a quick look at it’s github page seems to show that it has port mapping functions. I would recommend you ask directly at this github page for specific support:

portmap  [add|del] [TCP|UDP] <ext_portno> <int_ip> <int_portno>
  Add or delete a portmapping to the router
     [add|del]  add or delete portmapping
     [TCP|UDP]  TCP or UDP port
  <ext_portno>  external port number
      <int_ip>  internal IP
  <int_portno>  internal port number

While the esp32 tool you found seems to be nice low cost point solution, you might want to consider investing in a wifi hub solution that offers stronger and wider coverage. Either a single strong wifi hub or one of the wifi ‘mesh’ systems that are available. Having a solid and easy to manage wifi infrastructure is very helpful for your adventure in home automation.
Good luck!

Thank you for the info. I have posted on the github page. If I get it working I will post the solution here too. Maybe it can help someone else.

I don’t want to invest in a wifi hub. The wifi network is the one from my internet provider’s box. I know it is not the most powerfull network but it is enough for my home. I want to use an ESP32 to monitor my mailbox to know if a letter or a packet is delivered. I made some test and the ESP32 is loosing the wifi network 3 meters before the mailbox (my phone catch the wifi network at the mailbox). So I wanted to try with this cheap DIY repeater

There are $10 WiFi repeaters that don’t even need xablid, they just need power. You are wasting way more than $10 engineering a solution out of seriously inadequate stuff.

I have finally created a new AP with an TP-link wifi repeater and it is working fine. No need to fight with the ESP32 repeater.

Which is no repeater but a technically a NAT router :warning: