• Iced Raktajino@startrek.website
    link
    fedilink
    arrow-up
    3
    ·
    8 days ago

    If you’re provisioning several or just like to have a good baseline for setting up future nodes, I like to use the Python client and make a provisioning script. I feel like it’s way uglier than it should be, but I’ve found that even though the docs say you can specify multiple config options in one call, they don’t all apply. So I have to do them in stages and wait for it to reboot between executing each config.

    This is my baseline provisioning script for reference. I like to have a private default channel but then also set the radio frequency manually to the “default” LongFast of 906.875 MHz and create the LongFast channel as a secondary so I can communicate with people using the default config (which is very common). This also lets me relay for them (and vice versa) while not sharing my location and such with the public mesh.

    #!/bin/bash
    # Optionally set the device name and short name.  If not provided, the user info step is skipped
    DEVICE_NAME=$1
    DEVICE_SHORT_NAME=$2
    
    # Admin key is optional but I set it on all of my managed nodes. If not using that, comment out the line further down where this is referenced
    ADMIN_KEY="{PUBLIC_KEY_OF_ADMIN_NODE}"
    
    # Use a private default channel.  
    PRIMARY_CHANNEL_KEY="{BASE64_PRIVATE_KEY_FOR_PRIMARY_CHANNEL}"
    PRIMARY_CHANNEL_NAME="{PRIMARY_CHANNEL_NAME}"
    
    
    function wait_for_reboot {
      echo "Press <ENTER> once device has rebooted"
      read a
    }
    
    echo "Setting LoRa Region..."
    meshtastic --set lora.region US
    wait_for_reboot
    
    # If device name and short name are supplied, set those
    if [ -n "$DEVICE_NAME" ] && [ -n $DEVICE_SHORT_NAME ]
    then
      echo "Setting Device Name..."
      meshtastic \
        --set-owner "$DEVICE_NAME" \
        --set-owner-short "$DEVICE_SHORT_NAME"
      wait_for_reboot
    fi
    
    # Set most options
    meshtastic --set display.screen_on_secs 120 \
      --set display.units IMPERIAL \
      --set device.led_heartbeat_disabled false \
      --set telemetry.device_telemetry_enabled true \
      --set lora.use_preset true \
      --set lora.modem_preset LONG_FAST \
      --set security.admin_key base64:$ADMIN_KEY \
      --set lora.override_frequency 906.875 
    
    wait_for_reboot
    
    meshtastic --set-canned-message "Affirmative|Negative|Unknown|Acknowledged|Require Assistance|Check-In Good|Check-In Bad|Status?"
    wait_for_reboot
    
    
    meshtastic \
      --ch-index 0 --ch-set psk base64:$PRIMARY_CHANNEL_KEY --ch-set name "$PRIMARY_CHANNEL_NAME" \
      --ch-index 1 --ch-set psk base64:AQ== --ch-set name "LongFast"
    wait_for_reboot
    
    meshtastic --set-time