Closed knowthelist closed 6 years ago
have the same error python 3.6.5 timestamp is none:
[monitor.py:110 - print_message() ] timestamp:{'type1': 3, 'type1_length': 1, 'error_flags': 3, 'type2': 4, 'type2_length': 2, 'timestamp': None}
[cemi.py:41 - _unpack_stream() ] unpack requires a buffer of 4 bytes
Traceback (most recent call last):
File "/mnt/d/sensio-data/knx-test/knxmap/knxmap/messages/cemi.py", line 39, in _unpack_stream
return struct.unpack(fmt, buf)[0]
struct.error: unpack requires a buffer of 4 bytes
Thanks for reporting this issue @knowthelist and @fenchu ! I pushed a potential fix to the develop branch (bc9f8e44b3ff80c86246ab279026aaf0452104ce) that will hopefully fix this issue. I guess timestamp could be an optional field but I'm not really sure.
May I ask with what kind of devices you got these errors (type/manufacturer)? I don't have many different devices available for testing the code, so it would be interesting to know if there are devices that have special properties.
Thanks @takeshixx, I have several of the following: ABB IPR/S3.1.1
X.X.X.X
Port: 3671
MAC Address: 00:0C:DE:30:80:17
KNX Bus Address: 1.2.4
Additional Bus Addresses:
1.2.9
1.2.13
1.2.14
1.2.15
1.2.16
KNX Device Serial: 0002852AFF51
KNX Medium: KNX TP
Manufacturer: ABB
Device Friendly Name: QA Test Interface
Device Status:
Programming Mode: disabled
Link Layer: disabled
Transport Layer: disabled
Application Layer: disabled
Serial Interface: disabled
User Application: disabled
BC DM: 0
Project Install Identifier: 0
Supported Services:
KNXnet/IP Core
KNXnet/IP Device Management
KNXnet/IP Tunnelling
KNXnet/IP Remote Configuration and Diagnosis
Thanks for sharing the info. Can you confirm that bc9f8e44b3ff80c86246ab279026aaf0452104ce fixes your issue?
I will close this issue for now. Feel free to open a new issue if the error still occurs.
knxmap -v monitor 192.168.178.20 [selector_events.py:49 - init() ] Using selector: EpollSelector [core.py:242 - monitor() ] Starting bus monitor [init.py:47 - parse_message() ] Parsing KnxConnectResponse [init.py:50 - parse_message() ] Parsing KnxTunnellingRequest [cemi.py:41 - _unpack_stream() ] unpack requires a bytes object of length 4 Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/KNXmap-0.10.0-py3.4.egg/knxmap/messages/cemi.py", line 39, in _unpack_stream return struct.unpack(fmt, buf)[0] struct.error: unpack requires a bytes object of length 4 [base_events.py:921 - default_exception_handler() ] Exception in callback _SelectorDatagramTransport._read_ready() handle: <Handle _SelectorDatagramTransport._read_ready()> Traceback (most recent call last): File "/usr/lib/python3.4/encodings/hex_codec.py", line 15, in hex_encode return (binascii.b2a_hex(input), len(input)) TypeError: 'NoneType' does not support the buffer interface
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run self._callback(*self._args) File "/usr/lib/python3.4/asyncio/selector_events.py", line 932, in _read_ready self._protocol.datagram_received(data, addr) File "/usr/local/lib/python3.4/dist-packages/KNXmap-0.10.0-py3.4.egg/knxmap/bus/monitor.py", line 58, in datagram_received self.print_message(knx_message) File "/usr/local/lib/python3.4/dist-packages/KNXmap-0.10.0-py3.4.egg/knxmap/bus/monitor.py", line 115, in print_message timestamp=codecs.encode(cemi.additional_information.get('timestamp'), 'hex'), TypeError: encoding with 'hex' codec failed (TypeError: 'NoneType' does not support the buffer interface) [init.py:50 - parse_message() ] Parsing KnxTunnellingRequest [cemi.py:41 - _unpack_stream() ] unpack requires a bytes object of length 4 Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/KNXmap-0.10.0-py3.4.egg/knxmap/messages/cemi.py", line 39, in _unpack_stream return struct.unpack(fmt, buf)[0] struct.error: unpack requires a bytes object of length 4 [base_events.py:921 - default_exception_handler() ] Exception in callback _SelectorDatagramTransport._read_ready() handle: <Handle _SelectorDatagramTransport._read_ready()> Traceback (most recent call last): File "/usr/lib/python3.4/encodings/hex_codec.py", line 15, in hex_encode return (binascii.b2a_hex(input), len(input)) TypeError: 'NoneType' does not support the buffer interface
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run self._callback(*self._args) File "/usr/lib/python3.4/asyncio/selector_events.py", line 932, in _read_ready self._protocol.datagram_received(data, addr) File "/usr/local/lib/python3.4/dist-packages/KNXmap-0.10.0-py3.4.egg/knxmap/bus/monitor.py", line 58, in datagram_received self.print_message(knx_message) File "/usr/local/lib/python3.4/dist-packages/KNXmap-0.10.0-py3.4.egg/knxmap/bus/monitor.py", line 115, in print_message timestamp=codecs.encode(cemi.additional_information.get('timestamp'), 'hex'), TypeError: encoding with 'hex' codec failed (TypeError: 'NoneType' does not support the buffer interface)