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

    Posts

    Recent Best Controversial
    • RE: Displaying a Shared iCloud calendar with default calendar module - possible?

      @valid8r That’s not the case. As I’m also using the Apple Family calendar and it is possible.
      See the procedure in the earlier reply from me. You have to do it from an Apple device like iPhone, iPad or Mac and than you’re able to share it in a public link.

      posted in Troubleshooting
      htilburgsH
      htilburgs
    • MMM-MyDutchWeather

      Description
      MyDutchWeather is a simple Module, that shows the actual weather from the KNMI 10-minutes network for any location in the Netherlands, based on your GPS coördinates .

      Screenshot
      alt text

      alt text

      alt text

      Download
      [card:htilburgs/MMM-MyDutchWeather]

      Extra
      I’m not an experienced programmer and do this for fun. Feel free to suggest any ideas.

      Versions
      07-04-2019 - v1.0.0 - Initial release
      08-04-2019 - v1.1.0 - Added option for Simple or Additional information

      posted in Utilities
      htilburgsH
      htilburgs
    • RE: [Remote-Control] Shutdown, Configure and Update your MagicMirror

      Same issue here 🤔

      posted in System
      htilburgsH
      htilburgs
    • RE: Displaying a Shared iCloud calendar with default calendar module - possible?

      @valid8r Did it work?

      posted in Troubleshooting
      htilburgsH
      htilburgs
    • RE: Displaying a Shared iCloud calendar with default calendar module - possible?

      You can make it ‘public’:

      IPhone

      • Go to Calendar app
      • At the bottom you see ‘calendar’
      • click on it
      • click on the ‘i’ behind the family calendar
      • go to the bottom and make sure ‘public calendar’ is selected
      • select option ‘share’ and then select copy

      Now you have the public url and can use it

      Public Share Calendar iPhone

      Mac

      • open calendar app
      • select the family calendar on the left
      • right click on the ‘wifi’ symbol
      • select settings for sharing
      • select public calendar and you can copy the url

      Good luck

      posted in Troubleshooting
      htilburgsH
      htilburgs
    • RE: Getting API data in table

      @sdetweil Thank you for the reply. I’m going to play with it and see which kind suited me the best.

      posted in Development
      htilburgsH
      htilburgs
    • RE: Getting API data in table

      @sdetweil, so what you’re saying is continu as I’m started with table, row, cells manual?

      I was hoping something in the next style would work.

         for (i = 0; i < this.MWB.length; i++) {
      	var MWB = this.MWB[i];
      

      and combining this with the text of the result. But I can’t figure it out.

      posted in Development
      htilburgsH
      htilburgs
    • Getting API data in table

      I get data through an API, lets say:

      alarm: "0"
      d0neerslag: "4"
      d0tmax: "12"
      d0tmin: "5"
      ....
      

      Currently I’m making a table, row and cells in the getDOM function to display the data:

      var TemperatuurRow = document.createElement("tr");
      TemperatuurRow.className = "temperatuur-row";
      		
      var TempTextCell = document.createElement("td");
      TempTextCell.className = "small";
      TempTextCell.innerHTML = "Neerslag";
      TemperatuurRow.appendChild(TempTextCell);
      table.appendChild(TemperatuurRow);
      			
      var TempDataCell = document.createElement("td");
      TempDataCell.className = "small fas fa-thermometer-half";
      TempDataCell.innerHTML = "  " + MWB.d0neerslag;
      TemperatuurRow.appendChild(TempDataCell);
      table.appendChild(TemperatuurRow);
      ...
      return table;	
      

      This is a lot of type-work. I was thinking isn’t there a better way?
      I was thinking of creating a table with the names and combine this with the results from the API. Can this be done? And how?

      (still trying to learn JS, but not afraid to ask) :smiling_face:

      posted in Development
      htilburgsH
      htilburgs
    • RE: Uncaught SyntaxError: Unexpected token return

      @sdetweil Oké, thank you for the explanation.

      posted in Troubleshooting
      htilburgsH
      htilburgs
    • RE: Uncaught SyntaxError: Unexpected token return

      @sdetweil YES, that did the trick! Learning a lot these few days.
      Thanks again.

      Is this notation always like this if you’re working with numbers?

      posted in Troubleshooting
      htilburgsH
      htilburgs
    • RE: Uncaught SyntaxError: Unexpected token return

      No luck…
      I’ve tried both of the options:

      	var MWB = this.MWB;
      	var n = 0;
      
      	// creating the tablerows
      	var WoonplaatsRow = document.createElement("tr");
      	WoonplaatsRow.className = "woonplaats-row";
      	
      	var WoonplaatsCell = document.createElement("td");
      	WoonplaatsCell.className = "small";
      	WoonplaatsCell.innerHTML = MWB.n.plaats;
      	WoonplaatsRow.appendChild(WoonplaatsCell);
      	table.appendChild(WoonplaatsRow);
      

      Error: Uncaught (in promise) TypeError: Cannot read property ‘plaats’ of undefined

      	var MWB = this.MWB;
      
      	// creating the tablerows
      	var WoonplaatsRow = document.createElement("tr");
      	WoonplaatsRow.className = "woonplaats-row";
      	
      	var WoonplaatsCell = document.createElement("td");
      	WoonplaatsCell.className = "small";
      	WoonplaatsCell.innerHTML = MWB.['0'].plaats;
      	WoonplaatsRow.appendChild(WoonplaatsCell);
      	table.appendChild(WoonplaatsRow);
      

      Error: Uncaught SyntaxError: Unexpected token [

      So both of the options give an error.

      posted in Troubleshooting
      htilburgsH
      htilburgs
    • RE: Uncaught SyntaxError: Unexpected token return

      @sdetweil , thanx, missed that.
      Now that this part is running the JSON data is fetched. But when I trying to show the data I get an error:

      Uncaught SyntaxError: Unexpected number
      

      This error is created by the zero in the line:
      WoonplaatsCell.innerHTML = MWB.0.plaats;

      		var MWB = this.MWB;
      
      		// creating the tablerows
      		var WoonplaatsRow = document.createElement("tr");
      		WoonplaatsRow.className = "woonplaats-row";
      		
      		var WoonplaatsCell = document.createElement("td");
      		WoonplaatsCell.className = "small";
      		WoonplaatsCell.innerHTML = MWB.0.plaats;
      		WoonplaatsRow.appendChild(WoonplaatsCell);
      		table.appendChild(WoonplaatsRow);
      

      The problem seems that I cannot use the 0 in the command.

      This is the JSON result

      object{1}
      	liveweer[1]
      		0{49}
      			alarm: "0"
      			d0neerslag: "4"
      			d0tmax: "12"
      			plaats: "Amsterdam"
      			...
      

      I used a JSON checker and it says that it’s valid JSON.
      How do I display the data from this result, if I cannot use the 0?

      posted in Troubleshooting
      htilburgsH
      htilburgs
    • Uncaught SyntaxError: Unexpected token return

      I’m creating a new module. I’m testing and get the error “Uncaught SyntaxError: Unexpected token return” at the line where is

      return table;
      

      This is the part where it goes wrong.
      I’ve been looking for typos and other errors, but cannot find them.
      Has anybody a clue?

      
      	getDom: function() {
      		
      		// creating the table
      		var table = document.createElement("table");
      		table.className = "small";
      		
      		// creating the wrapper
      		var wrapper = document.createElement("div");
      		wrapper.className = "wrapper";
      		wrapper.style.maxWidth = this.config.maxWidth;
      	
      		// The loading sequence
              	if (!this.loaded) {
                  	    wrapper.innerHTML = "Loading....";
                  	    wrapper.classList.add("bright", "light", "small");
                  	    return wrapper;
              	}	
      		
      		var MWB = this.MWB;
      
      		// creating the tablerows
      		var WoonplaatsRow = document.createElement("tr")
      		WoonplaatsRow.className = "woonplaats-row";
      		
      		var WoonplaatsCell = document.createElement("td");
      		WoonplaatsCell.className = "small";
      		WoonplaatsCell.innerHTML = "Regel1";
      		WoonplaatsRow.appendChild(WoonplaatsCell);
      		table.appendChild(WoonplaatsRow);
      		
      		var TemperatuurRow = document.createElement("tr")
      		TemperatuurRow.className = "temperatuur-row";
      		
      		var TemperatuurCell = document.createElement("td");
      		TemperatuurCell.className = "small";
      		TemperatuurCell.innerHTML = "Regel2"
      		TemperatuurRow.appendChild(TemperatuurCell);
      		table.appendChild(TemperatuurRow);
      					
      		}		
      		return table;		
      	
      	}, // <-- closes the getDom function from above```
      posted in Troubleshooting
      htilburgsH
      htilburgs
    • RE: Develop module with API

      @Mykle1 Thanks for the MMM-UFO “templates”. This really helped me to get started.
      First one down, several to go…:winking_face:

      posted in Development
      htilburgsH
      htilburgs
    • MMM-MyPrayerTimes

      Description
      MyPrayerTimes is a simple Module, that calculate prayer times for any location around the world, based on a variety of calculation methods currently used in Muslim communities using the Aladhan API

      Screenshot
      alt text

      Download
      [card:htilburgs/MMM-MyPrayerTimes]

      Extra
      I’m not an experienced programmer and do this for fun. Feel free to suggest any ideas.

      Versions
      20-03-2019 - v1.0.0 - Initial release
      02-04-2019 - v1.1.0 - Added option for 12/24 hour clock
      03-04-2019 - v1.1.1 - Added Imsak to prayer times

      posted in Utilities
      htilburgsH
      htilburgs
    • RE: Develop module with API

      @Sean @sdetweil I finaly figured it out! Thanx for the support and pointing me in the correct direction. See the result:

      alt text

      		var MPT = this.MPT;
      
      		// creating the tablerows
      		// Fajr
      		var FajrRow = document.createElement("tr")
      		FajrRow.className = "small fajr-row";
      		
      		var FajrTextCell = document.createElement("td");
      		FajrTextCell.innerHTML = "Fajr";
      		FajrRow.appendChild(FajrTextCell);
      		table.appendChild(FajrRow);
      		
      		var FajrTimeCell = document.createElement("td");
      		FajrTimeCell.className = "bright";
      		FajrTimeCell.innerHTML = MPT.Fajr;
      		FajrRow.appendChild(FajrTimeCell);
      		table.appendChild(FajrRow);
      		
      		var FajrArabCell = document.createElement("td");
      		FajrArabCell.innerHTML = "الفجر";
      		FajrRow.appendChild(FajrArabCell);
      		table.appendChild(FajrRow);
      ......
      }		
      		return table;	
      
      posted in Development
      htilburgsH
      htilburgs
    • RE: Develop module with API

      @sdetweil I don’t understand what you mean.

      posted in Development
      htilburgsH
      htilburgs
    • RE: Develop module with API

      Don’t I do this with this?

      var callWrapper = document.createElement("tr");
      callWrapper.appendChild(FajrTextCell);
      
      posted in Development
      htilburgsH
      htilburgs
    • RE: Develop module with API

      Strugling with formatting. When I use the basic code, I got the result I like but it’s not displayed nice. I like to have 3 columns.

      		var MPT = this.MPT;
      		
      		// Creating the div's for your data items
      		var top = document.createElement("div");
      		top.classList.add("list-row");
      
      		// Fajr from data
      		var mptFajr = document.createElement("div");
      		mptFajr.classList.add("small", "bright", "Fajr");
      		mptFajr.innerHTML = "Fajr : " + MPT.Fajr + " الفجر";
      		wrapper.appendChild(mptFajr);			
      			
      		// Sunrise from data
      		if (this.config.showSunrise != false) {
      		    var mptSunrise = document.createElement("div");
      		    mptSunrise.classList.add("small", "bright", "Sunrise");
      		    mptSunrise.innerHTML = "Sunrise : " + MPT.Sunrise + " شروق الشمس";
      		    wrapper.appendChild(mptSunrise);
      		}
      		// Dhuhr from data
      		var mptDhuhr = document.createElement("div");
      		mptDhuhr.classList.add("small", "bright", "Dhuhr");
      		mptDhuhr.innerHTML = "Duhr : " + MPT.Dhuhr + " الظهر";
      		wrapper.appendChild(mptDhuhr);
      
      		// Asr from data
      		var mptAsr = document.createElement("div");
      		mptAsr.classList.add("small", "bright", "Asr");
      		mptAsr.innerHTML = "Asr : " + MPT.Asr + " العصر";
      		wrapper.appendChild(mptAsr);
      			
      		// Sunset from data
      		if (this.config.showSunset != false) {
      		    var mptSunset = document.createElement("div");
      		    mptSunset.classList.add("small", "bright", "Sunset");
      		    mptSunset.innerHTML = "Sunset : " + MPT.Sunset + " غروب الشمس";
      		    wrapper.appendChild(mptSunset);
      		}
      			
      		// Maghrib from data
      		var mptMaghrib = document.createElement("div");
      		mptMaghrib.classList.add("small", "bright", "Maghrib");
      		mptMaghrib.innerHTML = "Maghrib : " + MPT.Maghrib + " المغرب";
      		wrapper.appendChild(mptMaghrib);
      		
      		// Isha from data
      		var mptIsha = document.createElement("div");
      		mptIsha.classList.add("small", "bright", "Isha");
      		mptIsha.innerHTML = "Isha : " + MPT.Isha + " العشاء";
      		wrapper.appendChild(mptIsha);
      			
      		// Midnight from data
      		if (this.config.showMidnight != false) {
      		    var mptMidnight = document.createElement("div");
      		    mptMidnight.classList.add("small", "bright", "Midnight");
      		    mptMidnigh
      

      alt text

      Now I trying for several hours to figure out how to create table, columns, rows…
      I’ve changed the code part to

      		var MPT = this.MPT;
      
      		var logs = document.createElement("table");
      		var callWrapper = document.createElement("tr");
      		callWrapper.classList.add("small");
      		
      		// Fajr
      		var FajrTextCell = document.createElement("td");
      		FajrTextCell.className.add = "xsmall bright fajrtext";
      		FajrTextCell.innerHTML = "Fajr";
      		callWrapper.appendChild(FajrTextCell);
      		
      		var FajrTimeCell = document.createElement("td");
      		FajrTimeCell.className = "xsmall bright fajrtime";
      		FajrTimeCell.innerHTML = MPT.Fajr;
      		callWrapper.appendChild(FajrTimeCell);
      		
      		var FajrArabCell = document.createElement("td");
      		FajrArabCell.className = "xsmall bright fajrarab";
      		FajrArabCell.innerHTML = "الفجر";
      		callWrapper.appendChild(FajrArabCell);
      
      		logs.appendChild(callWrapper);
      		wrapper.appendChild(logs);
      		return wrapper;
      

      The result for 1 item is nice

      alt text

      But when I repeat this for the other items, no rows are created and everything is on the same row.

      		var MPT = this.MPT;
      
      //Table Test
      
      		var logs = document.createElement("table");
      		var callWrapper = document.createElement("tr");
      		callWrapper.classList.add("small");
      		
      		// Fajr
      		var FajrTextCell = document.createElement("td");
      		FajrTextCell.className.add = "xsmall bright fajrtext";
      		FajrTextCell.innerHTML = "Fajr";
      		callWrapper.appendChild(FajrTextCell);
      		
      		var FajrTimeCell = document.createElement("td");
      		FajrTimeCell.className = "xsmall bright fajrtime";
      		FajrTimeCell.innerHTML = MPT.Fajr;
      		callWrapper.appendChild(FajrTimeCell);
      		
      		var FajrArabCell = document.createElement("td");
      		FajrArabCell.className = "xsmall bright fajrarab";
      		FajrArabCell.innerHTML = "الفجر";
      		callWrapper.appendChild(FajrArabCell);
      		
      		// Sunrise
      		var SunriseTextCell = document.createElement("td");
      		SunriseTextCell.className.add = "xsmall bright sunrisetext";
      		SunriseTextCell.innerHTML = "Sunrise";
      		callWrapper.appendChild(FajrTextCell);
      		
      		var SunriseTimeCell = document.createElement("td");
      		SunriseTimeCell.className = "xsmall bright fajrtime";
      		SunriseTimeCell.innerHTML = MPT.Sunrise;
      		callWrapper.appendChild(SunriseTimeCell);
      		
      		var SunriseArabCell = document.createElement("td");
      		SunriseArabCell.className = "xsmall bright sunrisearab";
      		SunriseArabCell.innerHTML = "شروق الشمس";
      		callWrapper.appendChild(SunriseArabCell);		
      
      		logs.appendChild(callWrapper);
      		wrapper.appendChild(logs);
      		return wrapper;
      

      alt text

      Any help to get me on the right track again?

      posted in Development
      htilburgsH
      htilburgs
    • RE: Develop module with API

      @Sean,
      Thank you for explaining and pointing me out.
      I understand what was the issue. I’ve cleaned up the code and removed the caroussel part (and unneeded variables), because I don’t use that.

      Added the possibility for showing or not showing some items.
      Up to the next part… HTML Markup

      posted in Development
      htilburgsH
      htilburgs
    • 1
    • 2
    • 8
    • 9
    • 10
    • 11
    • 12
    • 11 / 12