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

Problem with MMM-CalendarExt2 tranforming

Scheduled Pinned Locked Moved Unsolved Troubleshooting
3 Posts 2 Posters 528 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.
  • H Offline
    haglefar
    last edited by haglefar Nov 19, 2021, 1:08 PM Nov 19, 2021, 1:07 PM

    Hello forum!
    My first post here. I have been following this project for a while, and finally got around to making one myself. I have a functioning mirror, with all the modules i want and it is amazing. The only minor problem i have, is with the transform function in MMM-CalendatExt2.

    I use the function as described in the documentation, but i cannot get it to work. Or, it did actually work for about a day, then it broke.

    I try to add icons to my event headers based on the content of the event (either description or title), but as stated, i cannot get this to work. If i try to start MM with this code, the MMM-CalendarExt2 will not load. Everything else works fine.

    I have included the code for the module below, if anyone could take a look and maybe tell me what i am doing wrong, it would be great. The calendar-adresses are removed and the code-snippet for the transform is commented out, for obvious reasons.

    {
                            module: 'MMM-CalendarExt2',
                            config: {
                                    fetchInterval: 60 * 1000 * 15,
                                    rotateInterval: 0,
                                    updateInterval: 60 * 1000 * 15,
                                    firstDrawingDelay: 10000,
                                    calendars: [
                                    {
                                            name: "Johan privat",
                                            url: "******************************************************"
                                            className: "johan",
                                    },
                                    {
                                            name: "Johan Jobb",
                                            url: "******************************************************"
                                            className: "johanjobb",
                                    },
                                    {
                                            name: "Offentlige helligdager",
                                            url: "******************************************************"
                                            className: "holiday",
                                    },
                                    {
                                            name: "Bursdager",
                                            url: "******************************************************"
                                            className: "bursdager",
                                    },
                                    {
                                            name: "Trash",
                                            url: "******************************************************"
                                            className: "trash",
                                    },
                                    {
                                            name: "Mia privat",
                                            url: "******************************************************"
                                            className: "mia",
                                    },
                                    ],
                                    views: [
                                    {
                                            name: "Uke",
                                            mode: "weekly",
                                            locale: "nb_NO",
                                            dateFormat: "nb",
                                            calendars: [],
                                            position: "top_left",
                                            slotCount: 1,
                                            maxItems: 500,
                                            filterPassedEvent: true,
                                            slotMaxHeight: "500px",
                                            dateFormat:"ddd DD/MM",
                                            slotTitleFormat: "[Uke] WW"
                                    },
                                    {
                                            name: "Dag",
                                            mode: "daily",
                                            locale: "nb_NO",
                                            dateFormat: "nb",
                                            calendars: [],
                                            position: "top_left",
                                            dateFormat:"ddd DD/MM",
                                            slotTitleFormat: "[Idag]",
                                            slotCount: 1,
                                            maxItems: 500,
                                    /*      transform: (event)=>{
                                                    if (event.description.search("Bursdag") > -1) { // If the event might include "Birthday" in its $
                                                            event.icon = "fxemoji-birthdaycake"; // Set icon of that event to "fxemoji-birthdaycake"
                                                    }
    
                                                    if (event.title.search("plast") > -1) {
                                                            event.icon = "fxemoji-blackuniversalrecyclingsymbol";
                                                    }
    
                                                    if (event.title.search("Restavfall") > -1) {
                                                            event.icon = "fxemoji-wastebasket";
                                                    }
    
                                                    if (event.title.search("glass og metall") > -1) {
                                                            event.icon = "fxemoji-cocktailglass";
                                                    }
    
                                                    if (event.title.search("papir") > -1) {
                                                            event.icon = "fxemoji-rolledupnewspaper";
                                                    }
    
                                                    if (event.description.search("Katt") > -1) {
                                                            event.icon = "fxemoji-cat";
                                                    }
    
                                                    if (event.description.search("Hjerte") > -1) {
                                                            event.icon = "fxemoji-sparklingheart";
                                                    }
    
                                                    if (event.description.search("Lilla") > -1) {
                                                            event.icon = "fxemoji-heartpurple";
                                                    }
    
                                                    if (event.description.search("Beer") > -1) {
                                                            event.icon = "fxemoji-clinkingbeermugs";
                                                    }
    
                                                    if (event.description.search("Par") > -1) {
                                                            event.icon = "fxemoji-couplekiss";
                                                    }
    
                                                    if (event.title.search("Yoga") > -1) {
                                                            event.icon = "grommet-icons:yoga";
                                                    }
                                                    return event; // Return that event.
                                            },
                            */      },
                                    ],
                                    scenes: [
                                            {
                                            name: "Hovedskjerm",
                                            views: ["Dag", "Uke"],
                                            },
                                    ],
                                    },
                    },
    

    haglefar

    J 1 Reply Last reply Nov 20, 2021, 5:12 PM Reply Quote 0
    • J Offline
      JohnBachini @haglefar
      last edited by JohnBachini Nov 20, 2021, 5:12 PM Nov 20, 2021, 5:12 PM

      @haglefar said in Problem with MMM-CalendarExt2 tranforming:

      documentation

      you have ; should it be a , example in documentation shows no ; or ,

      event.icon = "grommet-icons:yoga";
      
      H 1 Reply Last reply Nov 21, 2021, 2:15 PM Reply Quote 0
      • H Offline
        haglefar @JohnBachini
        last edited by haglefar Nov 21, 2021, 3:07 PM Nov 21, 2021, 2:15 PM

        @johnbachini

        Sorry, forgot to remove those from testing before. Tried again with the “;” removed, same result as before. Module does not show up at all. No errors in the logs.

        EDIT: Here is the new code, properly formatted, (I think):

        /* Magic Mirror Config Sample
         *
         * By Michael Teeuw https://michaelteeuw.nl
         * MIT Licensed.
         *
         * For more information on how you can configure this file
         * see https://docs.magicmirror.builders/getting-started/configuration.html#general
         * and https://docs.magicmirror.builders/modules/configuration.html
         */
        let config = {
        	address: "localhost", 	// Address to listen on, can be:
        							// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
        							// - another specific IPv4/6 to listen on a specific interface
        							// - "0.0.0.0", "::" to listen on any interface
        							// Default, when address config is left out or empty, is "localhost"
        	port: 8080,
        	basePath: "/", 	// The URL path where MagicMirror is hosted. If you are using a Reverse proxy
        					// you must set the sub path here. basePath must end with a /
        	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], 	// Set [] to allow all IP addresses
        															// or add a specific IPv4 of 192.168.1.5 :
        															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
        															// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
        															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
        
        	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
        	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
        	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true
        
        	language: "nb",
        	locale: "nb-NO",
        	logLevel: ["INFO", "LOG", "WARN", "ERROR", "DEBUG"], // Add "DEBUG" for even more logging
        	timeFormat: 24,
        	units: "metric",
        	// serverOnly:  true/false/"local" ,
        	// local for armv6l processors, default
        	//   starts serveronly and then starts chrome browser
        	// false, default for all NON-armv6l devices
        	// true, force serveronly mode, because you want to.. no UI on this device
        
        	modules: [
        		{
        			module: "alert",
        		},
        		{
        			module: 'MMM-Cursor',
        			config: {
        				timeout: 10000,
        			}
        		},
        		{
        			module: "updatenotification",
        			position: "top_bar"
        		},
        		{
        			module: "clock",
        			position: "top_left"
        		},
        		{
        			module: 'MMM-CalendarExt2',
        			config: {
        				fetchInterval: 60 * 1000 * 15,
        				rotateInterval: 0,
        				updateInterval: 60 * 1000 * 15,
        				firstDrawingDelay: 10000,
        				calendars: [
        			      	{
        					name: "Johan privat",
        			        	url: "******************************************************",
        					className: "johan",
        			      	},
                                        {
                                                name: "Johan Jobb",
                                                url: "******************************************************",
                                                className: "johanjobb",
                                        },
        				{
        					name: "Offentlige helligdager",
        					url: "******************************************************",
        					className: "holiday",
        				},
                                        {
                                                name: "Bursdager",
                                                url: "******************************************************",
                                                className: "bursdager",
                                        },
                                        {
                                                name: "Trash",
                                                url: "******************************************************",
                                                className: "trash",
                                        },
        				{
        					name: "Mia privat",
        					url: "******************************************************",
        					className: "mia",
        				},
        			    	],
        			    	views: [
        			      	{
        					name: "Uke",
        			        	mode: "weekly",
        					locale: "nb_NO",
        					dateFormat: "nb",
        					calendars: [],
        					position: "top_left",
        					slotCount: 1,
        					maxItems: 500,
        					filterPassedEvent: true,
        					slotMaxHeight: "500px",
        					dateFormat:"ddd DD/MM",
        					slotTitleFormat: "[Uke] WW"
        			      	},
        				{
        					name: "Dag",
        					mode: "daily",
        					locale: "nb_NO",
        					dateFormat: "nb",
        					calendars: [],
        					position: "top_left",
        					dateFormat:"ddd DD/MM",
        					slotTitleFormat: "[Idag]",
        					slotCount: 1,
        					maxItems: 500,
        					transform: (event)=>{
          						if (event.description.search("Bursdag") > -1) { // If the event might include "Birthday" in its title,
            							event.icon = "fxemoji-birthdaycake" // Set icon of that event to "fxemoji-birthdaycake"
          						}
        
        						if (event.title.search("plast") > -1) {
                                                                event.icon = "fxemoji-blackuniversalrecyclingsymbol"
        						}
        
        						if (event.title.search("Restavfall") > -1) {
                                                                event.icon = "fxemoji-wastebasket"
                                }
        
        						if (event.title.search("glass og metall") > -1) {
                                                                event.icon = "fxemoji-cocktailglass"
                                }
        
        						if (event.title.search("papir") > -1) {
                                                                event.icon = "fxemoji-rolledupnewspaper"
                                }
        
        						if (event.description.search("Katt") > -1) {
                                                                event.icon = "fxemoji-cat"
                                }
        
        						if (event.description.search("Hjerte") > -1) {
                                                                event.icon = "fxemoji-sparklingheart"
                                }
        
        						if (event.description.search("Lilla") > -1) {
                                                                event.icon = "fxemoji-heartpurple"
        		                }
        
                                if (event.description.search("Beer") > -1) {
                                    							event.icon = "fxemoji-clinkingbeermugs"
                                }
                                if (event.description.search("Par") > -1) {
                                                                event.icon = "fxemoji-couplekiss"
                                }
                                if (event.title.search("Yoga") > -1) {
                                                                event.icon = "grommet-icons:yoga"
                                }
          						return event // Return that event.
        					},
        				},
        			    	],
        			    	scenes: [
        			      		{
        			        	name: "Hovedskjerm",
        					views: ["Dag", "Uke"],
        			      		},
        			    	],
        			  	},
        		},
        
        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          1/3
          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