Hello everyone,
I am using a Raspberry Pi 5 with the latest MM version and the latest version of the MMM-CalendarExt3 module.
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.:
{
"title": "Restmülltonne, Biotonne, Altpapiertonne, Gelbe Tonne",
}
My goal was to display icons in different colors in the title.
In detail:
Restmülltonne = Black garbage icon
Biotonne = Brown garbage icon
Altpapiertonne = Blue garbage icon
Gelbe Tonne = Yellow garbage icon
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.
Here is a shortened version of the configuration with which you can recreate the problem:
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) => {
if (ev.calendarName === "Trash") {
let relevantTitles = ["Restmülltonne", "Biotonne", "Gelbe Tonne", "Blaue Tonne"];
return relevantTitles.some(title => ev.title.includes(title));
}
return true;
},
eventTransformer: (ev) => {
if (ev.calendarName === "Trash") {
const trash = [];
const strArray = ev.description.split(',').map(item => 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;
}
Does anyone have any ideas or is there perhaps a better way to solve the problem?
Thanks in advance