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.

    Show calendar based on IP Address accessed

    Scheduled Pinned Locked Moved Development
    68 Posts 3 Posters 28.4k 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.
    • S Offline
      sdetweil @Spinster
      last edited by sdetweil

      @Spinster sorry, explain
      the other client

      on refresh, everything is the same in the module.

      each module has a unique id assigned, based on its placement in config.js
      calendar sends its id down to its helper
      and the helper sends the id back on response. as the response mechanism is a broadcast to all connected clients.
      the clients then check to see if this response is for their request.
      from code posted
      1000025905.jpg

      also, please start using code block wrapper for all config, code and error postings

      paste text into the message editor
      empty line above and below
      select that pasted text
      hit the editor button </>

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        Spinster @sdetweil
        last edited by

        @sdetweil

        Sorry for not explaining it clearly.
        I have two clients, one from a browser using http://ip:8080 and another the native client.

        upon using pm2 start MagicMirror, I get the out put in native client and the browser properly showing their respective calendar.

        If I hit refresh button on browser, browser is showing only its own calendar however the native client is displaying both the calendars (ie. its own and the one which is supposed to be shown in browser), If I hit Ctr-R on the native client, then browser is showing both the calendars while the native client is showing only its own calendar.

        Also I don’t understand the following instructions, please explain what should I do

        also, please start using code block wrapper for all config, code and error postings

        paste text into the message editor
        empty line above and below
        select that pasted text
        hit the editor button </>

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @Spinster
          last edited by

          @Spinster said in Show calendar based on IP Address accessed:

          don’t understand the following instructions, please explain what should I do

          when creating a message here on the forum, if you are inserting code, config, or error text (like you did when u pasted the whole calendar.js, or the part of the module config)

          do the instructions I gave

          Sam

          How to add modules

          learning how to use browser developers window for css changes

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

            @Spinster I rejected your post (AND a second time) . I already fixed the prior
            AND you left your unique info in the module info…

            anyhow…

            found the issue… the ‘identifier’ is based on placement in config.js SO, it will be the SAME on both browsers… oops…

            here are the two lines to fix

            1. in the socketNotificationReceived function
              change this
            		if (this.identifier !== payload.id) {
            			return;
            		}
            

            to this

            		if (this.identifier+(this.ourIPAddress?'_'+this.ourIPAddress:'') !== payload.id) {
            			return;
            		}
            

            and 2.
            in the addCalendar routine
            change this

            		id: this.identifier,
            

            to this

            		id: this.identifier+(this.ourIPAddress?'_'+this.ourIPAddress:''),
            

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              Spinster @sdetweil
              last edited by

              @sdetweil

              You did it! Excellent, I really appreciate your versatility and quick response.

              Hope this shall become a feature for the calendar or any other modules if anyone has similar requirement and prefers it.

              Sincere Thanks to you and gratitude for your effort and time~

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @Spinster
                last edited by sdetweil

                @Spinster I don’t know if this will become a feature… but at least you know how to add it for your environment
                if it was a feature, I would recommend adding the getip rest api call to the base MM code.

                I updated the prior code changes to include these latest , so its all in one place

                it was a fun, thought provoking, exercise.

                Sam

                How to add modules

                learning how to use browser developers window for css changes

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

                  @Spinster another conversation highlighted another change required
                  and a bug

                  I’ll update my code here later

                  oh, and to help you, you could fork the MagicMirror repo
                  and use it, adding this code,
                  and saving to the repo, so next update
                  you can sync the fork and git pull to your system

                  sorry my new phone and thumb don’t agree where the keys are… lol and correction never gets it right

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    Spinster @sdetweil
                    last edited by

                    @sdetweil

                    I can’t thank you much for your sincerity in making it correct. Looking forward to the updated code.
                    I will try to contribute too in future like you.
                    Thank you once again.

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @Spinster
                      last edited by sdetweil

                      @Spinster

                      SO, the ‘bug’ is that this notification , added in pull request 2881 in
                      https://github.com/MagicMirrorOrg/MagicMirror/pull/2881
                      in August 2022
                      edit: I just opened issue 3443 for this problem
                      https://github.com/MagicMirrorOrg/MagicMirror/issues/3443

                      	socketNotificationReceived (notification, payload) {
                      		if (notification === "FETCH_CALENDAR") {
                      			this.sendSocketNotification(notification, { url: payload.url, id: this.identifier });
                      		}
                      

                      added the code in the WRONG place… socketNotificationReceived is ONLY triggered by the node_helper sendSocketNotification,
                      NOT by other modules doing sendNotification
                      NO OTHER module can force a sendSocketNotification from our helper

                      THAT is notificationReceived… (which we JUST added for the 1st time… oops)

                      So,
                      remove this

                      		if (notification === "FETCH_CALENDAR") {
                      			this.sendSocketNotification(notification, { url: payload.url, id: this.identifier });
                      		}
                      

                      and move it to the notificationReceived() function

                      @sdetweil said in Show calendar based on IP Address accessed:

                         notificationReceived(notification,payload){
                       	if(notification === 'ALL_MODULES_STARTED'){
                              }  else  if (notification === "FETCH_CALENDAR") {
                              	this.sendSocketNotification(notification, { url: payload.url, id: this.identifier });
                              }
                      

                      and THEN we need to change the this.identifier to account for the ip based ID, so if some OTHER module
                      asks THIS calendar instance to refresh ITS data, it asks for the correct content

                            else  if (notification === "FETCH_CALENDAR") {
                              	this.sendSocketNotification(notification, { url: payload.url, id: this.identifier+(this.ourIPAddress?'_'+this.ourIPAddress:'') });
                              }
                      

                      I’ll add this to the other code, done … I’ll leave the explanation here

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        Spinster @sdetweil
                        last edited by

                        @sdetweil

                        Perfect, I did this. Thank you so much for your timely help.

                        Now I am trying to do the same thing in MMM-CalendarEtx2. Because, I want a proper Month Calendar, which is not provided by Calendar.

                        Is there any module which can display two month calendar, since I searched in modules and could not find.

                        Thank you once again.

                        S 1 Reply Last reply Reply Quote 0
                        • S Offline
                          sdetweil @Spinster
                          last edited by sdetweil

                          @Spinster ext2 is dead. use ext3, it uses the broadcast from the default calendar module which now is just those for this system

                          uh, hard to put up one wall cal view, 2 I don’t know.

                          remove position from default cal, it won’t display but will send it broadcast

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          S 2 Replies Last reply Reply Quote 0
                          • S Offline
                            Spinster @sdetweil
                            last edited by

                            @sdetweil

                            Oh I did not know, but ext3, I don’t see an option to view a month calendar (not month schedule). I am looking for something like MMM-CalendarExtMiniMonth. Please let me know if this option is available

                            S 1 Reply Last reply Reply Quote 0
                            • S Offline
                              Spinster @sdetweil
                              last edited by

                              @sdetweil

                              Okay will try it. Thank you.

                              1 Reply Last reply Reply Quote 0
                              • S Offline
                                sdetweil @Spinster
                                last edited by

                                @Spinster he has 4 modules, one might provide a view u want

                                MMRIZE/MMM-CalendarExt3
                                MagicMirror calendar view module
                                JavaScript
                                ·
                                44
                                ·
                                Updated 10 days ago

                                MMRIZE/MMM-CalendarExt3Agenda
                                Daily agenda view module of MagicMirror
                                JavaScript
                                ·
                                12
                                ·
                                Updated 3 days ago

                                MMRIZE/MMM-CalendarExt3Timeline
                                Successor of CX2Timeline, Magicmirror module.
                                JavaScript
                                ·
                                7
                                ·
                                Updated on May 4, 2023

                                MMRIZE/MMM-CalendarExt3Journal
                                Magic mirror module for presenting events as daily/weekly journal style.
                                JavaScript
                                ·
                                3
                                ·
                                Updated 10 days ago

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

                                S 1 Reply Last reply Reply Quote 0
                                • S Offline
                                  Spinster @sdetweil
                                  last edited by

                                  @sdetweil

                                  Perfect EXT3 with base calendar is working taking account of IP access settings.

                                  However EXT3 does not have a simple monthly Calendar view like EXT2 Mini month.

                                  Thank you so much for the directions.

                                  S M 2 Replies Last reply Reply Quote 0
                                  • S Offline
                                    sdetweil @Spinster
                                    last edited by

                                    @Spinster sorry, I don’t know minimonth

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

                                    1 Reply Last reply Reply Quote 0
                                    • M Offline
                                      MMRIZE @Spinster
                                      last edited by

                                      @Spinster
                                      https://github.com/MMRIZE/MMM-CalendarExt3Agenda?tab=readme-ov-file#minimonth-calendar-only

                                      bc0fc002-0bb3-4000-b4a0-291e12b5ee01-image.png

                                      S 1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        Spinster @MMRIZE
                                        last edited by

                                        @MMRIZE

                                        Wow. Good.

                                        I will try it. Thank you so much for suggestion

                                        S 1 Reply Last reply Reply Quote 0
                                        • S Offline
                                          sdetweil @Spinster
                                          last edited by

                                          @Spinster remember, I posted there were 4 different ext3 based modules

                                          Sam

                                          How to add modules

                                          learning how to use browser developers window for css changes

                                          S 1 Reply Last reply Reply Quote 0
                                          • S Offline
                                            Spinster @sdetweil
                                            last edited by

                                            @sdetweil @MMRIZE

                                            Yes I am trying all. No words to thank you both. Inspiring

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 3 / 4
                                            • 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