Read the statement by Michael Teeuw here.
Default calendar customEvents not working
-
Hi guys,
I installed the newest mm version via GitHub.
I have tested a lot within the calendar module. My iCal-calendar is shown, but the default calendar module does not work with any customEvents entries.{ module: "calendar", header: "Familienkalender", position: "top_left", config: { calendars: [ { url: "my-url“, symbolClass: "fas fa-fw fa-", customEvents: [ { keyword: "Geburtstag", symbol: "fire" } ] } ] } },
Can you help me to fix it? I want change the symbols first and afterwards adding some regex-entries.
Did I miss something?
Thanks for your help.
Best regards
Pauabaer -
@pauabaer customEvents do not go IN the calendar definition
rather like this
{ module: "calendar", header: "Familienkalender", position: "top_left", config: { customEvents: [ { keyword: "Geburtstag", symbol: "fire" } ], calendars: [ { url: "my-url“, symbolClass: "fas fa-fw fa-", } ] } },
the calendar module documentation is organized into sections
- applies to all calendar definitions (refresh rate, maximumDays…etc)
- applies to A calendar definition (color, symbol, url)
-
Thank you a lot @sdetweil
Now the right symbol is shown on my screen.Next I tried to use the transform option:
{ module: "calendar", header: "Familienkalender", position: "top_left", config:{ customEvents: [ { keyword: "Geburtstag", symbol: "birthday-cake", transform: { search: "^(.+) (\\d{4}) Geburtstag$", replace: "$1 ($2)", yearmatchgroup: 2 } } ], calendars: [ { url: "my-url“, symbolClass: "fas fa-fw fa-" } ] } },
But when I refresh the browser whithin the Kalender „Familienkalender“ is no entry anymore but the word „loading…“ but nothing new is shown after a while.
What could this circumstance cause?
-
@pauabaer that means there was an error
open the developers window
ctrl-shift-i
select the console tab
put cal in the filter field
and you may see the error , I changed to match one of my cal event titles
but the regex doesn’t work… -
@sdetweil
Thanks for helping.I tried to figure out. Went to the console tab and put the filter on cal.
I get an error your yearmatch is that right? But I don’t know how to deal with it. Can you give me a hint? -
@pauabaer its a regular expression to extract the parts of the date,
i would use the developers window sources tab to locate that code in the calendar module and examine the data it is working with
i might get a chance later today
-
@pauabaer could you add
,"DEBUG"
to the config.js logLevel property
as well as your transform
and run MM with (stop pm2 version , with pm2 stop MagicMirror)npm start >somefile.txt 2>&1
so we can see the actual text of the event
(watch out, the log output contains the COMPLETE text of the calendar url)I only need the text of the event… (it supposedly has the date in it)
-
@sdetweil
Finally I got some time to test. See the pic below:I got the message that there is one entry but no title is shown. Did I do something wrong?
-
@pauabaer you didn’t add the debug setting to config.js
the transform happens in the front end, the backend (node_helper) gets the events from source and formats them for frontend.tye log you showed is from the backend
-
@sdetweil
I did add the debug setting but presumably at the wrong position.
Thought I should add it here:module: "calendar", header: "Familienkalender", position: "top_left", config:{ loglevel: ["DEBUG"], customEvents: [ { keyword: "Geburtstag", symbol: "birthday-cake", transform: { search: "^([^\']*) \'(\\d{4})$", replace: "$1 ($2)", yearmatchgroup: 2 } }