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.

    Opening hours for stores/places thru Google API

    Scheduled Pinned Locked Moved Unsolved Requests
    16 Posts 7 Posters 7.0k Views 7 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.
    • H Offline
      htilly
      last edited by

      Hi,

      Regarding yarn or npm is just a matter of package managers. As far as I understand you could probably happily do what you described using npm if that feels better.

      now, for the data. I installed it and had the same problem as you describe. First of, make sure that you do have a Google API registered and working. Assuming that you have this, my installation started to work after a reboot of the Raspberry Pi.
      I guess that it will not initiate a new API call after changing the config for MagicMirror.

      And to be clear, I have not coded this. I’m the one that requested the feature, and I simply love the delivery. Exactly what I wanted!!

      BR
      Tilly

      1 Reply Last reply Reply Quote 0
      • evroomE Offline
        evroom
        last edited by

        Rebooted.
        No change.

        I do get this error:

        0|mm  | [5:13:03 PM] - MMM-OpeningHours : Starting helper:  MMM-OpeningHours
        0|mm  | Sockets connected & modules started ...
        0|mm  | Launching application.
        0|mm  | (node:2342) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'refs' of undefined
        0|mm  | (node:2342) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
        

        I suppose the API key is right, as it finds the (street)name.
        And it increases the usage counter for Google Places for my account.

        But no opening times.
        On Google Maps opening times are visible for this ID.

        0|mm  |   json:
        0|mm  |    { html_attributions: [],
        0|mm  |      result: { name: 'Laufamholzstraße 76' },
        0|mm  |      status: 'OK' },
        0|mm  |   requestUrl: 'https://maps.googleapis.com/maps/api/place/details/json?fields=name%2Copening_hours&language=en&placeid=ChIJ9SpsbxZYn0cRhBEv4PE_Tvs&key=<key>',
        0|mm  |   query:
        0|mm  |    { fields: 'name,opening_hours',
        0|mm  |      language: 'en',
        0|mm  |      placeid: 'ChIJ9SpsbxZYn0cRhBEv4PE_Tvs',
        0|mm  |      key: '<key>' } }
        

        And I do not see a mapping between place id, street name and the name of the place.

        MagicMirror version: 2.30.0
        Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
        Raspbian GNU/Linux 12 (bookworm)

        Test environment:
        MagicMirror version: v2.30.0
        Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
        Raspbian GNU/Linux 12 (bookworm)

        1 Reply Last reply Reply Quote 0
        • H Offline
          htilly
          last edited by

          I tried it and it seems to be something strange with the PlaceID.
          Try this ID instead:
          ChIJl7ycbxZYn0cRqZwkVTJ3Rzw

          Should be the same place.

          /Tilly

          1 Reply Last reply Reply Quote 0
          • evroomE Offline
            evroom
            last edited by

            @htilly said in Opening hours for stores/places thru Google API:

            Try this ID instead:

            Thanks for spending time on it.

            Strange, but it works.
            The Place finder really says “ChIJ9SpsbxZYn0cRhBEv4PE_Tvs”, how did you find “ChIJl7ycbxZYn0cRqZwkVTJ3Rzw” ??

            0_1553893557312_Screenshot 2019-03-29 at 22.04.51.png

            MagicMirror version: 2.30.0
            Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
            Raspbian GNU/Linux 12 (bookworm)

            Test environment:
            MagicMirror version: v2.30.0
            Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
            Raspbian GNU/Linux 12 (bookworm)

            1 Reply Last reply Reply Quote 0
            • evroomE Offline
              evroom
              last edited by evroom

              Just FYI
              Simple test if both API key and place ID are okay using curl.

              This returns both name & opening_hours (as it should be):

              $ curl "https://maps.googleapis.com/maps/api/place/details/json?fields=name,opening_hours&language=en&placeid=ChIJl7ycbxZYn0cRqZwkVTJ3Rzw&key="API_KEY"
              

              In my case, it returned only the name:

              $ curl "https://maps.googleapis.com/maps/api/place/details/json?fields=name,opening_hours&language=en&placeid=ChIJ9SpsbxZYn0cRhBEv4PE_Tvs&key="API_KEY"
              

              Still confused why the place ID from Place Finder seems a bit off.

              MagicMirror version: 2.30.0
              Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
              Raspbian GNU/Linux 12 (bookworm)

              Test environment:
              MagicMirror version: v2.30.0
              Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
              Raspbian GNU/Linux 12 (bookworm)

              1 Reply Last reply Reply Quote 0
              • B Offline
                Bloham
                last edited by Bloham

                Hi Guys,
                (This is my first post :P but I have problems with this amazing module so I hope you could help)
                I have basically the same problem as evroom. My API is working (I do get the requested information at least with the link: "https://maps.googleapis.com/maps/api/place/details/json?fields=name,opening_hours&language=en&placeid=....
                I installed it with npm install and the module is just saying “Loading Opening Hours”.
                I just set debug: "true", but i don’t know where to find the debug file ^^ (I’m pretty new to all of this)
                Any idea for a fix? And this module is amazing (when it works) We always struggle to know if a certain shop is still open xD
                Best, Ben

                PROBLEM SOLVED:
                At least for me, I just had to wait until after midnight and the data got fetched again and is showing now everything properly. So for everyone with the same problem, maybe just wait until the next day :)

                1 Reply Last reply Reply Quote 0
                • mumblebajM Offline
                  mumblebaj Module Developer
                  last edited by

                  @Menturan Thanks for a great module. I had the module working for a two weeks but for the past few days it has stopped working. So, I have been working through the issue and after stopping and starting the mirror I am getting results returned but it is not being sent to the screen. Is there a reason for this?

                  [09:48:50] - DEBUG - MMM-OpeningHours : Sending to frontend - [{"name":"Makro Store Crown Mines","opening_hours":{"open_now":true,"periods":[{"close":{"day":0,"time":"1400"},"open":{"day":0,"time":"0900"}},{"close":{"day":1,"time":"1730"},"open":{"day":1,"time":"0830"}},{"close":{"day":2,"time":"1730"},"open":{"day":2,"time":"0830"}},{"close":{"day":3,"time":"1730"},"open":{"day":3,"time":"0830"}},{"close":{"day":4,"time":"1730"},"open":{"day":4,"time":"0830"}},{"close":{"day":5,"time":"1730"},"open":{"day":5,"time":"0830"}},{"close":{"day":6,"time":"1600"},"open":{"day":6,"time":"0800"}}],"weekday_text":["Monday: 8:30 AM – 5:30 PM","Tuesday: 8:30 AM – 5:30 PM","Wednesday: 8:30 AM – 5:30 PM","Thursday: 8:30 AM – 5:30 PM","Friday: 8:30 AM – 5:30 PM","Saturday: 8:00 AM – 4:00 PM","Sunday: 9:00 AM – 2:00 PM"]},"place_id":"ChIJl8h2VlIJlR4Rn5311bQlcXQ"},{"name":"Builders Warehouse Glen Eagles","opening_hours":{"open_now":true,"periods":[{"close":{"day":0,"time":"1600"},"open":{"day":0,"time":"0800"}},{"close":{"day":1,"time":"1800"},"open":{"day":1,"time":"0700"}},{"close":{"day":2,"time":"1800"},"open":{"day":2,"time":"0700"}},{"close":{"day":3,"time":"1800"},"open":{"day":3,"time":"0700"}},{"close":{"day":4,"time":"1800"},"open":{"day":4,"time":"0700"}},{"close":{"day":5,"time":"1800"},"open":{"day":5,"time":"0700"}},{"close":{"day":6,"time":"1700"},"open":{"day":6,"time":"0700"}}],"weekday_text":["Monday: 7:00 AM – 6:00 PM","Tuesday: 7:00 AM – 6:00 PM","Wednesday: 7:00 AM – 6:00 PM","Thursday: 7:00 AM – 6:00 PM","Friday: 7:00 AM – 6:00 PM","Saturday: 7:00 AM – 5:00 PM","Sunday: 8:00 AM – 4:00 PM"]},"place_id":"ChIJB0lb_mgPlR4Rje4UAMJnOvY"},null,null]

                  Check out my modules at: https://github.com/mumblebaj?tab=repositories

                  1 Reply Last reply Reply Quote 1
                  • T Offline
                    tcsevens
                    last edited by

                    It doesn’t seem to work anymore, black screen for me, do you have a solution?

                    S 1 Reply Last reply Reply Quote 0
                    • S Away
                      sdetweil @tcsevens
                      last edited by

                      @tcsevens see this
                      https://forum.magicmirror.builders/topic/15778/fix-for-black-screen-in-2-16-and-later

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      T 1 Reply Last reply Reply Quote 0
                      • T Offline
                        tcsevens @sdetweil
                        last edited by tcsevens

                        Hi @sdetweil thanks for your help.
                        Unfortunately it doesn’t work, I don’t see any dependencies to install .

                        /home/pi/.pm2/logs/MagicMirror-error.log last 50 lines:
                        0|MagicMir |     at Function.n._resolveFilename (electron/js2c/browser_init.js:257:1128)
                        0|MagicMir |     at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
                        0|MagicMir |     at Module._load (internal/modules/cjs/loader.js:732:27)
                        0|MagicMir |     at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
                        0|MagicMir |     at Module.require (internal/modules/cjs/loader.js:959:19) {
                        0|MagicMir |   code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
                        0|MagicMir | }
                        0|MagicMir | [15.12.2021 22:17.06.623] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
                        0|MagicMir | [15.12.2021 22:17.06.624] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
                        0|MagicMir | /home/pi/MagicMirror/node_modules/electron/dist/electron exited with signal SIGINT
                        0|MagicMir | /home/pi/MagicMirror/node_modules/electron/dist/electron exited with signal SIGINT
                        0|MagicMir | [15.12.2021 23:04.17.414] [ERROR] (node:21244) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
                        0|MagicMir | (Use `electron --trace-deprecation ...` to show where the warning was created)
                        0|MagicMir | /home/pi/MagicMirror/node_modules/electron/dist/electron exited with signal SIGINT
                        0|MagicMir | [16.12.2021 00:13.53.347] [ERROR] (node:22605) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
                        0|MagicMir | (Use `electron --trace-deprecation ...` to show where the warning was created)
                        0|MagicMir | [16.12.2021 11:51.38.088] [ERROR] [SPOTIFY - Thomas] Failed to request API: /v1/me/player
                        0|MagicMir | [16.12.2021 11:51.38.093] [ERROR] [SPOTIFY - Thomas] Invalid response
                        0|MagicMir | [16.12.2021 11:51.38.102] [ERROR] [SPOTIFY - Thomas] Response error code: 502
                        0|MagicMir | [16.12.2021 11:51.38.102] [ERROR] [SPOTIFY - Thomas] Response error text: Bad Gateway
                        0|MagicMir | /home/pi/MagicMirror/node_modules/electron/dist/electron exited with signal SIGINT
                        0|MagicMir | [16.12.2021 19:17.24.951] [ERROR] WARNING! Could not load config file. Starting with default configuration. Error found: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports" in /home/pi/MagicMirror/modules/MMM-OpeningHours/node_modules/uuid/package.json
                        0|MagicMir | [16.12.2021 19:17.24.970] [ERROR] App threw an error during load
                        0|MagicMir | [16.12.2021 19:17.24.971] [ERROR] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports" in /home/pi/MagicMirror/modules/MMM-OpeningHours/node_modules/uuid/package.json
                        0|MagicMir |     at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)
                        0|MagicMir |     at packageExportsResolve (internal/modules/esm/resolve.js:513:3)
                        0|MagicMir |     at resolveExports (internal/modules/cjs/loader.js:439:36)
                        0|MagicMir |     at Function.Module._findPath (internal/modules/cjs/loader.js:479:31)
                        0|MagicMir |     at Module._resolveFilename (internal/modules/cjs/loader.js:874:27)
                        0|MagicMir |     at Function.n._resolveFilename (electron/js2c/browser_init.js:257:1128)
                        0|MagicMir |     at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
                        0|MagicMir |     at Module._load (internal/modules/cjs/loader.js:732:27)
                        0|MagicMir |     at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
                        0|MagicMir |     at Module.require (internal/modules/cjs/loader.js:959:19)
                        0|MagicMir | [16.12.2021 19:17.24.972] [ERROR] Whoops! There was an uncaught exception...
                        0|MagicMir | [16.12.2021 19:17.24.977] [ERROR] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports" in /home/pi/MagicMirror/modules/MMM-OpeningHours/node_modules/uuid/package.json
                        0|MagicMir |     at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)
                        0|MagicMir |     at packageExportsResolve (internal/modules/esm/resolve.js:513:3)
                        0|MagicMir |     at resolveExports (internal/modules/cjs/loader.js:439:36)
                        0|MagicMir |     at Function.Module._findPath (internal/modules/cjs/loader.js:479:31)
                        0|MagicMir |     at Module._resolveFilename (internal/modules/cjs/loader.js:874:27)
                        0|MagicMir |     at Function.n._resolveFilename (electron/js2c/browser_init.js:257:1128)
                        0|MagicMir |     at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
                        0|MagicMir |     at Module._load (internal/modules/cjs/loader.js:732:27)
                        0|MagicMir |     at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
                        0|MagicMir |     at Module.require (internal/modules/cjs/loader.js:959:19) {
                        0|MagicMir |   code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
                        
                        
                        S 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          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