meshtastic / python

The Python CLI and API for talking to Meshtastic devices
https://meshtastic.org
371 stars 157 forks source link

[Bug]: Exception: Timed out waiting for connection completion #334

Closed amerinoj closed 2 years ago

amerinoj commented 2 years ago

Category

Serial

Hardware

T-Lora v2 1.6

Firmware Version

1.3.13.77a20542

Description

Hi, I can't connect to device from meshtastic-python for example from meshtastic-python version 1.3a16. I tested with more firmware version from 1.3.10 ahead and all has the same problem I don't know if the problem is in the device firmware or in meshtastic-python. Maybe aren't compatible?

I attach a debug ``

Relevant log output

DEBUG file:__main__.py common line:707 Not logging serial output
DEBUG file:serial_interface.py __init__ line:31 ports:['/dev/ttyACM0']
DEBUG file:serial_interface.py __init__ line:41 Connecting to /dev/ttyACM0
DEBUG file:stream_interface.py __reader line:129 in __reader()
DEBUG file:stream_interface.py __reader line:134 reading character
DEBUG file:stream_interface.py _sendToRadioImpl line:109 Sending: want_config_id: 3165846891
DEBUG file:stream_interface.py _sendToRadioImpl line:114 sending header:b'\x94\xc3\x00\x07' b:b'\xa0\x06\xeb\xfa\xcb\xe5\x0b'
DEBUG file:stream_interface.py __reader line:136 In reader loop
DEBUG file:stream_interface.py __reader line:134 reading character
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
DEBUG file:mesh_interface.py _handleFromRadio line:490 in mesh_interface.py _handleFromRadio() fromRadioBytes: b'\x1a1\x08\x8c\xc4\x8d\xae\x022\x0f1.3.13.77a20542P\t]\xbd\xae\x94Bh\xe0\xa7\x12p\xcc\x9e\x01x\x08\x90\x01\x01\xa5\x01y|\xd9='
DEBUG file:mesh_interface.py _handleFromRadio line:492 Received from radio: my_info {
  my_node_num: 633561612
  firmware_version: "1.3.13.77a20542"
  reboot_count: 9
  bitrate: 74.3412857055664
  message_timeout_msec: 300000
  min_app_version: 20300
  max_channels: 8
  has_wifi: true
  air_util_tx: 0.10619444400072098
}

DEBUG file:mesh_interface.py _handleFromRadio line:496 Received myinfo: my_node_num: 633561612 firmware_version: "1.3.13.77a20542" reboot_count: 9 bitrate: 74.3412857055664 message_timeout_msec: 300000 min_app_version: 20300 max_channels: 8 has_wifi: true air_util_tx: 0.10619444400072098
DEBUG file:stream_interface.py __reader line:134 reading character
DEBUG file:stream_interface.py __reader line:136 In reader loop
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
DEBUG file:mesh_interface.py _handleFromRadio line:490 in mesh_interface.py _handleFromRadio() fromRadioBytes: b'"@\x08\x8c\xc4\x8d\xae\x02\x12(\n\t!25c3620c\x12\x0cUnknown 620c\x1a\x03?0C"\x06Lu%\xc3b\x0c0\x03\x1a\x002\x0c\x08\\\x15\xbaI\x84@%\xe8mY='
DEBUG file:mesh_interface.py _handleFromRadio line:492 Received from radio: node_info {
  num: 633561612
  user {
    id: "!25c3620c"
    long_name: "Unknown 620c"
    short_name: "?0C"
    macaddr: "Lu%\303b\014"
    hw_model: TLORA_V2_1_1p6
  }
  position {
  }
  device_metrics {
    battery_level: 92
    voltage: 4.133999824523926
    air_util_tx: 0.053083330392837524
  }
}

