How can I set the RTC in HelTec LoRa WiFi ESP32 get the time using Python API?

how can I set the RTC in HelTec ESP32 LoRa WiFi (V2) get the time using Python API ?

yes. You can look at in the meshtastic-python project for an example of this. Search for “settime”

I used the following command in the terminal:
meshtastic --settime
I got this output:
Screenshot from 2021-04-01 11-28-43

My question is from where I can access the value and can use it in my python desktop application?

The following value should be quite close:


should be the time (in seconds since 1970) of the last time the local node was seen on the net (which should be almost now, because it will get updated when it talks to the pc)

(this assumes 1.2 or later)

(the field names might be slightly different - I typed this from memory)

1 Like

is interface.nodesByNum[interface.my_node_num].last_heard in or

nodesByNum is a property on the instance returned when you create a SerialInterface()

after updating the firmware to 1.2.20 and meshtastic library in my laptop my desktop application for peer to peer communication is showing error as follows.

Please help me with the fix, previously it was running fine. Now whatever the entry is given is not coming on the MeshtasticGUI screen. If you want I shall share my code.

Hmm. I think you’ll want to put a breakpoint so you can debug what attribute it is not finding. Can you post a link to the code?

The following is the link of the code:

Please download and myFile.txt. The program is supposed to read text line by line from the myFile.txt file by clicking on the RAND button in the GUI application. It is working fine with 1.1.32

@geeksville Could you please tell me, which API class or function is responsible for receiving the acknowledgement(ACK) or (NAK)? Is it receiving the acknowledgement time as well?

Hi! I think I made a fix for your code and included some tips on how to debug things like this in the future:

The python API mostly ignores acks/naks, though you can handle them yourself like any other packet. You can see their structure by running “meshtastic --debug”.

For operations that are marked as wantResponse, we will forward the response or any NAKs that we received for that response to a provided response handler. For an example of this see meshtastic.node._requestSettings.

Does that help?

1 Like

Thanks a lot Kevin, for your time and effort. I shall run the code on new devices and shall let you know.

1 Like