Status LED anomoly?

Installed ESPHome on a Sonoff Basic. Works fine except the status LED won’t stop blinking.

status_led:
  pin:
    number: 13  

So, I want to see the logs (wireless connection) to determine what error the slow-flash of the status LED means. Nothing there. Perfectly normal log page.

logs

Now the weirdness: I look at the Sonoff Basic again and the LED has stopped blinking.

So, I stop the log page and… the Status LED starts blinking again.

Open log and the LED stops blinking.
Close log and the LED blinks.

Anyone have any idea what is going on here?

I quit using built-in status led ages ago, since it’s pretty limited. I developed my own, which signals:

  • lit, with quick off’s: power on, no connection
  • steady flashing: only wifi connection
  • just short ‘on’ pulses: connected to HA.

This way you have way more information about module status.

It’s a good idea, though, to add these lines to logger to eliminate messages every second:

logger:
  logs:
    light: info

This example is correct if you have LED connected from GPIO to GND:

interval:
  - interval: 2s
    then:
      if:
        condition:
          wifi.connected:
        then:
          - if:
              condition:
                api.connected:
              then:
                - light.turn_on:
                    id: status_led
                    flash_length: 50ms
              else:
                - light.turn_on:
                    id: status_led
                    flash_length: 1000ms
        else:
          - light.turn_on:
              id: status_led
              flash_length: 1950ms

light: # ----------------------------------------------------------------------- LIGHT
  - platform: binary
    id: status_led
    internal: true
    output: status_led_out

output:
  - id: status_led_out
    platform: gpio
    pin: GPIO13

However, if you have LED connected from +3.3V to GPIO this one is correct:

interval:
  - interval: 2s
    then:
      if:
        condition:
          wifi.connected:
        then:
          - if:
              condition:
                api.connected:
              then:
                - light.turn_on:
                    id: status_led
                    flash_length: 1950ms
              else:
                - light.turn_on:
                    id: status_led
                    flash_length: 1000ms
        else:
          - light.turn_on:
              id: status_led
              flash_length: 50ms

light: # ----------------------------------------------------------------------- LIGHT
  - platform: binary
    id: status_led
    internal: true
    output: status_led_out

output:
  - id: status_led_out
    platform: gpio
    pin: GPIO13

The built in ESPHome status light default blink action is if the device does not have any active connection. If you connect to the device to view logs, there’s an active connection and the light stops blinking. If you connect to the API, there’s an active connection and the light stops blinking. If it’s connected to HA the light doesn’t blink, but then restart HA and it starts blinking until HA connects again. The blinking can also indicate no wireless connection, but then you wouldn’t be able to connect to view logs.

1 Like

Exactly

I think that if wireless is not connected it blinks even more aggressive/faster. Two levels of warnings/errors are indicated with slow and fast blinking afaik.

I have a couple of dozen ESP devices around the house and I have never observed this. This is the first time that I get a slow flash.

According esphome’s manual slow blink shows a warning:

  • Blink slowly (about every second) when a warning is active. Warnings are active when for example reading a sensor value fails temporarily or the WiFi/MQTT connections are disrupted.
  • Blink quickly (multiple times per second) when an error is active. Errors indicate that ESPHome has found an error while setting up. In most cases, ESPHome will still try to recover from the error and continue with all other operations.
  • Stay off otherwise.

Thanks, but I know what the blinks mean. I had just never seen a slow blink on a working, connected device.

I would connect uart on tx/rx and see log that way, not via wireless, if connection drops…perhaps some sensor or similar… has failed…?

There is nothing in the logs over UART. The WiFi level is quite low, I wonder if that could be the warning condition?

I am marking this as the solution…

So I have my answer, though I don’t understand why I haven’t noticed this behavior after flashing dozens of ESP devices over the past few years. The WiFi is connecting, but the API is not. Until I connect to the logs by WiFi. Then the API connects.

Is this normal or something new?

Hm… i guess it’s not normal… try to “tinker” with api…like try with password, without password… also try to delete device from HA, restart sonoff and see if HA will find it.

1 Like