GUI-O Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    command that returns the date and time and the day of the week

    Scheduled Pinned Locked Moved
    Comments & Feedback
    2
    12
    141
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Sato @Sato
      last edited by Sato

      Hello @kl3m3n,

      Sorry, that's now correct

      2025-07-05 12:45:01 6

      Sunday is weekday 7
      Monday is weekday 1

      K 1 Reply Last reply Reply Quote 0
      • K
        kl3m3n @Sato
        last edited by

        @Sato Hi!

        You can do this in the following way:

        Set the format to:

        "yyyy-MM-dd hh:mm:ss dddd"

        The dddd part should give the days:
        Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.

        Create a lookup table to convert this into a number from 1 to 7.

        P.S.: You can replace dddd with ddd, which will give you the short names for the days (e.g., Mon, Sun, ...).

        Best regards,
        Kl3m3n

        S 3 Replies Last reply Reply Quote 0
        • S
          Sato @kl3m3n
          last edited by

          Hello @kl3m3n,

          Thanks, after all this already exists in Gui-O, Real-time clock (RTC)

          I should have paid more attention when reading the manual, I'm sorry to be bothering you with something you've already implemented and from what I can see, a long time ago.

          In the next few days I'll check it out and use it to get the MCP7940 right.

          Thank you
          Best regards

          K 1 Reply Last reply Reply Quote 0
          • K
            kl3m3n @Sato
            last edited by

            @Sato No problem! 🙂

            1 Reply Last reply Reply Quote 0
            • S
              Sato @kl3m3n
              last edited by

              Thank you @kl3m3n,

              I've tried this, but it doesn't work, what mistake am I making?

                Serial.print("MQTT CONECTED " );
                Serial.println(mqttClient.state());
                mqttClient.subscribe(&Out[0]); //subscrive topic
              

              mqttClient.publish(&In[0], "RTC UID:rtc1 HID:rtc\r\n");

              Main loop {
              //for testing every 1000ms
              Serial.println("Get rtc ");
              //mqttClient.publish(&In[0], "@rtc1 RTCF:'HH:mm:ss' RTCR:2.0\n\r");
              mqttClient.publish(&In[0], "@rtc1 RTCF:HH:mm:ss RTCR:2.0\n\r");
              }

              void parseGuioMsg(const String &msg) {
              Serial.print("Callback Gui-O ");
              Serial.println(msg); // @init usr: //// here without reaction

              if (msg.startsWith("@rtc1")) {
              Serial.print("Show RTC "); // here without reaction too
              Serial.println(msg);
              }
              }

              S 1 Reply Last reply Reply Quote 0
              • S
                Sato @Sato
                last edited by

                Hello kl3m3n,

                Now i receive the callback @rtc1. The ceation of the command was on the wrong part of the code.

                Sorry and Thank You

                Best regards

                K 1 Reply Last reply Reply Quote 0
                • K
                  kl3m3n @Sato
                  last edited by

                  @Sato Yes, you were missing the '|' character.

                  BR,
                  Kl3m3n

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    Sato @kl3m3n
                    last edited by

                    Hello @kl3m3n,

                    You are right, but i continue have a problem with RTC, the ddd show not the dayofweek. Have you a idea what it is wrong?
                    Thank You

                    void generateTheGUI {
                    getRtc = 0;
                    Serial.println("Create command RTC");
                    mqttClient.publish(&In[0], "|RTC UID:rtc1 HID:rtc\r\n");
                    app_on = 1;
                    }

                    Main loop {
                    //only one time
                    if ((app_on == 1) && (getRtc == 0)) {
                    //mqttClient.publish(&In[0], "@rtc1\n\r"); ////same output on Serial Monitor
                    //mqttClient.publish(&In[0], "@rtc1 RTCF:hh:mm:ss ddd RTCR:5.0\n\r"); //same output on Serial Monitor
                    mqttClient.publish(&In[0], "@rtc1 RTCF:'hh:mm:ss ddd' RTCR:1.5\n\r"); //same output on Serial Monitor
                    delay(150);
                    mqttClient.publish(&In[0], "@rtc1 RTCE:0\n\r"); //Disable RTC ??????????????
                    getRtc = 1;
                    delay(150);
                    }
                    }

                    void parseGuioMsg(const String &msg) {
                    if (msg.startsWith("@rtc1")) {
                    Serial.print("Show RTC ");
                    Serial.println(msg);
                    }
                    }

                    On Serial Monitor, a few times, like this...
                    Show RTC @rtc1 2025/07/07 22:32:31:696 dev:W 0001 x.x uuid:d3f1c986-16b3-47
                    End Parse
                    Show RTC @rtc1 2025/07/07 22:32:33:696 dev:W 0001 x.x uuid:d3f1c986-16b3-47
                    End Parse
                    Show RTC @rtc1 2025/07/07 22:32:34:694 dev:W 0001 x.x uuid:d3f1c986-16b3-47
                    End Parse

                    1 Reply Last reply Reply Quote 0
                    • S
                      Sato @kl3m3n
                      last edited by

                      Hello @kl3m3n,

                      Now it works.

                      @rtc1 2025/17/12 20:17:05 sábado dev:W 0001 x.x uuid:d3f1c986-16b3-47

                      In this case, the WeekDay is sábado = Saturday. My question is how is the WeekDay, if the Guio is used in UK or Germany and so on...

                      Saturtday or Samstag or?

                      Thank You
                      Best regards

                      S K 2 Replies Last reply Reply Quote 0
                      • S
                        Sato @Sato
                        last edited by

                        @Sato said in command that returns the date and time and the day of the week:

                        2025/17/12

                        Show on callback
                        RTC @rtc1 2025-37-13 20:37:01 dev:W 0001 x.x uuid:d3f1c986-16

                        No, it not works, the date is wrong 2025/37/13, the time is correct

                        Thank you
                        Best regards

                        1 Reply Last reply Reply Quote 0
                        • K
                          kl3m3n @Sato
                          last edited by

                          @Sato Hi!

                          Yes, the localisation can be a problem.
                          I will fix the RTC so it will return the day of the week as a number.

                          @Sato said in command that returns the date and time and the day of the week:

                          No, it not works, the date is wrong 2025/37/13, the time is correct

                          Can you please provide the initialization for RTCF for this?

                          Thanks.

                          Best regards,
                          Kl3m3n

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post