<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CalendarExt3 eventTransformer and refreshInterval]]></title><description><![CDATA[<p dir="auto">Hello everyone,</p>
<p dir="auto">I am using a Raspberry Pi 5 with the latest MM version and the latest version of the MMM-CalendarExt3 module.</p>
<p dir="auto">I would like to display the garbage emptying which works so far. Unfortunately, the ics feed in the title provides all the different garbage cans that are emptied, e.g.:</p>
<pre><code>{
    "title": "Restmülltonne, Biotonne, Altpapiertonne, Gelbe Tonne",
}
</code></pre>
<p dir="auto">My goal was to display icons in different colors in the title.</p>
<p dir="auto">In detail:<br />
Restmülltonne = Black garbage icon<br />
Biotonne = Brown garbage icon<br />
Altpapiertonne = Blue garbage icon<br />
Gelbe Tonne = Yellow garbage icon</p>
<p dir="auto">This also works so far, but when the refreshInterval of the MMM-CalendarExt3 takes effect, the eventTransformer is apparently no longer executed correctly in my case.</p>
<p dir="auto">Here is a shortened version of the configuration with which you can recreate the problem:</p>
<pre><code>let config = {
    address: "0.0.0.0",
    port: 8080,
    basePath: "/",
    ipWhitelist: [],
    useHttps: false,
    httpsPrivateKey: "",
    httpsCertificate: "",
    language: "de",
    locale: "de-DE",
    logLevel: ["INFO", "LOG", "WARN", "ERROR"],
    timeFormat: 24,
    units: "metric",
    modules: [

        // ***** CALENDAR MODULES *****
        {
            module: "MMM-CalendarExt3",
            position: "top_bar",
            config: {
                firstDayOfWeek: 1,
                refreshInterval: 6000,
                weeksInView: 4,
                useMarquee: true,
                maxEventLines: 4,
                customHeader: false,
                eventFilter: (ev) =&gt; {
                    if (ev.calendarName === "Trash") {
                        let relevantTitles = ["Restmülltonne", "Biotonne", "Gelbe Tonne", "Blaue Tonne"];
                        return relevantTitles.some(title =&gt; ev.title.includes(title));
                    }
                    return true;
                },
                eventTransformer: (ev) =&gt; {
                    if (ev.calendarName === "Trash") {
                        const trash = [];
                        const strArray = ev.description.split(',').map(item =&gt; item.trim());
                        console.log(ev)
                        for (let item of strArray) {
                            if (item === "Restmülltonne") trash.push("fa-solid fa-trash trash-black");
                            else if (item === "Biotonne") trash.push("fa-solid fa-trash trash-brown");
                            else if (item === "Gelbe Tonne") trash.push("fa-solid fa-trash trash-yellow");
                            else if (item === "Altpapiertonne") trash.push("fa-solid fa-trash trash-blue");
                        }

                        ev.description = trash.join(', ');
                        ev.symbol = trash;
                        if (trash.length === 0) {
                            ev.symbol = [];
                            ev.color = "none";
                        }
                    }
                    return ev;
                }
            }
        },
        {
            module: "calendar",
            header: "Termine",
            config: {
                broadcastPastEvents: true,
                maximumEntries: 10000,
                calendars: [
                    {
                        name: "Trash",
                        fetchInterval: 3000,
                        useSymbol: false,
                        url: "webcal://-849/feed.ics",
                        color: "none"
                    },
                ]
            }
        },
    ]
};

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
    module.exports = config;
}
</code></pre>
<p dir="auto">Does anyone have any ideas or is there perhaps a better way to solve the problem?</p>
<p dir="auto">Thanks in advance</p>
]]></description><link>https://forum.magicmirror.builders/topic/19433/calendarext3-eventtransformer-and-refreshinterval</link><generator>RSS for Node</generator><lastBuildDate>Thu, 18 Jun 2026 02:09:49 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/19433.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 13 Feb 2025 17:02:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CalendarExt3 eventTransformer and refreshInterval on Fri, 14 Feb 2025 13:18:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chrisfr1976" aria-label="Profile: chrisfr1976">@<bdi>chrisfr1976</bdi></a><br />
Thank you for sharing. This helped me it seems it was an issue with my conditions using the ev.title.search(‘string’) solved my issue.</p>
<pre><code>                eventTransformer: (ev) =&gt; {
                    if (ev.calendarName === "Trash") {
                        const trash = [];
                        ev.color = 'gray';

                        if (ev.title.search('Altpapiertonne') &gt; -1) {
                            trash.push("fa-solid fa-trash trash-blue")
                        }

                        if (ev.title.search('Gelbe Tonne') &gt; -1) {
                            trash.push("fa-solid fa-trash trash-yellow")
                        }

                        if (ev.title.search('Biotonne') &gt; -1) {
                            trash.push("fa-solid fa-trash trash-brown")
                        }

                        if (ev.title.search('Restmülltonne') &gt; -1) {
                            trash.push("fa-solid fa-trash trash-black")
                        }

                        ev.symbol = trash;
                        if (trash.length === 0) {
                            ev.symbol = [];
                            ev.color = "none";
                        }
                    }
                    return ev;
                }
            }
        }
</code></pre>
<p dir="auto"><img src="https://ibb.co/ycfzpQ5G" alt="alt text" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.magicmirror.builders/post/124038</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/124038</guid><dc:creator><![CDATA[fXtra]]></dc:creator><pubDate>Fri, 14 Feb 2025 13:18:24 GMT</pubDate></item><item><title><![CDATA[Reply to CalendarExt3 eventTransformer and refreshInterval on Thu, 13 Feb 2025 22:56:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fxtra" aria-label="Profile: fXtra">@<bdi>fXtra</bdi></a><br />
This is my code in ext3 config and it does its job:</p>
<pre><code>			eventTransformer: (ev) =&gt; {
			    if (ev.title.search('Altpapier') &gt; -1) {
			        ev.color = 'blue';
			        ev.symbol = ['noto:rolled-up-newspaper'];
			    }
			    if (ev.title.search('LVP') &gt; -1) {
			        ev.color = 'yellow';
			        ev.symbol = ['noto:recycling-symbol'];
			    }
			    if (ev.title.search('Biotonne') &gt; -1) {
			        ev.color = 'brown';
			        ev.symbol = ['noto:biohazard'];
			    }
			    if (ev.title.search('RestmÃ¼ll') &gt; -1) {
			        ev.color = 'gray';
			        ev.symbol = ['noto:squinting-face-with-tongue'];
			    }
			    return ev;
				},

</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/124028</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/124028</guid><dc:creator><![CDATA[chrisfr1976]]></dc:creator><pubDate>Thu, 13 Feb 2025 22:56:46 GMT</pubDate></item><item><title><![CDATA[Reply to CalendarExt3 eventTransformer and refreshInterval on Thu, 13 Feb 2025 17:24:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fxtra" aria-label="Profile: fXtra">@<bdi>fXtra</bdi></a> i edited your post to remove most of the  calendar url</p>
]]></description><link>https://forum.magicmirror.builders/post/124000</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/124000</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Thu, 13 Feb 2025 17:24:43 GMT</pubDate></item></channel></rss>