Skip to content

booyaa/hello-meshtastic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resources

Examples

Tip

To set environment variable in PowerShell use $env:TCP_HOSTNAME="1.2.3.4". For linux-ish use export TCP_HOSTNAME="1.2.3.4".

Work in progress

Warning

These scripts maybe non-functional

  • Waiting for ACK - getting an ack from messages using the sendtext method
  • Rover - control a robotic rover via meshtastic

Side Quests

CLI overrides (for overriding changes)

# turn off wifi
uvx meshtastic --host 1.2.3.4 --set network.wifi_enabled false

# setting modem preset
uvx meshtastic --serial --set lora.modem_preset SHORT_TURBO # this won't work in EU_868
uvx meshtastic --serial --set lora.modem_preset SHORT_FAST # use this instead

# modem preset defaults
uvx meshtastic --serial --set lora.modem_preset LONG_FAST
uvx meshtastic --serial --set lora.bandwidth 0
uvx meshtastic --serial --set lora.spread_factor 0
uvx meshtastic --serial --set lora.coding_rate 0
uvx meshtastic --serial --set lora.frequency_offset 0.0

Bluetooth

systemctl status bluetooth
bluetoothctl
list # show our controllers
scan on # show pairable devices
scan le # low energy devices?
devices # show paired devices

uvx meshtastic --ble-scan # get list of devices to pair with
uvx meshtastic --ble _DEVICE_

ClockBot feature testing in REPL

python
>>> import clock_bot
>>> clock_bot.weather_forecast()

News

>>> first_item = parse_news.rss.channel.items[0]
>>> print(f"BONG! Local news: {first_item.title.content} {first_item.guid.content}")
BONG! Local news: Dance venue 'won't become car park' as offers made https://www.bbc.com/news/articles/cj0y7jp5nrgo#0
>>> print(len(f"BONG! Local news: {first_item.title.content} {first_item.guid.content}"))
117

>>> len([item.title.content for item in parse_news.rss.channel.items])
22

>>> " ".join([item.title.content for item in parse_news.rss.channel.items])
"Dance venue 'won't become car park' as offers made Woman seriously injured in hit-and-run collision Swimmer, 23, who died had 'the biggest heart' Twins killed in holiday crash 'had special bond' 'Wonderful' ferry resumes crossings after repairs Hemp is star attraction at girls' football event Opening of £47m bypass hailed as 'historic day' Crews tackle forest fire close to A-road Motorcyclist in 50s dies following collision Library locks its doors when open due to anti-social incidents Social clubs warn locals to 'use it or lose it' Chinook crash victim 'would want answers', says sister Hemp grateful for 'special' Carrow Road moment Forson to miss Watford cup tie with hamstring injury Norwich squad still 'building relationships' - Wright Norwich have 'huge amount to do' - Manning The East Anglian rivalry from behind the mic Goreham celebrates 25 years of Canaries commentary ‘Transformational’ bypass now open What’s new at Norwich Castle? Farmwatch How will sale of Norwich Airport affect Norfolk?"
>>> len(" ".join([item.title.content for item in parse_news.rss.channel.items]))
1010

Train times

See also #trains

curl -LO https://trntxt.uk/norwich/londonliverpoolstreet # reduced html no JS (I think)
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash # cargobinstall
export PATH=$HOME/.cargo/bin
cargo-binstall htmlq
cat londonliverpoolstreet | htmlq 'div' --remove-nodes br

MQTT

reference: chi-mesh

Works on my T1000-e

  • lora
    • ignore MQTT: off
    • OK to MQTT: on
  • MQTT
    • enabled: on
    • MQTT Client proxy: on
    • Connect to MQTT via Proxy: on
    • Encryption Enabled: on
    • Map report enabled: off
    • Root topic: msh/EU_868/England/Norfolk # check side by side, it has to be identical on all MQTT clients!
  • channel
    • name: # must be the same on all MQTT client!
    • default: key AQ==
    • uplink: on
    • downlink: on # otherwise we don't get messages
    • allow position requests: off

Worked once on Heltec V3

  • lora
    • ignore MQTT: off # turning on, stops messages from arriving
    • OK to MQTT: on
  • MQTT
    • enabled: on
    • MQTT Client proxy: on
    • Connect to MQTT via Proxy: on
    • Encryption enabled: on
    • JSON enabled: on
    • Map report enabled: off
    • Root topic: msh/EU_868/England/Norfolk # check side by side, it has to be identical on all MQTT clients!
  • channel
    • name: # must be the same on all MQTT client!
    • default: key AQ==
    • uplink: on
    • downlink: on # otherwise we don't get messages
    • allow position requests: off

Using noproto to debug MQTT

meshtastic -s --no-proto

Using mosquitto tools

# JSON end point
mosquitto_sub \
  -h mqtt.meshtastic.org -u meshdev -P large4cats \
  -t 'msh/EU_868/England/Norfolk/2/json/CHANNEL_NAME/#' --id 'gandalf-boo'

# THis doesn't work
mosquitto_pub -h mqtt.meshtastic.org -u meshdev -P large4cats -t 'msh/EU_868/England/Norfolk/2/json/YOUR_CHANNEL' --id 'gandalf-boo' -m '{"channel":x,"from":xxx,"hop_start":x,"hops_away":x,"id":xxx,"payload":{"text":"you know it!"},"sender":"!deadface","timestamp":0,"to":xxx,"type":"text"}'
{
  "channel":2,
  "from":1111,
  "hop_start":3,
  "hops_away":0,
  "id":3907767157,
  "payload":{"text":"Boom bip "},
  "rssi":-16,"sender":"!deadface","snr":6,"timestamp":0,"to":4294967295,"type":"text"}

Flashing hardware

Heltec v3

  • Plug in Data USB cable
  • Restart radio
  • Go to https://flasher.meshtastic.org/
  • Select Heltec v3 from the Heltec
  • Select latest alpha
  • Update (device notification will pop up - you'll be asked to connect to serial device. Select USB CHS)

T1000-e

  • Plug in Data cable
  • Go to https://flasher.meshtastic.org/
  • Select T1000-e from the Seeed
  • Select latest alpha
  • Go into DFU mode (solid green) - drive will open up called T1000-E (usually D or E)
  • Download firmware
  • Drop UF2 into T1000-E drive, you'll get a pop up saying drive was disconnected (that's okay)

If stuck in DFU mode, try holding down the button until power down. You might need to try to do the quick toggle with the magnetic power connects.

Seeed XIAO ESP S3 and Wio SX-1262

  • Remove radio (it's easier to reach the button)
  • Press (B)oot button (left side button f USB is pointing to you) and plug in data cable
  • Light will go red
  • Go to https://flasher.meshtastic.org/
  • Select Seeed Xiao ESP32-S3 from the Seeed (or use autodetect)
  • Select latest alpha
  • Pop up - Pair with USB JTAG/serial debug unit COM10

WSL miscellany

Mostly cribbed from the docs.

  • install usbipd-win winget install usbipd
  • run powershell as admin

Tip

CTRL whilst clicking on "+" to add new Powershell (default terminal) launch as admin

[ADMIN]:PS > usbipd list
Connected:
BUSID  VID:PID    DEVICE                                                        STATE
1-5    xxxx:yyyy  Integrated Webcam                                             Not shared
1-7    xxxx:yyyy  Intel(R) Wireless Bluetooth(R)                                Not shared
1-9    239a:8029  USB Serial Device (COM6)                                      Shared
^-- probably this device

Persisted:
GUID                                  DEVICE
cacc70df-a44d-43dd-8da7-989145bddbd8  Silicon Labs CP210x USB to UART Bridge (COM3)

[ADMIN]:PS > usbipd bind --busid=1-9

[ADMIN]:PS C:\Users\marks> usbipd attach --wsl  --busid=1-9
usbipd: info: Using WSL distribution 'Ubuntu-22.04' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Loading vhci_hcd module.
usbipd: info: Detected networking mode 'nat'.
usbipd: info: Using IP address 1.2.3.4 to reach the host.
  • open WSL
$ lsusb
Bus 002 Device 001: ID xxxx:yyyy Linux Foundation 3.0 root hub
Bus 001 Device 002: ID xxxx:yyyy Adafruit T1000-E-BOOT <--- probably this one
Bus 001 Device 001: ID xxxx:yyyy Linux Foundation 2.0 root hub

$ $uvx meshtastic -s --info # should detect a valid serial
Connected to radio




## Further Reading

### Official Docs

- [API docs](https://python.meshtastic.org/index.html)
- [pubsub topics](https://python.meshtastic.org/#published-pubsub-topics)

### Code Examples from the internet

- [API examples](https://github.com/meshtastic/python/tree/master/examples)
- [pdxlocations/Mestastic-Python-Examples](https://github.com/pdxlocations/Meshtastic-Python-Examples/tree/main)
- [logging file and console handlers](https://stackoverflow.com/a/46098711)

### Guides

- [mestasticd on wsl](https://meshtastic.org/docs/development/reference/md_wsl/)

### Tools

- [web client](https://client.meshtastic.org/)

About

meshtastic learnings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published