RAK3172 - Arduino api call to request UTC time

Hi,
I’m using RAK3172 and there is an AT command to request the time from the network as documented below:

But i’m looking for a way to trigger the same using Arduino API.
The only one i was able to find is the get command for local time, but not the time request.

Is there a specific call or method or switch i can use within Arduino sketch to achieve the same ?

Welcome to the forum @mizer666

Every AT command for the RAK3172 should have a corresponding API call. It might not yet be in the documentation, as the time request is a quite new feature.

I found an example in the header files, but I am not sure if this is sufficient.
As far as I know you will need at least one uplink to the LNS to receive the time and your LNS must support it.

    /**@par	Description
	 *     	This api(a) allows the user to get the local time in a UTC format 
	 *
	 * @par	Syntax
	 *	api.lorawan.ltime.get()
	 *
	 * @return	the local time in a UTC format (Type: bool)
	 * @par         Example
         * @verbatim
       // OTAA Device EUI MSB
       uint8_t node_device_eui[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
       // OTAA Application EUI MSB
       uint8_t node_app_eui[8] = {0x0E, 0x0D, 0x0D, 0x01, 0x0E, 0x01, 0x02, 0x03};
       // OTAA Application Key MSB
       uint8_t node_app_key[16] = {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C};

       void setup()
       {
           Serial.begin(115200);

           api.lorawan.appeui.set(node_app_eui, 8);
           api.lorawan.appkey.set(node_app_key, 16);
           api.lorawan.deui.set(node_device_eui, 8);

           api.lorawan.band.set(4);
           api.lorawan.njm.set(1);
           api.lorawan.deviceClass.set(1);
           api.lorawan.join();

           //wait for Join success
           while (api.lorawan.njs.get() == 0)
           {
             Serial.print("Waiting for Lorawan join...");
             api.lorawan.join();
             delay(10000);
           }
       }

       void loop()
       {
           Serial.printf("The local time(UTC) is %s\r\n", api.lorawan.ltime.get().c_str());
           delay(1000);
       }
           @endverbatim
	 */

Thanks !
So the api command - api.lorawan.ltime.get() is reading the local time and it’s there.
I know the time request is a standard LoRaWAN MAC command, any idea how i can issue a MAC command using RUI3 ?
I was also under impression that if there is na AT command there is definitely an API to cover the same but it’s not there, in documentation and in the code.
If that’s true than - is there a way i can have a MCU send an AT command to itself ?

I think i was able to find it within the code, it is not exposed to api but you can call it directly as a service:

service_lora_set_timereq(1);

1 Like

It should be in the documents with the next official release of RUI3.

The V3.5.x versions are beta only and for testing (internal and with customers like you :wink:)

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.