@Assassins yes, generally the author prefers issues posted to his own forums.
Read the statement by Michael Teeuw here.
Posts made by sdetweil
-
RE: 7May24 - Error EXT-Pages
-
RE: Show calendar based on IP Address accessed
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/3443socketNotificationReceived (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 helperTHAT is notificationReceived… (which we JUST added for the 1st time… oops)
So,
remove thisif (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 contentelse 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
-
RE: Show calendar based on IP Address accessed
@Spinster another conversation highlighted another change required
and a bugI’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 systemsorry my new phone and thumb don’t agree where the keys are… lol and correction never gets it right
-
RE: Show calendar based on IP Address accessed
@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.
-
RE: Show calendar based on IP Address accessed
@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
- 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 thisid: this.identifier,
to this
id: this.identifier+(this.ourIPAddress?'_'+this.ourIPAddress:''),
- in the socketNotificationReceived function
-
RE: Show calendar based on IP Address accessed
@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
-
RE: Show calendar based on IP Address accessed
@Spinster sorry, explain
the other clienton 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
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 </> -
RE: Show calendar based on IP Address accessed
@Spinster yes, it has to be inside the
config:{} sectioneverything outside config are MagicMirror properties about a module
see
https://docs.magicmirror.builders/modules/configuration.html#exampleconfig is properties FOR the module and override what is defined in the module defaults:{} object
-
RE: MagicMirror 2.27 Error - modules failing - not displaying output - 7May2024
@nkc thx. I deleted the duplicate post.
all posts from users with reputation below 2 are reviewed before being posted on the forum. I review every post, so patiencethis stops all the spam, and porn posts
-
RE: Show calendar based on IP Address accessed
@Spinster can you show the calendar config, you can leave out the calendars:[] list entries
start is optional. but only called once
getip has not placed its content yet.the notification ALL_MODULES_STARTED is sent be the system when all the
modules start methods have been calledfrom the module development doc