Access Point on Raspberry Pi OS - esp32 won't connect

Hello,

I will try to configure Access Point on Raspberry. But my esp won’t connect. There’s a problem with “Power Management”

It looks OK when:
On Raspberry set: nmcli con modify $CONN_NAME 802-11-wireless.powersave 3
And on esp:

wifi:
  power_save_mode: NONE

Of course the phone and laptop connect without problems.

But when i want to use bluetooth

  power_save_mode NONE is incompatible with esp32_ble_tracker. Please remove the power save mode. See also https://github.com/esphome/issues/issues/2141#issuecomment-865688582.

This is my Wifi configuration:

#!/bin/bash
CONN_NAME="RPIHotspot"
AP_SSID="RPI"
AP_PASS="RPItestRPI"
AP_IFACE="wlan0"
nmcli con delete $CONN_NAME
nmcli con add type wifi ifname $AP_IFACE mode ap con-name $CONN_NAME ssid $AP_SSID
nmcli con modify $CONN_NAME wifi.band bg
nmcli con modify $CONN_NAME autoconnect yes
nmcli con modify $CONN_NAME wifi-sec.key-mgmt wpa-psk
nmcli con modify $CONN_NAME wifi-sec.psk $AP_PASS
nmcli con modify $CONN_NAME ipv4.method shared
nmcli con modify $CONN_NAME ipv6.method disabled
# Disable: 2 - NM actively disables power save
# Enable: 3 - NM actively enables power save
# Ignore: 1 - NM ignores power save settings
# Default: 0 - NM uses the globally configured value (in NM)
nmcli con modify $CONN_NAME 802-11-wireless.powersave 3

Does anyone know how to solve the problem?

Was there a reason for having the power_save_mode within your YAML? It isn’t a requirement, what happens if you remove?

Just follow the instructions.

without power_save_mode i have 80-90% packet loss to esp32

  • NONE (least power saving, Default for ESP8266)
  • LIGHT (Default for ESP32)
  • HIGH (most power saving)

I think you’d be better investigating your packet loss issues. You haven’t posted your full yaml which would help but I don’t suppose you are trying to implement BLE tracker are you and have the following in your config?

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms

If so remove the lines with interval and window from your file, 1100 is for wired Ethernet.

Otherwise show us your YAML

Andy

I am currently in a different location. I did a similar test.

AP configuration:

#!/bin/bash
CONN_NAME="RPIHotspot"
AP_SSID="RPI"
AP_PASS="RPItestRPI"
AP_IFACE="wlan1"
nmcli con delete $CONN_NAME
nmcli con add type wifi ifname $AP_IFACE mode ap con-name $CONN_NAME ssid $AP_SSID
nmcli con modify $CONN_NAME wifi.band bg
nmcli con modify $CONN_NAME autoconnect yes
nmcli con modify $CONN_NAME wifi-sec.key-mgmt wpa-psk
nmcli con modify $CONN_NAME wifi-sec.psk $AP_PASS
nmcli con modify $CONN_NAME wifi-sec.pairwise ccmp
nmcli con modify $CONN_NAME wifi-sec.proto rsn
nmcli con modify $CONN_NAME ipv4.method shared
nmcli con modify $CONN_NAME ipv6.method disabled
# Disable: 2 - NM actively disables power save
# Enable: 3 - NM actively enables power save
# Ignore: 1 - NM ignores power save settings
# Default: 0 - NM uses the globally configured value (in NM)
nmcli con modify $CONN_NAME 802-11-wireless.powersave 3

My yaml with bluetooth:


substitutions:
  external_components_source: github://syssi/esphome-jk-bms@main
  mac_address: C8:47:80:28:B7:97
  # Please use "JK02_24S" if you own a old JK-BMS < hardware version 11.0 (hardware version >= 6.0 and < 11.0)
  # Please use "JK02_32S" if you own a new JK-BMS >= hardware version 11.0 (f.e. JK-B2A8S20P hw 11.XW, sw 11.26)
  # Please use "JK04" if you have some old JK-BMS <= hardware version 3.0 (f.e. JK-B2A16S hw 3.0, sw. 3.3.0)
  protocol_version: JK02_32S

esphome:
  name: testwifi
  friendly_name: testwifi

esp32:
  board: esp32dev
  framework:
    type: arduino

external_components:
  - source: ${external_components_source}
    refresh: 0s

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "ARJ/PzF+AnvBnFeJrHyNc8sRaX9Fs6vFV0uhUWAtBZE="

ota:
  - platform: esphome
    password: "e42ddf56f574ec92d04971e536d5e705"

wifi:
  ssid: RPI
  password: RPItestRPI

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Testwifi Fallback Hotspot"
    password: "0WNYzOmX5Qec"

captive_portal:

ble_client:
  - mac_address: ${mac_address}
    id: client0

jk_bms_ble:
  - ble_client_id: client0
    protocol_version: ${protocol_version}
    throttle: 5s
    id: bms0

binary_sensor:
  - platform: jk_bms_ble
    balancing:
      name: "${name} balancing"
    charging:
      name: "${name} charging"
    discharging:
      name: "${name} discharging"
    online_status:
      name: "${name} online status"

sensor:
  - platform: jk_bms_ble
    jk_bms_ble_id: bms0
    total_voltage:
      name: "${name} total voltage"
    current:
      name: "${name} current"
    power:
      name: "${name} power"
    charging_power:
      name: "${name} charging power"
    discharging_power:
      name: "${name} discharging power"

ping test from rpi:
ping -c 100 10.42.0.122

— 10.42.0.122 ping statistics —
100 packets transmitted, 59 received, +36 errors, 41% packet loss, time 123962ms
rtt min/avg/max/mdev = 12.165/1149.313/14481.120/3475.946 ms, pipe 6

simple yaml:

esphome:
  name: testwifi2
  friendly_name: testwifi2

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "W0KngbNsp650RxrRQSfSYs8Nt8+NtP5EX48MLkBC8gE="

ota:
  - platform: esphome
    password: "556977db5c689a06586de78ab3be141c"

wifi:
  ssid: RPI
  password: RPItestRPI

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Testwifi2 Fallback Hotspot"
    password: "5FKY9bFWypVB"

captive_portal:

ping test result:
— 10.42.0.122 ping statistics —
100 packets transmitted, 71 received, +14 errors, 29% packet loss, time 133046ms
rtt min/avg/max/mdev = 12.303/782.654/16126.911/3020.881 ms, pipe 9

when add power_save_mode: NONE

ping
— 10.42.0.122 ping statistics —
100 packets transmitted, 100 received, 0% packet loss, time 99167ms
rtt min/avg/max/mdev = 3.388/5.614/21.047/2.704 ms

Response times are much faster and there are no packet losses

It’s probably something with the new RPI OS (bookwork) and NetworkManager. When I configured the AP on the old RPI OS (buster) using dnsmasq and hostapd I had no packet losses.