• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

[Coding] update time from every 1 second to scheduled time

Scheduled Pinned Locked Moved Development
21 Posts 2 Posters 2.6k Views 2 Watching
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.
  • K Offline
    kent79 @sdetweil
    last edited by May 14, 2024, 12:03 AM

    @sdetweil

    Sorry, it still not working. I would like to share the module as below. Would you please help to fix it? Many thanks.

    https://www.dropbox.com/scl/fi/qxcbjuibaaaz7ojwr7ucs/MMM-Lunar.zip?rlkey=4zeyqxpp4ibchq2znb5mwpvjr&dl=0

    S 1 Reply Last reply May 14, 2024, 1:13 AM Reply Quote 0
    • S Offline
      sdetweil @kent79
      last edited by sdetweil May 14, 2024, 1:14 AM May 14, 2024, 1:13 AM

      @kent79 here you go
      use this repo

      git clone https://github.com/sdetweil/MMM-Lunar.git

      then u can git init to wipe out my repo

      the BIG cause was that your start routine
      called
      this.updateLunarCal();
      not
      this.updateLunarDate();

      start also doesn’t need to call fetchIt as the updateLunarDate does that after setting up the timer

      I cleaned up the rest…

      you can test by setting the ‘end time’ in ms…
      hour and minute and then see it fire the setTimeout handler
      see comment in the code

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      K 1 Reply Last reply May 14, 2024, 1:33 AM Reply Quote 0
      • K Offline
        kent79 @sdetweil
        last edited by May 14, 2024, 1:33 AM

        @sdetweil

        Thank you for your all effort. My dream is coming true soon.

        I have tested. No Luck. Don’t know is it coding program or my testing method wrong.

        I am using windows brower to connect MM server. Then, changing windows clock to 23:59. After 00:00, there is no any changing of Lunar date.

        S 1 Reply Last reply May 14, 2024, 2:03 AM Reply Quote 0
        • S Offline
          sdetweil @kent79
          last edited by sdetweil May 14, 2024, 2:30 AM May 14, 2024, 2:03 AM

          @kent79 said in [Coding] update time from every 1 second to scheduled time:

          I am using windows brower to connect MM server. Then, changing windows clock to 23:59.

          you have to set the clock BEFORE opening the MM page… it doesn’t reset when the clock changes…

          the code only sets up ONCE when loaded, so the clock has to be set first…

          learn to use the developers window, ctrl-shift-i , sources tab,

          you can step thru the code

          ohhhhhh

          and I gave it set to trigger BEFORE midnight… see the code, comment out and restore the 24×60… so you could test without having to reset the clock

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          K 1 Reply Last reply May 14, 2024, 2:31 AM Reply Quote 0
          • K Offline
            kent79 @sdetweil
            last edited by May 14, 2024, 2:31 AM

            @sdetweil

            I have tested again. But it is still not up to date while past 0:00 :(

            S 1 Reply Last reply May 14, 2024, 2:49 AM Reply Quote 0
            • S Offline
              sdetweil @kent79
              last edited by May 14, 2024, 2:49 AM

              @kent79 did u edit the code and change the constant back?

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              K 1 Reply Last reply May 14, 2024, 2:57 AM Reply Quote 0
              • K Offline
                kent79 @sdetweil
                last edited by May 14, 2024, 2:57 AM

                @sdetweil

                of course. I have still no idea

                S 1 Reply Last reply May 14, 2024, 3:17 AM Reply Quote 0
                • S Offline
                  sdetweil @kent79
                  last edited by May 14, 2024, 3:17 AM

                  @kent79 if you edit the constant so it is 5 minutes from now, does it trigger?

                  the fetch will still get today’s time

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  K 2 Replies Last reply May 14, 2024, 6:02 AM Reply Quote 0
                  • K Offline
                    kent79 @sdetweil
                    last edited by sdetweil May 14, 2024, 11:23 AM May 14, 2024, 6:02 AM

                    @sdetweil

                    I find out line 41 coding is wrong, the correct value is “MS_in_day = 10006060*24”. I have tested and work fine now. Thanks.

                    Orginal:
                    let MS_in_day =

                    20*60*60*1000+8*60*1000  //24*60*60*1000;
                    

                    New:

                    let MS_in_day = 1000*60*60*24;
                    
                    S 1 Reply Last reply May 14, 2024, 11:18 AM Reply Quote 0
                    • K Offline
                      kent79 @sdetweil
                      last edited by May 14, 2024, 10:58 AM

                      @sdetweil

                      1.png

                      Combined the lunar script to default clock module. It looks great. Thank you again for your great help. :)

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 2 / 3
                      2 / 3
                      • First post
                        11/21
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy