• 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.

MMM-OpenmapWeather sunrise and sunset times are GMT

Scheduled Pinned Locked Moved Unsolved Troubleshooting
5 Posts 3 Posters 964 Views 3 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.
  • R Offline
    rsiggins
    last edited by Nov 11, 2023, 7:07 PM

    MMM-OpenmapWeather sunrise and sunset times are GMT, not my PI timezone.
    I have looked and can’t find where anyone else has logged this problem. The sunset and sunrise times displayed by MMM-OpenmapWeather are off by 5 hours. Since I’m in EST zone it appears to me to be displaying the GMT time. The sunrise and sunset times are correct when adjusted by 5 hours. I have two MagicMirror systems with the same problem. I have checked the time and timezone settings for the Pi and they are correct.

    I tried swapping out MMM-OpenmapWeather with the standard Weather module but the problem persists.

    S M 2 Replies Last reply Nov 11, 2023, 8:05 PM Reply Quote 0
    • S Offline
      sdetweil @rsiggins
      last edited by Nov 11, 2023, 8:05 PM

      @rsiggins what time one is your system time set to?

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      R 1 Reply Last reply Nov 13, 2023, 2:51 AM Reply Quote 0
      • M Offline
        MMRIZE @rsiggins
        last edited by Nov 12, 2023, 3:32 PM

        @rsiggins
        In my test, the module itself returns the right time of the target place converted to my local timezone. Anyway, there may be some special reason for your case.

        Of course, the developer should look inside to know what really happened. But as a emergency cure, you can use some monkey-patching before real fixation from the developer.

        {
        	module: "MMM-ModuleMonkeyPatch",
        	config: {
        		patches: [
        			{
        				module: "MMM-OpenmapWeather",
        				method: "processWeather",
        				patch: function (original, args) {
        					const [ data ] = args
        					const yourDesiredOffset = 5 * 60 * 60 // 5 hours
        					data.sys.sunrise = new Date((data.sys.sunrise + yourDesiredOffset) * 1000).valueOf()
        					data.sys.sunset = new Date((data.sys.sunset + yourDesiredOffset) * 1000).valueOf()
        					original(data)
        				}
        			},
        		]
        	}
        }
        
        
        R 1 Reply Last reply Nov 13, 2023, 3:18 AM Reply Quote 1
        • R Offline
          rsiggins @sdetweil
          last edited by Nov 13, 2023, 2:51 AM

          @sdetweil The timezone is set to America/New York, which is the same as my local timezone. These settings appear to be correct.

          1 Reply Last reply Reply Quote 0
          • R Offline
            rsiggins @MMRIZE
            last edited by Nov 13, 2023, 3:18 AM

            @MMRIZE said in MMM-OpenmapWeather sunrise and sunset times are GMT:

            patches: [
            {
            module: “MMM-OpenmapWeather”,
            method: “processWeather”,
            patch: function (original, args) {
            const [ data ] = args
            const yourDesiredOffset = 5 * 60 * 60 // 5 hours
            data.sys.sunrise = new Date((data.sys.sunrise + yourDesiredOffset) * 1000).valueOf()
            data.sys.sunset = new Date((data.sys.sunset + yourDesiredOffset) * 1000).valueOf()
            original(data)
            }
            },
            ]
            }
            }

            Rather than trying the “Monkey Patch” I disabled the display of the sunrise/sunset times. There is an undocumented config varable called showSun. Set it to false and they don’t display. I never looked at these times. Easier to turn it off than fix.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              2/5
              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