Giter VIP home page Giter VIP logo

Comments (5)

martin-ger avatar martin-ger commented on August 21, 2024

The ESP in WIFI_AP_STA mode has two IP addresses, one for the STA interface and one for the SOFT_AP.

The SOFT_AP interface is typically 192.168.4.1, the DHCP-server on the ESP distributes addresses in this subnet to its clients (in you case the temperature sensors).

The STA interface receives its address via DHCP from the uplink AP (Home Router). This should be different from 192.168.4.x (otherwise you have to change one of the networks).

The MQTT broker is accessible via both interfaces and IP addresses, i.e. your temperature sensors can connect their MQTT client to 192.168.4.1 port 1883. An external Android App has to connect to the address assigned by the home router. mDNS is not supported by Android as far as I know. But typicall the home routers remember their DHCP leases and use the same address every time. Another option would be to assign a static IP address to broker in the uplink network (outside the range of it DHCP server). Then you have well known fixed address there as well.

from umqttbroker.

hjindr avatar hjindr commented on August 21, 2024

Hello Martin, thanks for the fast reply.
For me is possible to connect to the broker only with STA IP address - othervise the temp sensor connects to AP(192.168.4.1) succesfully and get IP 192.168.4.2 but the MQTT broker connection failed -, rc=-2 (I use PubSubClient.h)
Seems like the broker is running only with STA IP address - otherwise I am doing something wrong.

from umqttbroker.

martin-ger avatar martin-ger commented on August 21, 2024

from umqttbroker.

martin-ger avatar martin-ger commented on August 21, 2024

from umqttbroker.

hjindr avatar hjindr commented on August 21, 2024

Hello,
I must manually configure the SOFT AP IP, Gateway and subnet and it starts working
Use WiFi.softAPConfig(local_ip, gateway, subnet); before starting soft AP.
Regards Jan

from umqttbroker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.