I try to send data, I’m on MacOS up to date
code:
import meshtastic
interface = meshtastic.StreamInterface("/dev/tty.SLAB_USBtoUART")
# By default will try to find a meshtastic
# device, otherwise provide a device path like /dev/ttyUSB0
interface.sendText("hello mesh")
# or sendData to send binary data, see documentations for other options.
Error:
Traceback (most recent call last):
File “test.py”, line 6, in
interface.sendText(“hello mesh”)
File “/Users/user/git/meshtas/lib/python3.7/site-packages/meshtastic/init.py”, line 110, in sendText
dataType=mesh_pb2.Data.CLEAR_TEXT, wantAck=wantAck, wantResponse=wantResponse)
File “/Users/user/git/meshtas/lib/python3.7/site-packages/meshtastic/init.py”, line 121, in sendData
return self.sendPacket(meshPacket, destinationId, wantAck=wantAck)
File “/Users/user/git/meshtas/lib/python3.7/site-packages/meshtastic/init.py”, line 173, in sendPacket
meshPacket.id = self._generatePacketId()
File “/Users/user/git/meshtas/lib/python3.7/site-packages/meshtastic/init.py”, line 190, in _generatePacketId
self.currentPacketId = (self.currentPacketId + 1) & 0xffffffff
TypeError: unsupported operand type(s) for +: ‘NoneType’ and ‘int’
oh yah - see my other comment. I accidentally broke API support for old firmwares (pre 0.9). I’ll fix. (Or you can update the firmware per the README - it is pretty painless and highly recommended)
actually - my theory was wrong. Your not allowed to call sendText until after you have received “meshtastic.connection.established” (see main.py in meshtastic for an example).
The reason for that exception was that we haven’t yet received the node db from the device at that point. I’ll make the error clearer.
Thank you sounds logical. one last question: I’m not sure about the main .py file you are refering to, is it this one: https://github.com/meshtastic/Meshtastic-python/blob/master/meshtastic/__main__.py
?
Just in case:
I think I burn a led (the blue one) on one of my t-beam V1.1… I did a mistake when I solder the oled, so I removed it … to do that I heated a lot… do you have an idea if their is a way to check if gps or bluetooth is not dead in command line or Python script?
re: testing BLE hardware
If you have a phone you can check to see if the device is visible on the Bluetooth pairing device settings screen. Though I’ve heard iOS doesn’t show BLE devices. For iOS download the (free) NRF Connect app and that app will let you scan for BLE devices.
re: testing GPS hardware
easiest is probably to set the device outside for 15 mins or so and by then the red GPS lock led will start blinking (it is over near the GPS chip and directly controlled by that chip)
also: “meshtastic --info” will show a bunch of data, “has_gps” will be true if we’ve heard from the GPS.
ooh - btw that blue led is controlled directly by the axp192 power manager (and we talk to that chip via i2c to ask it to turn the led/on off). If that chip is warm and that led doesn’t work I bet the chip you fried is that chip. Which can happen if you insert the battery backwards (though newer versions of the tbeam now protect against this).
If you can capture the serial console (the meshtastic command will let you do this) and then press the reset button, one of the first few messages will be listing what i2c devices the cpu could find. I bet you’ll find that chip is missing.
I think the board could still work, but that chip also regulates battery charging, so if it is fried I wouldn’t recommend using a battery (because no overcharge protection). Also that chip provides power to the GPS, so if the GPS test fails - that’s why.
Thank you,
I confirm ios does not show BLE and the application NRF Connect works great to find it: very good application!
about the GPS so far I have “has_gps: true”, I’m going to test outdoor for GPS lock