Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in client.py", line 46, in on_log print(f"[{time_.hour:02}:{time_.minute:02}:{time_.second:02}]{text}") #5806

Open
ptr727 opened this issue May 16, 2024 · 0 comments

Comments

@ptr727
Copy link

ptr727 commented May 16, 2024

The problem

Running 2024.5.0 on Windows 11 using Python 3.12 throws exceptions during log output.

Looks like an issue with colorama\ansitowin32.py and logging print(f"[{time_.hour:02}:{time_.minute:02}:{time_.second:02}]{text}")

Issue is new to 2024.5.0, did not occur in 2024.4.x.

INFO ESPHome 2024.5.0
INFO Reading configuration .\esp32-s3-feather-test.yaml...
INFO Detected timezone 'America/Los_Angeles'
WARNING GPIO3 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO33 is used by the PSRAM interface on ESP32-S3R8 / ESP32-S3R8V and should be avoided on these models
INFO Starting log output from 192.168.1.184 using esphome API
INFO Successfully connected to esp32-s3-feather-test @ 192.168.1.184 in 0.033s
INFO Successful handshake with esp32-s3-feather-test @ 192.168.1.184 in 0.021s
[15:32:17][I][app:100]: ESPHome version 2024.5.0 compiled on May 16 2024, 14:53:19
[15:32:17][C][wifi:580]: WiFi:
[15:32:17][C][wifi:408]:   Local MAC: DC:54:75:CF:BC:D8
[15:32:17][C][wifi:413]:   SSID: [redacted]
[15:32:17][C][wifi:416]:   IP Address: 192.168.1.184
[15:32:17][C][wifi:420]:   BSSID: [redacted]
[15:32:17][C][wifi:421]:   Hostname: 'esp32-s3-feather-test'
ERROR Exception in callback _ProactorReadPipeTransport._loop_reading(<_OverlappedF...d result=2024>)
handle: <Handle _ProactorReadPipeTransport._loop_reading(<_OverlappedF...d result=2024>)>
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\proactor_events.py", line 325, in _loop_reading
    self._data_received(data, length)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\proactor_events.py", line 274, in _data_received
    self._protocol.data_received(data)
  File "aioesphomeapi\\_frame_helper\\plain_text.py", line 92, in aioesphomeapi._frame_helper.plain_text.APIPlaintextFrameHelper.data_received
  File "aioesphomeapi\\connection.py", line 933, in aioesphomeapi.connection.APIConnection.process_packet
  File "c:\Users\piete\source\repos\ptr727\ESPHome-Config\.venv\Lib\site-packages\esphome\components\api\client.py", line 46, in on_log
    print(f"[{time_.hour:02}:{time_.minute:02}:{time_.second:02}]{text}")
  File "c:\Users\piete\source\repos\ptr727\ESPHome-Config\.venv\Lib\site-packages\colorama\ansitowin32.py", line 47, in write
    self.__convertor.write(text)
  File "c:\Users\piete\source\repos\ptr727\ESPHome-Config\.venv\Lib\site-packages\colorama\ansitowin32.py", line 177, in write
    self.write_and_convert(text)
  File "c:\Users\piete\source\repos\ptr727\ESPHome-Config\.venv\Lib\site-packages\colorama\ansitowin32.py", line 205, in write_and_convert
    self.write_plain_text(text, cursor, len(text))
  File "c:\Users\piete\source\repos\ptr727\ESPHome-Config\.venv\Lib\site-packages\colorama\ansitowin32.py", line 210, in write_plain_text
    self.wrapped.write(text[start:end])
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode characters in position 71-72: character maps to <undefined>
[15:32:17][C][wifi:427]:   Channel: 6
[15:32:17][C][wifi:428]:   Subnet: 255.255.255.0
[15:32:17][C][wifi:429]:   Gateway: 192.168.1.1
[15:32:17][C][wifi:430]:   DNS1: 192.168.1.1
[15:32:17][C][wifi:431]:   DNS2: 0.0.0.0
[15:32:17][C][logger:185]: Logger:
[15:32:17][C][logger:186]:   Level: DEBUG
[15:32:17][C][logger:188]:   Log Baud Rate: 115200
[15:32:17][C][logger:189]:   Hardware UART: USB_CDC
[15:32:17][C][i2c.arduino:071]: I2C Bus:
[15:32:17][C][i2c.arduino:072]:   SDA Pin: GPIO3
[15:32:17][C][i2c.arduino:073]:   SCL Pin: GPIO4
[15:32:17][C][i2c.arduino:074]:   Frequency: 50000 Hz
[15:32:17][C][i2c.arduino:086]:   Recovery: bus successfully recovered
[15:32:17][I][i2c.arduino:096]: Results from i2c bus scan:
[15:32:17][I][i2c.arduino:102]: Found i2c device at address 0x36
[15:32:17][C][uptime.sensor:031]: Uptime Sensor 'esp32-s3-feather-test_uptime'
[15:32:17][C][uptime.sensor:031]:   Device Class: 'duration'
[15:32:17][C][uptime.sensor:031]:   State Class: 'total_increasing'
[15:32:17][C][uptime.sensor:031]:   Unit of Measurement: 'min'
[15:32:17][C][uptime.sensor:031]:   Accuracy Decimals: 0
[15:32:17][C][uptime.sensor:031]:   Icon: 'mdi:timer-outline'
[15:32:17][C][switch.gpio:068]: GPIO Switch 'esp32-s3-feather-test_neopixel_power"'
[15:32:17][C][switch.gpio:091]:   Restore Mode: always ON
[15:32:17][C][esp32_rmt_led_strip:175]: ESP32 RMT LED Strip:
[15:32:17][C][version.text_sensor:021]: Version Text Sensor 'esp32-s3-feather-test_version'
[15:32:17][C][version.text_sensor:021]:   Icon: 'mdi:new-box'
[15:32:17][C][max17048:033]: MAX17048:
[15:32:17][C][max17048:034]:   Address: 0x36
[15:32:17][C][max17048:035]:   Voltage (V) 'esp32-s3-feather-test_battery_voltage'
[15:32:17][C][max17048:035]:     Device Class: 'battery'
[15:32:17][C][max17048:035]:     State Class: 'measurement'
[15:32:17][C][max17048:035]:     Unit of Measurement: 'V'
[15:32:17][C][max17048:035]:     Accuracy Decimals: 3
[15:32:17][C][max17048:036]:   State of Charge (%) 'esp32-s3-feather-test_battery_level'
[15:32:17][C][max17048:036]:     Device Class: 'battery'
[15:32:17][C][max17048:036]:     State Class: 'measurement'
[15:32:17][C][max17048:036]:     Unit of Measurement: '%'
[15:32:17][C][max17048:036]:     Accuracy Decimals: 2
[15:32:17][C][max17048:037]:   Discharge Rate (%/hr) 'esp32-s3-feather-test_battery_discharge_rate'
[15:32:17][C][mdns:115]: mDNS:
[15:32:17][C][mdns:116]:   Hostname: esp32-s3-feather-test
[15:32:17][C][ota:096]: Over-The-Air Updates:
[15:32:17][C][ota:103]:   OTA version: 2.
[15:32:17][C][api:139]: API Server:
[15:32:17][C][api:140]:   Address: esp32-s3-feather-test.home.insanegenius.net:6053
[15:32:17][C][api:144]:   Using noise encryption: NO
[15:32:17][C][wifi_info:011]: WifiInfo SSID 'esp32-s3-feather-test_wifi_ssid'
[15:32:17][C][wifi_info:012]: WifiInfo BSSID 'esp32-s3-feather-test_wifi_bssid'
[15:32:17][C][wifi_info:009]: WifiInfo IPAddress 'esp32-s3-feather-test_wifi_ip'
[15:32:17][C][wifi_signal.sensor:009]: WiFi Signal 'esp32-s3-feather-test_wifi_signal'
[15:32:17][C][wifi_signal.sensor:009]:   Device Class: 'signal_strength'
[15:32:17][C][wifi_signal.sensor:009]:   State Class: 'measurement'
[15:32:17][C][wifi_signal.sensor:009]:   Unit of Measurement: 'dBm'
[15:32:17][C][wifi_signal.sensor:009]:   Accuracy Decimals: 0
[15:32:17][C][debug:067]: Debug component:
[15:32:17][C][debug:069]:   Device info 'esp32-s3-feather-test_device_info'
[15:32:17][C][debug:069]:     Icon: 'mdi:chip'
[15:32:17][C][debug:072]:   Free space on heap 'esp32-s3-feather-test_heap_free'
[15:32:17][C][debug:072]:     State Class: ''
[15:32:17][C][debug:072]:     Unit of Measurement: 'B'
[15:32:17][C][debug:072]:     Accuracy Decimals: 0
[15:32:17][C][debug:072]:     Icon: 'mdi:counter'
[15:32:17][D][debug:079]: ESPHome version 2024.5.0
[15:32:17][D][debug:083]: Free Heap Size: 216136 bytes
[15:32:17][D][debug:113]: Flash Chip: Size=8192kB Speed=80MHz Mode=QIO

Which version of ESPHome has the issue?

2024.5.0

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

NA

What platform are you using?

ESP32

Board

Adafruit Feather ESP32-S3

Component causing the issue

log

Example YAML snippet

See: https://github.com/ptr727/ESPHome-Config/blob/develop/esp32-s3-feather-test.yaml

Anything in the logs that might be useful for us?

No response

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant