Meshtastic

Would you like your device's BLE link to not go to sleep? do this

A number of people have asked for this feature.

It is coming to the android in the next weekish, but you can do it now with the python tool. Here’s an example:

You can also use this tool to set any of the device parameters which are stored in persistent storage. For instance, here’s how to set the device to keep the bluetooth link alive for eight hours (any usage of the bluetooth protcol from your phone will reset this timer)

pip3 install --upgrade meshtastic

meshtastic --setpref wait_bluetooth_secs 28800
Connected to radio...
Setting preference wait_bluetooth_secs to 28800
Writing modified preferences to device...
2 Likes

btw - I (just noticed) apparently lied :smiling_face_with_three_hearts: about this coming next week. It got pushed out of the 1.0 bucket. But ‘someday’ after 1.0 is out there will be a GUI to either do this in the android app or we will have a cross platform app with this feature.

I tried to change the preferences (wait_bluetooth_secs, screen_on_secs and position_broadcast_secs) using this method, but they do not change. Any ideas?

~# meshtastic --device /dev/ttyS7 --setpref position_broadcast_secs 890
Trigger powerFSM 9
Trigger powerFSM 11
Transition powerFSM transition=serial API, from=ON to=SERIAL
Shutdown BT: 236540 heap size
Connected to radio
Setting preference position_broadcast_secs to 890
Writing modified preferences to device

~# meshtastic --device /dev/ttyS7 --info
Trigger powerFSM 9
Trigger powerFSM 11
Transition powerFSM transition=serial API, from=ON to=SERIAL
Shutdown BT: 237292 heap size
Connected to radio
my_node_num: 3045257416
has_gps: true
num_channels: 10
region: “1.0-EU865”
hw_model: “tbeam”
firmware_version: “0.9.1”
packet_id_bits: 32
current_packet_id: 1244544177
node_num_bits: 32
message_timeout_msec: 300000
min_app_version: 172

preferences {
position_broadcast_secs: 900
send_owner_interval: 4
wait_bluetooth_secs: 120
screen_on_secs: 300
phone_timeout_secs: 900
phone_sds_timeout_sec: 7200
mesh_sds_timeout_secs: 7200
sds_secs: 31536000
ls_secs: 3600
}

1 Like

Hi,
This works on my tlora-v1. I see that I am running a later firmware than you. I don’t know if anything in this area was changed in the latest releases.
I also did a ‘pip3 install --upgrade meshtastic’ to make sure I am running the latest meshtastic.

~$ meshtastic --setpref position_broadcast_secs 890
Trigger powerFSM 9
Connected to radio
Setting preference position_broadcast_secs to 890
Writing modified preferences to device

~$ meshtastic --info
Trigger powerFSM 9
Connected to radio
my_node_num: 3220213000
num_channels: 10
region: "1.0-EU865"
hw_model: "tlora-v1"
firmware_version: "0.9.3"
packet_id_bits: 32
current_packet_id: 383638496
node_num_bits: 32
message_timeout_msec: 300000
min_app_version: 172

preferences {
  position_broadcast_secs: 890
  send_owner_interval: 4
  wait_bluetooth_secs: 120
  screen_on_secs: 300
  phone_timeout_secs: 900
  phone_sds_timeout_sec: 7200
  mesh_sds_timeout_secs: 7200
  sds_secs: 31536000
  ls_secs: 3600
}
channel_settings {
  modem_config: Bw125Cr48Sf4096
  psk: "\324\361\273: )\007Y\360\274\377\253\317Ni\277"
  name: "Default"
}

Nodes in mesh:
{'num': 3220213000, 'user': {'id': '!3c71bff08d08', 'longName': 'Unknown 8d08', 'shortName': '?08', 'macaddr': 'PHG/8I0I'}, 'position': {'batteryLevel': 80, 'time': 1598602175}}
{'num': 681022624, 'user': {'id': '!246f289794a0', 'longName': 'Claes', 'shortName': 'C', 'macaddr': 'JG8ol5Sg'}, 'position': {'altitude': 87, 'batteryLevel': 100, 'latitudeI': 594479827, 'longitudeI': 134290121, 'time': 1598602087, 'latitude': 59.4479827, 'longitude': 13.4290121}, 'snr': 9.5}
1 Like

I tried updating python meshtastic and device to 0.9.3, but still not working…

Lets see if @geeksville has an idea to what could be wrong in your case.

Hmm. Can you post what your device shows when running the two commands @claesg used?

