Bug Report: Calendar symbol not applied when broadcasting events
Module
MMM-GoogleCalendar by randomBrainstormer
Description
When broadcastEvents: true is set and a custom symbol is defined per calendar in the config, the symbol is not transmitted correctly via the CALENDAR_EVENTS notification. Instead, all events receive the default symbol (calendar).
Root Cause
In MMM-GoogleCalendar.js, the broadcastEvents() function (line ~1079) calls symbolsForEvent(event) before assigning event.calendarID:
// Current (buggy) code:
const event = { ...ev }; // ev has no calendarID property
event.symbol = this.symbolsForEvent(event); // event.calendarID is undefined here!
event.calendarName = this.calendarNameForCalendar(calendarID);
event.color = this.colorForCalendar(calendarID);
delete event.calendarID;
symbolsForEvent() relies on event.calendarID to look up the correct symbol via getCalendarProperty(). Since ev (from this.calendarData[calendarID]) does not contain a calendarID property, the lookup fails and falls back to this.config.defaultSymbol ("calendar").
Fix
Assign event.calendarID before calling symbolsForEvent():
// Fixed code:
const event = { ...ev };
event.calendarID = calendarID; // ← add this line
event.symbol = this.symbolsForEvent(event); // now calendarID is available
event.calendarName = this.calendarNameForCalendar(calendarID);
event.color = this.colorForCalendar(calendarID);
delete event.calendarID;
Steps to Reproduce
- Configure MMM-GoogleCalendar with
broadcastEvents: true
- Set a custom
symbol per calendar entry (e.g. symbol: "people-group")
- Use MMM-MonthlyCalendar (or any module listening to
CALENDAR_EVENTS) with displaySymbol: true
- Observe that all events show the default
calendar symbol instead of the configured one
Expected Behavior
Each event broadcast via CALENDAR_EVENTS should carry the symbol defined for its respective calendar in the config.
Actual Behavior
All events carry the default symbol ("calendar"), regardless of per-calendar symbol configuration.
Environment
- MagicMirror² latest
- MMM-GoogleCalendar latest
- MMM-MonthlyCalendar (consumer of broadcast)
- Raspberry Pi, Node.js
Suggested Fix
One-line fix in MMM-GoogleCalendar.js in the broadcastEvents() function:
event.calendarID = calendarID;
Add this line before event.symbol = this.symbolsForEvent(event);
Bug Report: Calendar symbol not applied when broadcasting events
Module
MMM-GoogleCalendar by randomBrainstormer
Description
When
broadcastEvents: trueis set and a customsymbolis defined per calendar in the config, the symbol is not transmitted correctly via theCALENDAR_EVENTSnotification. Instead, all events receive the default symbol (calendar).Root Cause
In
MMM-GoogleCalendar.js, thebroadcastEvents()function (line ~1079) callssymbolsForEvent(event)before assigningevent.calendarID:symbolsForEvent()relies onevent.calendarIDto look up the correct symbol viagetCalendarProperty(). Sinceev(fromthis.calendarData[calendarID]) does not contain acalendarIDproperty, the lookup fails and falls back tothis.config.defaultSymbol("calendar").Fix
Assign
event.calendarIDbefore callingsymbolsForEvent():Steps to Reproduce
broadcastEvents: truesymbolper calendar entry (e.g.symbol: "people-group")CALENDAR_EVENTS) withdisplaySymbol: truecalendarsymbol instead of the configured oneExpected Behavior
Each event broadcast via
CALENDAR_EVENTSshould carry thesymboldefined for its respective calendar in the config.Actual Behavior
All events carry the default symbol (
"calendar"), regardless of per-calendar symbol configuration.Environment
Suggested Fix
One-line fix in
MMM-GoogleCalendar.jsin thebroadcastEvents()function:Add this line before
event.symbol = this.symbolsForEvent(event);