Python command to set location with negative values?

Have a question on the subject but not about this particular situation.

How do I set a W longitude? The negative symbol creates an argument and error.

Example: meshtastic --setlon -8344929

I moved this to a new topic so the answer to this question will be easer for people to find. In general tagging on to an old topic isn’t ideal unless it is directly related and improves the original discussion.

For questions like this a new topic that has a clear title will help others down the road.

Thank you. Wasn’t sure if a semi-relevant question would be better suited in a semi-relevant thread after a search or in a freestanding thread.

I don’t have a working python env and radio right now so there isn’t much I can do to help on testing.

Did you see this post? How to properly set a fixed position?

A lot of things have changed in the past year and while I know some of the set commands have been modified I don’t know the specifics.

Geeksville added a cool feature so when you run:

meshtastic --set

It should list all the options that are possible.

“-” and “–” are usually considered flags to tell the program the next part is an argument / command. When you want to use - as part of a value you can try putting it in quotes like this:

–setExample “-1234”

I hope that helps, I gave it some time before responding thinking someone with the actual, specific answer would reply. I’m more of a generalist when it comes to the project specifics.

I’m not able to reproduce the problem:

$ sudo meshtastic --port /dev/ttyS3 --setlon -8344929
Connected to radio
Fixing longitude at -8344929.0 degrees
Setting device position
Aborting due to: Value out of range: -83449290000000

It looks like it’s working correctly (i.e. not making -8344929 an additional argument, but a parameter for --setlon) on 1.2.33. What version are you using?

I tested this today as well, the last line leads me to believe it’s not setting things correctly.

Aborting due to: Value out of range: -83449290000000 I however just realized I never tested it with a positive value. I’ll check it tomorrow.

Can you follow up the above command with meshtastic —info to confirm the devices location has actually changed?

Oh, it definitely hasn’t changed. -8344929 is not valid. You probably want this instead:

$ sudo meshtastic --port /dev/ttyS3 --setlon -83.44929
Connected to radio
Fixing longitude at -83.44929 degrees
Setting device position  

(Regardless, --info won’t do any good; my unit has a GPS receiver, so it shows the actual location instead of what I set it to.)

I didn’t realize —info shows current location and not the set fixed location. I’ll include some of these details in the docs!

The positive value did set the longitude, but that longitude is in China. IE East longitude.

Using a decimal point within the value has worked.

Thank you all for the help!

So how would we see the fixed position? Does info need to show that too?

I did some testing this morning and the above info is incorrect.

meshtastic --setlat 37.8651 --setlon -119.5383
Connected to radio
Fixing latitude at 37.8651 degrees
Fixing longitude at -119.5383 degrees
Setting device position

The fixed location is shown in --info. I’m using a TBEAM with a GPS antenna attached. And my CLI meshtastic version is v1.2.33

meshtastic --info
Connected to radio

Owner: jfirwin (jfr)

My info: { "myNodeNum": 12345678, "hasGps": true, "numBands": 13, "firmwareVersion": "1.2.30.80e4bc6", "rebootCount": 34, "messageTimeoutMsec": 300000, "minAppVersion": 20200, "maxChannels": 8 }

Nodes in mesh:
  {'num': 12345678, 'user': {'id': '!myid12345', 'longName': 'jfirwin', 'shortName': 'jfr', 'macaddr': 'MYMACADDRESS', 'hwModel': 'TBEAM'}, 'position': {'latitudeI': 378651000, 'longitudeI': -1195383000, 'altitude': 1352, 'batteryLevel': 71, 'time': 1621522143, 'latitude': 37.8651, 'longitude': -119.53829999999999}, 'lastHeard': 1621522143}

Any ideas on how to unset the fixed location? I’ve tried

meshtastic --set fixed_position false # ended up being correct, see update below
meshtastic --setlat 0 --setlon 0 # doesn't work
meshtastic --setlat "" --setlon ""  # doesn't work
meshtastic --set gps_operation GpsOpUnset  # doesn't work

And tried rebooting a few times, all with no success. Maybe I didn’t wait long enough for the device to attempt a gps fix after the command? I thought the reboot would force a lock though.

Update: The following did reset the device location, but you have to wait the duration of position_broadcast_seconds. I assume that’s because this variable is nested in the “Nodes in mesh” database or something to that effect.

meshtastic --set fixed_position false
1 Like