Skip to content

AttributeError: 'Logger' object has no attribute 'Warn'. Did you mean: 'warn'? #12378

@jandechent

Description

@jandechent

The problem

This happens occasionally, when building to upload wireless

INFO Send discover via MQTT broker topic: esphome/ping/ultra-smart-01
Exception in thread Thread-3 (_thread_main):
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3591, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
    rc = self._loop(timeout)
         ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1164, in _loop
    rc = self.loop_read()
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1556, in loop_read
    rc = self._packet_read()
         ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
    rc = self._packet_handle()
         ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
    return self._handle_publish()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish
    self._handle_on_message(message)
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
    on_message(self, self._userdata, message)
  File "/esphome/esphome/mqtt.py", line 195, in on_message
    _LOGGER.Warn("Wrong device answer")
    ^^^^^^^^^^^^
AttributeError: 'Logger' object has no attribute 'Warn'. Did you mean: 'warn'?

Which version of ESPHome has the issue?

2025.11.4

What type of installation are you using?

Home Assistant Add-on

What platform are you using?

ESP8266

Component causing the issue

No response

YAML Config

esphome:
  name: ultra-smart-01
  friendly_name: Mini Display 01
  platformio_options: 
    board_build.f_cpu: 160000000L

esp8266:
  board: esp12e

logger:
  level: WARN

# Enable Home Assistant API
api:
  encryption:
    key: !secret ultra_smart_01_api_encryption_key
ota:
  - platform: esphome
    password: !secret ultra_smart_01_ota_password
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Mini-Display-Tv Fallback"
    password: !secret wifi_captive_password
    channel: !secret wifi_captive_channel
captive_portal:

time:
  - platform: homeassistant
    id: homeassistant_time

#################

mqtt:
  broker: !secret mqtt_broker
  discovery: false # so entitie dont show up twic
  username: !secret mqtt_username
  password: !secret mqtt_password
  on_message:
    - topic: "esphome/display/status"
      then:
        - lambda: |-
            id(automation_display_text).publish_state(x);
      

color:
  - id: color_error
    hex: eb1c24  
  - id: color_ironman_red
    hex: eb1c24
  - id: color_ironman_yellow
    hex: fcb712
  - id: black_color
    red: 0
    green: 0
    blue: 0    

# interval:
#   - interval: 5s
#     then:
#       - display.page.show_next: my_display
#       - component.update: my_display

text_sensor:
  - platform: template
    name: "Display Text Automation"
    id: automation_display_text


sensor:
  - platform: uptime
    name: "Uptime"
  - platform: wifi_signal
    name: "WiFi Signalstärke"
    update_interval: 60s

button:
  - platform: restart
    name: "Neustart"
  - platform: safe_mode
    name: "Neustart (Safe Mode)"    

output:
  - platform: esp8266_pwm
    pin: GPIO5 # Bestätigter korrekter Pin
    frequency: 1000 Hz
    id: pwm_backlight
    inverted: true 

light:
  - platform: monochromatic
    output: pwm_backlight
    name: "Geek Display Backlight"
    id: backlight
    restore_mode: ALWAYS_ON 

# --- Display & SPI Konfiguration ---
spi:
  clk_pin: GPIO14
  mosi_pin: GPIO13
  id: spihwd
  interface: hardware


font:
  - file: "gfonts://Stack+Sans+Notch"
    id: font_default
    size: 18
    glyphsets:
      -  GF_Latin_Core
  - file: "gfonts://Stack+Sans+Notch"
    id: font_large
    size: 24
#   - id: roboto
#     file: "gfonts://Roboto"
#     size: 20
#   - id: terminus12n
#     file: terminus-font-4.49.1/ter-u12n.bdf
#   - id: spleen64
#     file:
#       type: web
#       url: https://raw.githubusercontent.com/fcambus/spleen/refs/heads/master/spleen-32x64.bdf
#     glyphs: "0123456789:"

display:
  - id: my_display
    platform: mipi_spi # Interner, stabiler Treiber
    model: ST7789V      
    spi_id: spihwd
    
    dimensions:
      height: 240
      width: 240
      offset_height: 0 
      offset_width: 0

    dc_pin: GPIO00
    reset_pin: GPIO02
    
    buffer_size: 12.5%
    invert_colors: true
    color_depth: 16
    color_order: BGR # Korrektur der Farbreihenfolge
    spi_mode: mode3
    data_rate: 40000000
    
    rotation:  # Startet mit 0° (horizontal)
    auto_clear_enabled: False
    update_interval: 5s 
    
    lambda: |-
      it.fill(id(black_color)); 
      delay(10); 
      
      it.strftime(it.get_width()-1, 0, id(font_default), TextAlign::TOP_RIGHT,"%H:%M:%S", id(homeassistant_time).now());
      it.print(0, 0, id(font_default), "Status:");

      const char* automation_text = id(automation_display_text).state.c_str();
      
      // Wenn der Sensor leer ist (beim Start), zeige den Standardtext.
      if (strlen(automation_text) == 0) {
        it.print(0, it.get_height()/2, id(font_default), "Keine Probleme");
      } else {
        // Zeige den über MQTT empfangenen Text an.
          it.print(0, 20, id(font_default), Color(id(color_error)), automation_text);
      }
      
      // IP Adresse
      it.print(10, 200, id(font_default), 
        (String("IP: ") + WiFi.localIP().toString()).c_str());

Anything in the logs that might be useful for us?

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions