question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug - struct.error: unpack requires a buffer of 4 bytes

See original GitHub issue

Environment

Passive BLE monitor integration (Xiaomi Mijia BLE MiBeacon monitor) Installed version: 0.9.4

Version 2021.1.0
Installation Type Home Assistant Supervised
Development false
Supervisor true
Docker true
Virtual Environment false
Python Version 3.8.7
Operating System Family Linux
Operating System Version 5.4.72-v7+
CPU Architecture armv7l

Logger: homeassistant Source: custom_components/ble_monitor/init.py:366 First occurred: 10. januára 2021, 16:57:47 (1 occurrences) Last logged: 10. januára 2021, 16:57:47 Error doing job: Fatal error: protocol.data_received() call failed.

Traceback (most recent call last): File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 862, in _read_ready__data_received self._protocol.data_received(data) File "/config/custom_components/ble_monitor/aioblescan_ext.py", line 1497, in data_received self.process(packet) File "/config/custom_components/ble_monitor/__init__.py", line 483, in process_hci_events msg, binary, measuring = self.parse_raw_message(data) File "/config/custom_components/ble_monitor/__init__.py", line 736, in parse_raw_message result.update(resfunc(xvalue)) File "/config/custom_components/ble_monitor/__init__.py", line 366, in obj0d10 (temp, humi) = TH_STRUCT.unpack(xobj) struct.error: unpack requires a buffer of 4 bytes

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:25

github_iconTop GitHub Comments

1reaction
Ernst79commented, Mar 2, 2021

I added the same fix (skip if the message doesn’t have the correct length) for most messages. Is added in 1.2.0-beta.

1reaction
Ernst79commented, Feb 28, 2021

Please update to 1.1.4. This is solved in 1.1.4.

Read more comments on GitHub >

github_iconTop Results From Across the Web

struct.error: unpack requires a buffer of 4 bytes - Stack Overflow
struct is used for binary packed data - data that is not human-readable. b'+001.80\r' is 8 bytes long: b'+', b'0', b'0', b'1', b'.',...
Read more >
Python - Struct module error | Sololearn: Learn to code for FREE!
I just tried to reproduce it and got an error saying unpack requires a buffer of 4 bytes. Here is the code, import...
Read more >
7.1. struct — Interpret bytes as packed binary data
Iteratively unpack from the buffer buffer according to the format string fmt. This function returns an iterator which will read equally-sized chunks from...
Read more >
diffoscope: can't diff non-existent file with .pyc: struct.error
Bug#1004312 : diffoscope: can't diff non-existent file with .pyc: struct.error: unpack requires a buffer of 4 bytes · Jakub Wilk · Chris Lamb....
Read more >
struct — Interpret bytes as packed binary data — Python 3.11 ...
Unpack from the buffer buffer (presumably packed by pack(format, ...) ) according to the format string format. The result is a tuple even...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found