DEBUG file:mesh_interface.py _handleFromRadio line:522 Received nodeinfo: {'num': 633561612, 'user': {'id': '!25c3620c', 'longName': 'Unknown 620c', 'shortName': '?0C', 'macaddr': 'THUlw2IM', 'hwModel': 'TLORA_V2_1_1p6'}, 'position': {}, 'deviceMetrics': {'batteryLevel': 92, 'voltage': 4.134, 'airUtilTx': 0.05308333}}
DEBUG file:stream_interface.py __reader line:134 reading character
DEBUG file:stream_interface.py __reader line:136 In reader loop
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
DEBUG file:mesh_interface.py _handleFromRadio line:490 in mesh_interface.py _handleFromRadio() fromRadioBytes: b'@\xeb\xfa\xcb\xe5\x0b'
DEBUG file:mesh_interface.py _handleFromRadio line:492 Received from radio: config_complete_id: 3165846891

DEBUG file:mesh_interface.py _handleFromRadio line:533 Config complete ID 3165846891
DEBUG file:node.py requestConfig line:64 requestConfig for nodeNum:633561612
DEBUG file:node.py _sendAdmin line:540 adminIndex:0
DEBUG file:mesh_interface.py sendData line:241 Serializing protobuf as data: get_radio_request: true
DEBUG file:mesh_interface.py sendData line:244 len(data): 2
DEBUG file:mesh_interface.py sendData line:245 mesh_pb2.Constants.DATA_PAYLOAD_LEN: 237
DEBUG file:mesh_interface.py _sendPacket line:359 Sending packet: to: 633561612 decoded { portnum: ADMIN_APP payload: " \001" want_response: true } id: 736025737 hop_limit: 3 want_ack: true
DEBUG file:stream_interface.py _sendToRadioImpl line:109 Sending: packet { to: 633561612 decoded { portnum: ADMIN_APP payload: " \001" want_response: true } id: 736025737 hop_limit: 3 want_ack: true }
DEBUG file:stream_interface.py _sendToRadioImpl line:114 sending header:b'\x94\xc3\x00\x1a' b:b'\x12\x18\x15\x0cb\xc3%"\x08\x08\x06\x12\x02 \x01\x18\x015\x89\xdc\xde+P\x03X\x01'
DEBUG file:stream_interface.py __reader line:134 reading character
DEBUG file:stream_interface.py __reader line:136 In reader loop
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
DEBUG file:mesh_interface.py _handleFromRadio line:490 in mesh_interface.py _handleFromRadio() fromRadioBytes: b'Z\x1e\r\x0cb\xc3%\x15\x0cb\xc3%"\x0b\x08\x05\x12\x02\x18\x005\x89\xdc\xde+5\x81\xce\x13~`x'
DEBUG file:mesh_interface.py _handleFromRadio line:492 Received from radio: packet {
  from: 633561612
  to: 633561612
  decoded {
    portnum: ROUTING_APP
    payload: "\030\000"
    request_id: 736025737
  }
  id: 2115227265
  priority: ACK
}

DEBUG file:node.py onResponseRequestSettings line:256 onResponseRequestSetting() p:{'from': 633561612, 'to': 633561612, 'decoded': {'portnum': 'ROUTING_APP', 'payload': b'\x18\x00', 'requestId': 736025737, 'routing': {'errorReason': 'NONE', 'raw': error_reason: NONE
}}, 'id': 2115227265, 'priority': 'ACK', 'raw': from: 633561612
to: 633561612
decoded {
  portnum: ROUTING_APP
  payload: "\030\000"
  request_id: 736025737
}
id: 2115227265
priority: ACK
, 'fromId': '!25c3620c', 'toId': '!25c3620c'}
ERROR file:stream_interface.py __reader line:171 Error while handling message from radio 'admin'
Traceback (most recent call last):
  File "/home/chst/.local/lib/python3.8/site-packages/meshtastic/stream_interface.py", line 169, in __reader
    self._handleFromRadio(self._rxBuf[HEADER_LEN:])
  File "/home/chst/.local/lib/python3.8/site-packages/meshtastic/mesh_interface.py", line 536, in _handleFromRadio
    self._handlePacketFromRadio(fromRadio.packet)
  File "/home/chst/.local/lib/python3.8/site-packages/meshtastic/mesh_interface.py", line 688, in _handlePacketFromRadio
    handler.callback(asDict)
  File "/home/chst/.local/lib/python3.8/site-packages/meshtastic/node.py", line 263, in onResponseRequestSettings
    self.radioConfig = p["decoded"]["admin"]["raw"].get_radio_response
