meshtastic/website/docs/software/python/installation.md
2021-06-05 01:27:07 +01:00

5.6 KiB

id title sidebar_label
python-installation Meshtastic-python installation Installation

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

This is a python library for using Meshtastic devices. This small library (and example application) provides an easy API for sending and receiving messages over mesh radios. It also provides access to any of the operations/data available in the device user interface or the Android application. Events are delivered using a publish-subscribe model, and you can subscribe to only the message types you are interested in.

Full documentation for the library, including examples, is available.

If you wish to view the code or contribute to development of the python library or the command line interface, please visit the Meshtastic python GitHub page.

Installation is easily done through the Python package installer pip (note, you must use pip version 20 or later):

<Tabs groupId="operating-system" defaultValue="linux" values={[ {label: 'Linux', value: 'linux'}, {label: 'macOS', value: 'macos'}, {label: 'Windows', value: 'windows'}, {label: 'Termux for Android', value: 'termux'}, ]}>

  • Check that your computer has the required serial drivers installed
    • Connect your Meshtastic device to your USB port
    • Use the command
      lsusb
      
    • You should see something like CP210X USB to UART Bridge Controller
    • If not download the drivers from Silicon Labs.
  • Check that your computer has Python 3 installed.
    • Use the command
      python3 -V
      
    • If this does not return a version, install python
  • Pip is typically installed if you are using python 3 version >= 3.4
    • Check that pip is installed using this command
      pip3 -V
      
    • If this does not return a version, install pip
  • Install pytap2
    sudo pip3 install --upgrade pytap2
    
  • Install meshtastic:
    sudo pip3 install --upgrade meshtastic
    
  • Check that your computer has the required serial drivers installed
    • Connect your Meshtastic device to your USB port
    • Navigate to Apple Menu  > About This Mac > System Report... > Hardware > USB
    • You should see something like CP210X USB to UART Bridge Controller
    • If not download the drivers from Silicon Labs.
  • Check that your computer has Python 3 installed.
    • Use the command
      python3 -V
      
    • If this does not return a version, install python
      • The following uses Homebrew to install python3 which includes pip3.
      • Check if you have Homebrew installed with the following command
        brew -v
        
        If it's not installed, follow the instructions on the Homebrew website before continuing.
      • Install Python3
        brew install python3
        
  • Pip is typically installed if you are using python 3 version >= 3.4
    • Check that pip is installed using this command
      pip3 -V
      
    • If this does not return a version, install pip
  • Install pytap2
    sudo pip3 install --upgrade pytap2
    
  • Install meshtastic:
    sudo pip3 install --upgrade meshtastic
    
  • Check that your computer has the required serial drivers installed
    • Connect your Meshtastic device to your USB port
    • Open Device Manager
    • Under Ports (COM & LPT) you should see something like Silicon Labs CP210X USB to UART Bridge (COM5)
    • If not download the drivers from Silicon Labs.
  • Check that your computer has Python 3 installed.
    • Use the command
      py -V
      
    • If this does not return a version, install python
  • Pip is typically installed if you are using python 3 version >= 3.4
    • Check that pip is installed using this command
      pip3 -V
      
    • If this does not return a version, install pip
  • Install pytap2
    pip3 install --upgrade pytap2
    
  • Install meshtastic:
    pip3 install --upgrade meshtastic
    
  • Install Termux from the F-Droid app store (Google play does not currently support the latest builds)
  • Load Termux and update the package list
    pkg update
    
  • Upgrade the installed packages
    pkg upgrade
    
  • Install python
    pkg install python
    
  • Upgrade pip and installed meshtastic and its dependancies
    pip install --upgrade pip pytap2 wheel mesthtastic
    

:::note Be aware that currently the Meshtastic CLI is not able to control the nodes over USB through termux, but you can control devices over wifi using the --host x.x.x.x option with the device IP address. However, only ESP32 devices can use wifi currently. :::