ESPHome weird disconnection situation

Hey everyone,

I ran into this weird situation today. I have 3 devices connected to a WiFi AP - 2 of which are esp32c3 mmwave occupancy sensors and the other one’s a esp32s3 relay. The power to the site was down for a couple mins earlier today and so all devices had to reconnect with the AP (even the main router restarted after the power failure so all ip addresses were reset). The relay was pretty quick to connect, but I’m not sure what’s going on with the mmwaves. I see the values - but they’re not changing. It’s still. The values ALWAYS change every few secs. HA doesn’t even show them as Unavailable. So weird.

Here’s the esphome yaml for one of the mmwave sensors (the other’s is pretty much the same - just the name change):

substitutions:
  name: "mmwave1"
  friendly_name: "mmwave1"

esphome:
  name: "${name}"
  friendly_name: "${friendly_name}"
  name_add_mac_suffix: true
  project:
    name: "mmwave.1"
    version: "1.0"
  platformio_options:
    board_build.flash_mode: dio
    board_build.mcu: esp32c3

# external_components:
#   - source: github://limengdu/mmwave-kit-external-components@main
#     refresh: 0s

esp32:
  board: esp32-c3-devkitm-1
  variant: esp32c3
  framework:
    type: esp-idf
    
# Enable logging
logger:
  hardware_uart: USB_SERIAL_JTAG
  level: DEBUG
    
ota:
  - platform: esphome

mqtt:
  broker: 192.168.0.250
  username: user
  password: user123 
  discovery_unique_id_generator: mac    
    
wifi:
  reboot_timeout: 20s
  ssid: "wifi1"
  password: "passwd1"
  fast_connect: True
  power_save_mode: none

captive_portal:

uart:
  id: uart_bus
  baud_rate: 115200
  rx_pin: 4
  tx_pin: 5
  parity: NONE
  stop_bits: 1

seeed_mr24hpc1:
  id: my_seeed_mr24hpc1

text_sensor:
  - platform: seeed_mr24hpc1
    heart_beat:
      name: "Heartbeat"
    product_model:
      name: "Product Model"
    product_id:
      name: "Product ID"
    hardware_model:
      name: "Hardware Model"
    hardware_version:
      name: "Hardware Version"
    keep_away:
      name: "Active Reporting Of Proximity"
    motion_status:
      name: "Motion Information"
    custom_mode_end:
      name: "Custom Mode Status"

binary_sensor:
  - platform: seeed_mr24hpc1
    has_target:
      name: "Presence Information"

sensor:
  - platform: seeed_mr24hpc1
    custom_presence_of_detection:
      name: "Static Distance"
    movement_signs:
      name: "Body Movement Parameter"
    custom_motion_distance:
      name: "Motion Distance"
    custom_spatial_static_value:
      name: "Existence Energy"
      id: eval
    custom_spatial_motion_value:
      name: "Motion Energy"
      id: mval
    custom_motion_speed:
      name: "Motion Speed"
    custom_mode_num:
      name: "Current Custom Mode"

switch:
  - platform: seeed_mr24hpc1
    underlying_open_function:
      name: Underlying Open Function Info Output Switch
      
button:
  - platform: seeed_mr24hpc1
    restart:
      name: "Module Restart"
    custom_set_end:
      name: "End Of Custom Mode Settings"

select:
  - platform: seeed_mr24hpc1
    scene_mode:
      name: "Scene"
    unman_time:
      name: "Time For Entering No Person State (Standard Function)"
    existence_boundary:
      name: "Existence Boundary"
    motion_boundary:
      name: "Motion Boundary"

number:
  - platform: seeed_mr24hpc1
    sensitivity:
      name: "Sensitivity"
    custom_mode:
      name: "Custom Mode"
    existence_threshold:
      name: "Existence Energy Threshold"
    motion_threshold:
      name: "Motion Energy Threshold"
    motion_trigger:
      name: "Motion Trigger Time"
    motion_to_rest:
      name: "Motion To Rest Time"
    custom_unman_time:
      name: "Time For Entering No Person State (Underlying Open Function)"

And here’s the relay yaml:

esphome:
  name: relay1

esp32:
  board: esp32-s3-devkitc-1
  flash_size: 8MB
  framework:
    type: arduino

# Enable logging
logger:
  level: DEBUG
   
ota:
  - platform: esphome

preferences:
  flash_write_interval: 20s
    
mqtt:
  broker: 192.168.0.250
  username: user
  password: user123
  discovery_unique_id_generator: mac
    
wifi:
  reboot_timeout: 20s
  ssid: "wifi1"
  password: "passwd1"
  fast_connect: True
  power_save_mode: none
    
binary_sensor:
  - platform: status
    name: "Status"

  - platform: gpio
    name: "Boot Button"
    pin:
      number: 0
      ignore_strapping_warning: true
      mode:
        input: true
      inverted: true
    disabled_by_default: true
    on_press:
      then:
        - button.press: restart_button

switch:
  - platform: gpio
    pin: GPIO1
    id: relay1
    name: Relay 1
    restore_mode: RESTORE_DEFAULT_ON
  - platform: gpio
    pin: GPIO2
    id: relay2
    name: Relay 2
    restore_mode: RESTORE_DEFAULT_ON
  - platform: gpio
    pin: GPIO41
    id: relay3
    name: Relay 3
    restore_mode: RESTORE_DEFAULT_ON
  - platform: gpio
    pin: GPIO42
    id: relay4
    name: Relay 4
    restore_mode: RESTORE_DEFAULT_ON
  - platform: gpio
    pin:
      number: GPIO45
      ignore_strapping_warning: true
    id: relay5
    name: Relay 5
    restore_mode: RESTORE_DEFAULT_ON
  - platform: gpio
    pin:
      number: GPIO46
      ignore_strapping_warning: true
    id: relay6
    name: Relay 6
    restore_mode: RESTORE_DEFAULT_ON
        
uart:
  - id: modbus_uart
    tx_pin: GPIO17
    rx_pin: GPIO18
    baud_rate: 9600

# buzzer
output:
  - platform: ledc
    pin: GPIO21
    id: buzzer

rtttl:
  output: buzzer
  id: rtttl_buzzer
  gain: 30%

light:
  - platform: neopixelbus
    type: RGB
    variant: 800KBPS
    pin: GPIO38
    num_leds: 1
    name: "RGB LED"
    id: rgb_led

button:
  - platform: restart
    name: "Restart"
    id: restart_button
    entity_category: config

  - platform: factory_reset
    name: "Factory Reset"
    id: reset
    entity_category: config

  - platform: safe_mode
    name: "Safe Mode"
    internal: false
    entity_category: config

Don’t bother commenting if you all you’re going to do is to suggest using a static ip/reserve dhcp. I know very well how important/useful that is. At the moment, I do not have access to router settings to know what its dhcp pool is/check list of connected devices. I will soon though. Until then, I’m curious to know why this is happening. Shouldn’t the mmwaves auto connect, like the relay did? Is there something in the yaml that’s making it not auto connect? And if it didn’t auto connect, why does it not show as Unavailable on HA? Stuff like this I find super annoying since it seems so random at first as to why this could be happening. The router had rebooted many times before and never has such a thing happened.

You are using MQTT, did you look on the broker using MQTT Explorer to see if the topics arrive there?

That will at least let you know if they are connected to the network.

Presence sensors with all the sensors define can easily bog down most ESPs, but a S3 should be fine.

I do see the mmwave topics in mqtt explorer but no new messages in those topics. The status topic says Online (it’s a retained message I think?).

I really don’t think it’s the sensors bogging down esp. It’s never happened before (ie. 2-3 months since I installed them) and the likelihood that it affects both devices at once? Feels like it’s something else. Besides, only existence energy and motion energy change rapidly (ie. two sensors update once every 300-400 ms) - the others update once in like 2-3 seconds or slower.

What is you esphome log saying…?

I uploaded manually via usb and not using the Esphome Add On - I’m not sure I can view any logs

Esphome dashboard? USB?

I used this link to upload : https://web.esphome.io/

I don’t have physical access to the sensors at the moment. I’m trying to figure out why this is happening so I can modify the esphome yaml accordingly when I’m able to reupload the code eg. if mqtt disconnected then restart device, etc.

That’s not ideal situation, logs would likely show you where the problem is.

1 Like