KeyError: 'admin'
DEBUG file:stream_interface.py __reader line:134 reading character
DEBUG file:stream_interface.py __reader line:136 In reader loop
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
DEBUG file:mesh_interface.py _handleFromRadio line:490 in mesh_interface.py _handleFromRadio() fromRadioBytes: b'Z\x1e\r\x0cb\xc3%\x15\x0cb\xc3%"\x0b\x08\x05\x12\x02\x18\x085\x89\xdc\xde+5\x82\xce\x13~`x'
DEBUG file:mesh_interface.py _handleFromRadio line:492 Received from radio: packet {
  from: 633561612
  to: 633561612
  decoded {
    portnum: ROUTING_APP
    payload: "\030\010"
    request_id: 736025737
  }
  id: 2115227266
  priority: ACK
}

DEBUG file:mesh_interface.py _handlePacketFromRadio line:690 Publishing meshtastic.receive.routing: packet={'from': 633561612, 'to': 633561612, 'decoded': {'portnum': 'ROUTING_APP', 'payload': b'\x18\x08', 'requestId': 736025737, 'routing': {'errorReason': 'NO_RESPONSE', 'raw': error_reason: NO_RESPONSE }}, 'id': 2115227266, 'priority': 'ACK', 'raw': from: 633561612 to: 633561612 decoded { portnum: ROUTING_APP payload: "\030\010" request_id: 736025737 } id: 2115227266 priority: ACK , 'fromId': '!25c3620c', 'toId': '!25c3620c'} 
DEBUG file:stream_interface.py __reader line:134 reading character
DEBUG file:__main__.py onReceive line:29 in onReceive() d:{'portnum': 'ROUTING_APP', 'payload': b'\x18\x08', 'requestId': 736025737, 'routing': {'errorReason': 'NO_RESPONSE', 'raw': error_reason: NO_RESPONSE
}}
DEBUG file:stream_interface.py __reader line:136 In reader loop
DEBUG file:stream_interface.py __reader line:134 reading character
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
.(repeat message)
Traceback (most recent call last):
  File "__main__.py", line 970, in <module>
    main()
  File "__main__.py", line 950, in main
    common()
  File "__main__.py", line 723, in common
    client = meshtastic.serial_interface.SerialInterface(args.port, debugOut=logfile, noProto=args.noproto)
  File "/home/chst/.local/lib/python3.8/site-packages/meshtastic/serial_interface.py", line 57, in __init__
    StreamInterface.__init__(self, debugOut=debugOut, noProto=noProto, connectNow=connectNow)
  File "/home/chst/.local/lib/python3.8/site-packages/meshtastic/stream_interface.py", line 50, in __init__
    self.connect()
  File "/home/chst/.local/lib/python3.8/site-packages/meshtastic/stream_interface.py", line 74, in connect
    self._waitConnected()
  File "/home/chst/.local/lib/python3.8/site-packages/meshtastic/mesh_interface.py", line 402, in _waitConnected
    raise Exception("Timed out waiting for connection completion")
Exception: Timed out waiting for connection completion
caveman99 commented 2 years ago

That's a known problem from the latest protobuf change. We're actively looking for python contributors to bring the lib up to speed.

mkinney commented 2 years ago

Just got the --info kinda working on the latest beta.

garthvh commented 2 years ago

This is fixed in 1.3.20

Both --nodes and --info are working, there is data missing.

you can also run

--shutdown --reset

And save region.