It compiles fine, but when I try to access 192.168.0.123 having connected to the AP, regardless of browser, I get a “You are not connected to the Internet” message.
I appreciate that this will mainly be down to my lack of understanding of all things network, and I would appreciate any help to point me in the right direction.
Your computer/browser test if you have internet access by trying to connect to some server on the internet and that will of course fail here.
This does not mean you do not have WiFi access to the ESPHome device’s AP.
You are getting confused between two different uses of the ESPhome WLAN component and radio:
WLAN client - connects an ESPhome device to your WLAN network in the same manner as a phone or tablet.
The ESPhome device will usually get an IPv4 address from your network’s DHCP server (although static addressing is supported).
WLAN AP (Access Point) - if the ESPhome device can’t connect to a WLAN AP (sometimes called a “hotspot” or “server”), it can configure itself as an AP so you can temporarily connect a phone to it and change the configuration through a captive portal
The ESPhome AP includes a WLAN AP, DHCP server, and Web server to allow a phone to connect, and change config via HTTP. The IPv4 range used by the ESPhome DHCP server is irrelevant - this is only used to change the configuration and connect the device to the “proper WLAN AP”.
Setting the temporary captive portal DHCP server to the same IPv4 range as your “proper” LAN may be confusing for client devices, but should work as they are two different physical networks.
ESPhome wifi: => “Proper LAN AP”
ESPhome ap: <= “Captive portal”
wifi:
# Connect to an existing wifi access point
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${name} Fallback Hotspot"
password: !secret fallback_ap_password
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
It’s normal, when you set your Esp in AP mode, there is no internet.
Explain what you try to accomplish, Esphome doesn’t allow simultaneous Station (connected to internet) and AP modes.
And if you try to setup web server, don’t enable captive_portal mentioned above.
I’m using this as a standalone device without any connection to any wifi.
I just connect to the AP using 192.168.4.1 (the ESPHome default) and I then access the webserver to make changes as required or upload new firmware via OTA.
This all works great.
I am trying to simply change the IP address from 192.168.4.1 (the ESPHome default) to something of my choosing.
That’s what I would have thought, but I can’t access the device. I just see the “You are not connected to the internet” message when entering the defined IP address.
From my reading of the docs, this should be possible, though I may be misunderstanding it.
ap** (Optional): Enable an access point mode on the node.*
ssid** (*Optional*, string): The name of the access point to create. Leave empty to use the device name.*
password** (*Optional*, string): The password for the access point. Leave empty for no password.*
channel** (*Optional*, int): The channel the AP should operate on from 1 to 14. Defaults to 1.*
manual_ip** (*Optional*): Manually set the IP options for the AP. Same options as manual_ip for station mode.
You should get the same warning for internet even with default 192.168.4.1
Maybe your mobile device tries to connect to previous ip-address saved in memory for that ssid?
As to my understanding, an AP is its own gateway. So you should choose perhaps 192.169.0.1 for the static ip. (As to my understanding a gateway is a router or something similar, i.e. a second device which you don’t have).
That’s how I see it also.
I don’t think I have ever been defining gateway for Esp in AP mode (not tried in Esphome).
The issue of OP might be something else though.
@mabe I gave this a try. Same result. “No internet” message
@Karosm Yes, I uploaded via USB. Both gateway and subnet are mandatory for compilation.
As soon as I revert back to an ‘unconfigured’ AP and use the default 192.168.4.1 all is fine.
The docs suggest that this is doable but I’m clearly missing something. I get the same "No internet’ message with three different browsers and two different devices.
There’s something about the way the AP is working when manually configured that is stopping this from working.
The ap_timeout option suggests that I could start the access point from a binary_sensor, which would be a viable alternative, but there’s no more info on how to do this.
I was curious and set up a Wemos D1 mini (ESP8266) for testing with LED and button to toggle the LED.
I used an old phone to test the AP: Everything is as expected. I get the same webpage as with the default AP network and toggling the LED with the button works as well:
I don’t understand where your problem is, but I wouldn’t use that message as an indicator for it. I get that message when I first time connect to any AP that doesn’t offer internet connection.Even if I connect successfully.