aioesphomeapi: Invalid protobuf message: expected bytes, bytearray found

Was building a new version of my Docker container that is using the ESPHome API. Upon building, the following error gets raised. This error wasn’t there before, and the changes I made to my container are unrelated to the ESPHome part, so I believe something got broken recently in the API package

energy-meter-1.local: Connection error occurred: Invalid protobuf message: expected bytes, bytearray found
Fatal error: protocol.data_received() call failed.
protocol: <aioesphomeapi._frame_helper.APIPlaintextFrameHelper object at 0x7f6fedd8bb50>
transport: <_SelectorSocketTransport closing fd=6 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 876, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/_frame_helper.py", line 195, in data_received
    self._callback_packet(msg_type_int, packet_data)
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/_frame_helper.py", line 110, in _callback_packet
    self._on_pkt(Packet(type_, data))
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py", line 581, in _process_packet
    msg.ParseFromString(pkt.data)
TypeError: expected bytes, bytearray found

The ESPHome device is and ESP32 and is running on ESPHome 2022.12.3 FW

Let me know if you need any debugging or more information

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

I just pushed 13.0.4 which should fix the issue. Thanks for the report.

I’ll adjust the exception to provide more information