Cannot get static IP to take, still using DHCP address

I don’t have the add on as i am running HA in docker. I have a separate esphome container running, I haven’t even tried to get this into HA itself yet.

as for changing the lines you mentioned above, that is done. the use_address line is gone, the static_ip line references .90.

someone earlier had asked for the whole yaml file, here it is:

esphome:
  name: master-bedroom

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: [redacted]

ota:
  password: [redacted]

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  manual_ip:
    static_ip: 192.168.88.90
    gateway: 192.168.88.1
    subnet: 255.255.255.0

captive_portal:
    

BUT NOT ALL. Which is why it is strongly discouraged.

1 Like

can we stop worrying about the IP I’m trying to assign being inside the DHCP range? it isn’t, and I confirmed that in my first reply and I have reiterated it several times since. it never has been, I am well aware that it’s not a good idea to try to set a static IP inside the DHCP range, which is why I chose .90 to begin with (which is outside my range of .100-.199).

I have no idea how this became such a fervent point of discussion here but I feel like it’s hurting the actual cause of trying to get this to work, because it has nothing to do with my particular issue. it feels like we are trying to go down a rabbit hole needlessly on this…

I agree.

What does the log of esphome show? Copy/paste not a screenshot.

after leaving it unplugged overnight, running clean build files and now trying to flash again, it finally has cleared the last bit of .132 i was seeing and i can now hit it wirelessly from inside esphome - however, it still shows as offline.

INFO Reading configuration /config/master-bedroom.yaml...
INFO Starting log output from 192.168.88.90 using esphome API
INFO Successfully connected to 192.168.88.90
[21:19:21][I][app:102]: ESPHome version 2022.6.2 compiled on Aug  8 2022, 21:16:54
[21:19:21][C][wifi:491]: WiFi:
[21:19:21][C][wifi:353]:   Local MAC: 30:C6:F7:20:82:50
[21:19:21][C][wifi:354]:   SSID: [redacted]
[21:19:21][C][wifi:355]:   IP Address: 192.168.88.90
[21:19:21][C][wifi:357]:   BSSID: [redacted]
[21:19:21][C][wifi:358]:   Hostname: 'master-bedroom'
[21:19:21][C][wifi:360]:   Signal strength: -45 dB ▂▄▆█
[21:19:21][C][wifi:364]:   Channel: 1
[21:19:21][C][wifi:365]:   Subnet: 255.255.255.0
[21:19:21][C][wifi:366]:   Gateway: 192.168.88.1
[21:19:21][C][wifi:367]:   DNS1: 0.0.0.0
[21:19:21][C][wifi:368]:   DNS2: 0.0.0.0
[21:19:21][C][logger:275]: Logger:
[21:19:21][C][logger:276]:   Level: DEBUG
[21:19:21][C][logger:277]:   Log Baud Rate: 115200
[21:19:21][C][logger:278]:   Hardware UART: UART0
[21:19:21][C][captive_portal:088]: Captive Portal:
[21:19:21][C][mdns:084]: mDNS:
[21:19:21][C][mdns:085]:   Hostname: master-bedroom
[21:19:21][C][ota:085]: Over-The-Air Updates:
[21:19:21][C][ota:086]:   Address: 192.168.88.90:3232
[21:19:21][C][ota:089]:   Using Password.
[21:19:21][W][ota:095]: Last Boot was an unhandled reset, will proceed to safe mode in 5 restarts
[21:19:21][C][api:138]: API Server:
[21:19:22][C][api:139]:   Address: 192.168.88.90:6053
[21:19:22][C][api:141]:   Using noise encryption: YES

Shows where?

in the esphome ui.

But is it showing in home assistant? Are sensors getting data?

I had similar issues with one of my esp’s, problem was in mdns not working properly.

Now i happen to use my own domain (domain.me) and specifying that one on esphome resolved it (in combination with a IP reservation on my dhcp server (=router), i prefer reservation for all my devices; so i can quicly lookup which devices uses which IP😋)

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_iotpw
  domain: .domain.me

i don’t have it in HA yet because i thought i had to get it into esphome first…and i don’t have any sensors connected to it for the same reason.

edit: added the esphome integration and got the device into HA via .90. how do i get it to show as online in esphome though? my OCD isn’t going to allow me to leave this sitting there showing offline when it’s actually online and working, if it is…

Can you please try adding it via integrations? The esphome gui sometimes is wrong. It doesn’t mean it can’t be seen by HA.

yeah, i just edited above and said i got it into HA. this is going to disturb my OCD big time though…is there not a way to make the esphome UI show it as online?

Try leaving it a while, it may heal itself. The other thing you can do is use status_use_ping - although I would have to seach on how to do that in docker as opposed to the addon.

1 Like

As Nick said, try adding it in settings → integrations. Click on “Add Integration” and in the “host” feild, enter the IP:
esphome

Home Assistant should have discovered it, but once in a great while I have to enter it manually.

I think you said you restarted and cleared the browser cache?

adding the following env to the esphome docker container has brought the device online in the esphome ui:

ESPHOME_DASHBOARD_USE_PING=true

i think i should be good to go now. thanks all for the help!

1 Like

That’s option i was talking about in my last post (status_use_ping)… as i said: i’ve had only problems using mDNS names… ping is the way to go. I’m glad that you worked out.

1 Like

coming back to this - over the last few days, i’ve had all sorts of issues, even using ping. if i try to ping (either the IP or the mDNS name), the ping works but the packet loss is horrific…usually upwards of 70%-80%. the device continually falls offline on the esphome UI, and sensors go unavailable every few minutes in HA itself for a few seconds, then come back online. then a few minutes later, offline for a few seconds…and back. this repeats constantly for a few days, until it eventually dies completely and goes unavailable permanently until i power cycle it.

i have no idea how to fix this. i’ve been searching for days, and have gotten nowhere… i’m completely lost.

first thing to check would be: does device only falls offline in HA or it goes offline on wifi? I’ve had my part of problems with wifi and router settings…
for this to check i’d create a led on esp module - i have code below installed on all my modules: led lights when no connection at all (startup…), steadily flashes when only wifi is connected but not HA and periodical short flash when HA is also connected.

NOTE that depending on LED connection (to GND or to Vcc) flashing can be reversed - many modules have already one led built-in you can use. In that case you just reverse “_on” and “_off” commands.

I hope i didn’ t forget to include anything:

globals:
  - id: stevec
    type: int
    initial_value: "0"

substitutions:
  device_name: my_test_device 
#here you connect your led:
  connected_pin: GPIO2

interval:
  - interval: 1s
    then:
      if:
        condition:
          wifi.connected:
        then:
          - switch.turn_off: ${device_name}_wifi_api_connected
          - if:
              condition:
                api.connected:
              then:
                - lambda: |-
                    id(stevec) +=1;
                    if (id(stevec) > 4) {
                      id(stevec) = 0;
                      id(${device_name}_wifi_api_connected).turn_on();}
                - delay: 50ms
                - switch.turn_off: ${device_name}_wifi_api_connected
              else:
                - delay: 500ms
                - switch.turn_on: ${device_name}_wifi_api_connected
        else:
          - switch.turn_on: ${device_name}_wifi_api_connected

switch:
  #Switch WiFi connected LED
  - platform: gpio
    pin: ${connected_pin}
    id: ${device_name}_wifi_api_connected
    internal: true

i actually don’t have anything connected to the ESP at all at the moment (i’m only using it as a BLE tracker for some xiaomi temp/humidity sensors), so i’d have to run to microcenter tomorrow to find a LED to test it that way.

basically, what i’ve seen (and what i would guess is causing the issues) is that like i said the device seems to stay online but there is a ridiculous amount of packet loss when i try to ping it, either via IP or via mDNS.

here’s the most recent attempt at this, 21.7% is by far the lowest i’ve seen (last night i was getting packet losses upwards of 70%-80%)…

~ % ping office.local
PING office.local (192.168.88.90): 56 data bytes
64 bytes from 192.168.88.90: icmp_seq=0 ttl=255 time=8.253 ms
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
64 bytes from 192.168.88.90: icmp_seq=3 ttl=255 time=3926.067 ms
64 bytes from 192.168.88.90: icmp_seq=4 ttl=255 time=2935.857 ms
64 bytes from 192.168.88.90: icmp_seq=5 ttl=255 time=1931.549 ms
64 bytes from 192.168.88.90: icmp_seq=6 ttl=255 time=926.720 ms
64 bytes from 192.168.88.90: icmp_seq=7 ttl=255 time=7.921 ms
64 bytes from 192.168.88.90: icmp_seq=8 ttl=255 time=3936.395 ms
64 bytes from 192.168.88.90: icmp_seq=9 ttl=255 time=2935.387 ms
64 bytes from 192.168.88.90: icmp_seq=10 ttl=255 time=1930.902 ms
64 bytes from 192.168.88.90: icmp_seq=11 ttl=255 time=926.831 ms
64 bytes from 192.168.88.90: icmp_seq=12 ttl=255 time=15.841 ms
64 bytes from 192.168.88.90: icmp_seq=13 ttl=255 time=137.237 ms
64 bytes from 192.168.88.90: icmp_seq=14 ttl=255 time=64.359 ms
Request timeout for icmp_seq 18
64 bytes from 192.168.88.90: icmp_seq=15 ttl=255 time=4055.821 ms
64 bytes from 192.168.88.90: icmp_seq=16 ttl=255 time=3051.143 ms
64 bytes from 192.168.88.90: icmp_seq=17 ttl=255 time=2048.428 ms
64 bytes from 192.168.88.90: icmp_seq=18 ttl=255 time=1050.185 ms
64 bytes from 192.168.88.90: icmp_seq=19 ttl=255 time=46.384 ms
^C
--- office.local ping statistics ---
23 packets transmitted, 18 packets received, 21.7% packet loss
round-trip min/avg/max/stddev = 7.921/1663.071/4055.821/1464.794 ms

Ufff…these are pretty bad response times… i’d check for wifi signal, and, if it’s low add external antenna to esp module - if you’re good with soldering iron you can do it, otherwise get a module with connector for external antenna. But, i’d bet my 10 cents on bad wifi connection. Those times should be … well, a few ms…

I also have wifi signal sensor on all my esp’s:

sensor:
  - platform: wifi_signal
    name: WiFi signal
    update_interval: 60s
    internal: false

You can monitor signal with it and see if it’s bad.
As said, many modules have already led on the pcb - just check out for yours and if it does, find out which port is used and you’re done.