~# meshtastic --device /dev/ttyS7 --setpref position_broadcast_secs 890
Trigger powerFSM 9
Trigger powerFSM 11
Transition powerFSM transition=serial API, from=ON to=SERIAL
Shutdown BT: 236716 heap size
Connected to radio
Setting preference position_broadcast_secs to 890
Writing modified preferences to device

~# meshtastic --device /dev/ttyS7 --info
Trigger powerFSM 9
Trigger powerFSM 11
Transition powerFSM transition=serial API, from=ON to=SERIAL
Shutdown BT: 237264 heap size
Connected to radio
my_node_num: 3045257416
has_gps: true
num_channels: 10
region: “1.0-EU865”
hw_model: “tbeam”
firmware_version: “0.9.3”
packet_id_bits: 32
current_packet_id: 1658477235
node_num_bits: 32
message_timeout_msec: 300000
min_app_version: 172

preferences {
position_broadcast_secs: 900
send_owner_interval: 4
wait_bluetooth_secs: 120
screen_on_secs: 300
phone_timeout_secs: 900
phone_sds_timeout_sec: 7200
mesh_sds_timeout_secs: 7200
sds_secs: 31536000
ls_secs: 3600
}
channel_settings {
modem_config: Bw125Cr48Sf4096
psk: “\324\361\273: )\007Y\360\274\377\253\317Ni\277”
name: “Default”
}

Nodes in mesh:
{‘num’: 3045257416, ‘user’: {‘id’: ‘!8caab582f0c8’, ‘longName’: ‘Unknown f0c8’, ‘shortName’: ‘?C8’, ‘macaddr’: ‘jKq1gvDI’}, ‘position’: {‘time’: 315964850}}

Im using Python 3.6.9 if that could be related?

I am running Python 3.8.2
I also tried with a t-beam. I get the same correct and expected result.

what is the output from
pip3 install --upgrade meshtastic

I get
$ pip3 install --upgrade meshtastic
Requirement already up-to-date: meshtastic in ./.local/lib/python3.8/site-packages (1.0.0)
Requirement already satisfied, skipping upgrade: pexpect>=4.6.0 in /usr/lib/python3/dist-packages (from meshtastic) (4.6.0)
Requirement already satisfied, skipping upgrade: dotmap>=1.3.14 in ./.local/lib/python3.8/site-packages (from meshtastic) (1.3.14)
Requirement already satisfied, skipping upgrade: protobuf>=3.6.1 in /usr/lib/python3/dist-packages (from meshtastic) (3.6.1)
Requirement already satisfied, skipping upgrade: pyserial>=3.4 in ./.local/lib/python3.8/site-packages (from meshtastic) (3.4)
Requirement already satisfied, skipping upgrade: pygatt>=4.0.5 in ./.local/lib/python3.8/site-packages (from meshtastic) (4.0.5)
Requirement already satisfied, skipping upgrade: pypubsub>=4.0.3 in ./.local/lib/python3.8/site-packages (from meshtastic) (4.0.3)
Requirement already satisfied, skipping upgrade: enum-compat in ./.local/lib/python3.8/site-packages (from pygatt>=4.0.5->meshtastic) (0.0.3)

~# pip3 install --upgrade meshtastic
Requirement already up-to-date: meshtastic in /usr/local/lib/python3.6/dist-packages
Requirement already up-to-date: pyserial>=3.4 in /usr/lib/python3/dist-packages (from meshtastic)
Requirement already up-to-date: protobuf>=3.6.1 in /usr/local/lib/python3.6/dist-packages (from meshtastic)
Requirement already up-to-date: pypubsub>=4.0.3 in /usr/local/lib/python3.6/dist-packages (from meshtastic)
Requirement already up-to-date: pygatt>=4.0.5 in /usr/local/lib/python3.6/dist-packages (from meshtastic)
Requirement already up-to-date: pexpect>=4.6.0 in /usr/local/lib/python3.6/dist-packages (from meshtastic)
Requirement already up-to-date: dotmap>=1.3.14 in /usr/local/lib/python3.6/dist-packages (from meshtastic)
Requirement already up-to-date: setuptools in /usr/local/lib/python3.6/dist-packages (from protobuf>=3.6.1->meshtastic)
Requirement already up-to-date: six>=1.9 in /usr/local/lib/python3.6/dist-packages (from protobuf>=3.6.1->meshtastic)
Requirement already up-to-date: enum-compat in /usr/local/lib/python3.6/dist-packages (from pygatt>=4.0.5->meshtastic)
Requirement already up-to-date: ptyprocess>=0.5 in /usr/local/lib/python3.6/dist-packages (from pexpect>=4.6.0->meshtastic)