MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. fXtra
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    F
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Groups 0

    fXtra

    @fXtra

    0
    Reputation
    1
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    fXtra Unfollow Follow

    Latest posts made by fXtra

    • RE: CalendarExt3 eventTransformer and refreshInterval

      @chrisfr1976
      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.

                      eventTransformer: (ev) => {
                          if (ev.calendarName === "Trash") {
                              const trash = [];
                              ev.color = 'gray';
      
                              if (ev.title.search('Altpapiertonne') > -1) {
                                  trash.push("fa-solid fa-trash trash-blue")
                              }
      
                              if (ev.title.search('Gelbe Tonne') > -1) {
                                  trash.push("fa-solid fa-trash trash-yellow")
                              }
      
                              if (ev.title.search('Biotonne') > -1) {
                                  trash.push("fa-solid fa-trash trash-brown")
                              }
      
                              if (ev.title.search('Restmülltonne') > -1) {
                                  trash.push("fa-solid fa-trash trash-black")
                              }
      
                              ev.symbol = trash;
                              if (trash.length === 0) {
                                  ev.symbol = [];
                                  ev.color = "none";
                              }
                          }
                          return ev;
                      }
                  }
              }
      

      alt text

      posted in Troubleshooting
      F
      fXtra
    • CalendarExt3 eventTransformer and refreshInterval

      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

      posted in Troubleshooting
      F
      fXtra