Connect to single Access Point

How can I force esphome to always connect to a specific access point and not roam or get stuck to a faraway one.

I’ve added the below but it seems it still randomly connects top whatever it scanned first.
wifi:
networks:

  • ssid: !secret wifi_ssid
    password: !secret wifi_password
    hidden: True
    channel: 6
    bssid: XX:XX:XX:XX:XX:XX

Not helpful considering I’ve already looks at that.

Look harder then…

very helpful

wifi: 
  ssid: MyHomeNetwork 
  password: VerySafePassword

Whats that your specifically telling it to connect to? Looks like a specific connection doesnt it?

Not sure if you are running managed access points that work together or individual ones.

If you are using managed access points that all work together, you can usually pin a wireless client to one access point. Check your documentation.

If you are using multiple ones that do not talk to each other, you might check your documentation and see if you can block that MAC address on the access points you don’t want it to connect to.

Either way, you should not be doing this on the client end. It should be on the access point end. Without knowing what access point(s) you are using, that is about as far as I can go on this.

Thanks for a helpful comment, using a couple managed APs with the same SSID. Most devices connect the closest AP, except these esphome devices. The APs are setup to drop a connection when the connection is poor but esphome devices keep connecting to the wrong ones.

The APs have no way to lock devices to a specific AP, apparently that is a feature that supposed to come via firmware update.

You could try to blacklist those devices on your “wrong” Ap.

But they don’t have cloned MAC’s so all have different BSSID’s, correct? :thinking:

Something like this: :point_down:

with one bssid specified should then actually do it.

Prioritizing could do the trick here, the linked docs got you covered :bookmark_tabs:

1 Like

You could perhaps do it the other way around, force the esp to connect to the specific AP through the network software. I know at least Unifi supports this.

Are your access points using different WiFi channels? (they should be)

The ESPHome docs on multiple networks suggest that you need multiple entries for the signal comparison to work. But docs also say that when using hidden AP you must use fast_connect which stops signal comparison. You may also try adding priority e.g. (I have not tested this.)

wifi:
  fast_connect: True
  networks:
  - ssid: !secret wifi_ssid
    password: !secret wifi_password
    hidden: True
    channel: 6
    priority: 1 // Highest one connects first
  - ssid: !secret wifi_ssid
    password: !secret wifi_password
    hidden: True
    channel: 1 // note different channel
    priority: 0

Anecdotally I use OpenWRT Access Points and they have option “Disassociate on low” which was causing more problems then solving. I saw devices attempting to connect multiple times to distant AP (-90Db) and failing. When I turned it off I could see that devices would connect to distant AP but once associated would switch to a better signal AP typically within 15-45 seconds.