MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-Todoist - Your todoist tasks on your mirror

    Scheduled Pinned Locked Moved Productivity
    76 Posts 37 Posters 107.0k Views 39 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • tidus5T Offline
      tidus5
      last edited by yawns

      This is my code
      it’s based on 2 users (i badly commented the code)

      /* Magic Mirror
       * Fetcher
       *
       *
       * By Michael Teeuw http://michaelteeuw.nl edited for Wunderlist by Paul-Vincent Roll
       * Edited again for Todoist by Chris Brooker
       * 
       * MIT Licensed.
       */
      
      var request = require("request");
      
      /* Fetcher
       * Responsible for requesting an update on the set interval and broadcasting the data.
       *
       * attribute listID string - ID of the Wunderlist list.
       * attribute reloadInterval number - Reload interval in milliseconds.
       */
       
       	function dateDiff(date1, date2){
          var diff = {}                           // Initialisation du retour
          var tmp = date2 - date1;
       
          tmp = Math.floor(tmp/1000);             // Nombre de secondes entre les 2 dates
          diff.sec = tmp % 60;                    // Extraction du nombre de secondes
       
          tmp = Math.floor((tmp-diff.sec)/60);    // Nombre de minutes (partie entière)
          diff.min = tmp % 60;                    // Extraction du nombre de minutes
       
          tmp = Math.floor((tmp-diff.min)/60);    // Nombre d'heures (entières)
          diff.hour = tmp % 24;                   // Extraction du nombre d'heures
           
          tmp = Math.floor((tmp-diff.hour)/24);   // Nombre de jours restants
          diff.day = tmp;
           
          return diff;
      }
      
      var Fetcher = function(listID, reloadInterval, accessToken, clientID) {
       var self = this;
       if (reloadInterval < 1000) {
      	reloadInterval = 1000;
       }
      
       var reloadTimer = null;
       var items = [];
      
       var fetchFailedCallback = function() {};
       var itemsReceivedCallback = function() {};
      
       /* private methods */
      
       /* fetchTodos()
      	* Request the new items.
      	*/
      
       var fetchTodos = function() {
      	clearTimeout(reloadTimer);
      	reloadTimer = null;
      
      	request({
      		url: "https://todoist.com/API/v7/sync/",
      		method: "POST",
      		headers: { 
      			'content-type': 'application/x-www-form-urlencoded',
      			'cache-control': 'no-cache' 
      		},
      		form: { 
      				token: accessToken,
      				sync_token: '*',
      				resource_types: '["items"]' 
      		}
      	 },
      	 
      	 
      	 function(error, response, body) {
      		if (!error && response.statusCode == 200) {
               items = [];
      		 for (var i = 0; i < JSON.parse(body).items.length; i++) {
      			 if (JSON.parse(body).items[i].project_id == listID) {
      		
      		donneetableau = JSON.parse(body).items[i];
      		onbalance = [];
      		icontodo = [];
      		assignedname = [];
      		datedueretour = [];
      		contentretour = [];
      		assignedtodoname = [];
      		checkedretour = [];
      		
      		
      		if (donneetableau.priority == '1') {icontodo ='<i></i> '}
      		else if (donneetableau.priority == '2') {icontodo ='<i></i> '}
      		else if (donneetableau.priority == '3') {icontodo ='<i></i> '}
      		else {icontodo ='<i></i> '}
      
      		if (donneetableau.assigned_by_uid == 'XXXXXXXX') {assignedname ='(XXXXX)'}//TEST  first XXX UID second XXXX yourname
      		else if (donneetableau.assigned_by_uid == 'XXXXXXX') {assignedname ='(XXXXXX)'}//TEST  first XXX UID second XXXX yourname
      		else {assignedname ='Inconnu'};
      		
      		if (donneetableau.due_date_utc) 
      			{
      				date1 = new Date();
      				date2 = new Date(donneetableau.due_date_utc);
      				diff = dateDiff(date1, date2);
      								
      				if (diff.day = '1') {datedueretour += diff.day + 'd <i></i> ';}
      				else if (diff.hour >= '1') {datedueretour += diff.hour + 'h <i></i> ';}		
      				else {datedueretour += diff.min + 'min <i></i> ';};						
      
      
      			}
      		else {datedueretour =''};
      		
      		contentretour = donneetableau.content;
      		
      		if (donneetableau.responsible_uid ) {
      		if (donneetableau.responsible_uid == 'XXXXXXX') {
      		assignedtodoname ='<i></i> '
      		} ////YOUR UID USER
      		
      		else if (donneetableau.responsible_uid == 'XXXXXXX') {assignedtodoname ='<i></i> '}
      		else {assignedtodoname ='Inconnu'};  // YOUR UID USER
      		} else { assignedtodoname ='' };
      		
      		checkedretour = donneetableau.checked;
      		onbalance +=assignedtodoname + icontodo + datedueretour + contentretour;
      		items.push(onbalance);	
      				//items.split('\n');
      				 //priority.push(JSON.parse(body).priority[i].priority);	
      				 //datedue.push(JSON.parse(body).datedue[i].due_date_utc);	
      
      			 }
      		 }
      		 self.broadcastItems();
      		 scheduleTimer();
      		}
      	 });
      
       };
      
       /* scheduleTimer()
      	* Schedule the timer for the next update.
      	*/
      
       var scheduleTimer = function() {
      	//console.log('Schedule update timer.');
      	clearTimeout(reloadTimer);
      	reloadTimer = setTimeout(function() {
      	 fetchTodos();
      	}, reloadInterval);
       };
      
       /* public methods */
      
       /* setReloadInterval()
      	* Update the reload interval, but only if we need to increase the speed.
      	*
      	* attribute interval number - Interval for the update in milliseconds.
      	*/
       this.setReloadInterval = function(interval) {
      	if (interval > 1000 && interval < reloadInterval) {
      	 reloadInterval = interval;
      	}
       };
      
       /* startFetch()
      	* Initiate fetchTodos();
      	*/
       this.startFetch = function() {
      	fetchTodos();
       };
      
       /* broadcastItems()
      	* Broadcast the exsisting items.
      	*/
       this.broadcastItems = function() {
      	if (items.length
      
      1 Reply Last reply Reply Quote 0
      • C Offline
        Cupola
        last edited by Cupola

        Dumb question, how do you exactly generate the access token? I’m a little bit confused…
        From pm2 logs, I read:
        ** Message: console message: http://localhost:8080/modules/MMM-Todoist//MMM-Todoist.js @199: SyntaxError: Unexpected token ‘>’
        I used the access token generated from here, but I’m not sure about the process, which App service URL did you use? Which OAuth redirect URL? And last which token is the right one? I can see three of them
        Thanks in advance

        pyrosmileyP 1 Reply Last reply Reply Quote 1
        • pyrosmileyP Offline
          pyrosmiley @Cupola
          last edited by

          @Cupola

          Not a dumb question, don’t worry! Oauth2 can be super confusing, and everyone does it a little differently which is… frustrating at best.

          The Access Token you need is the 3rd one, what they refer to as your Test Token on the page. (The idea behind this is that with OA2, each would-be client has to use its ID and Secret to ask for specific account access for each account it wants to see. They basically did that process for you once, for testing or personal things like this that only need your account.)

          You don’t need to worry about the OAuth redirect URL or the App Service URL. I have each filled with http://127.0.0.1 but I don’t think either are required at all.

          Hopefully this gets you up and running!

          1 Reply Last reply Reply Quote 0
          • C Offline
            Cupola
            last edited by

            Thank you, now it’s working

            1 Reply Last reply Reply Quote 1
            • M Offline
              mariecbilodeau
              last edited by

              Is there a way to add bullets before each task?

              1 Reply Last reply Reply Quote 0
              • A Offline
                amomat
                last edited by

                Hi. Is it possible to show who the task is assigned to? Trying to set up a to-do list for the kids to show their chores.

                1 Reply Last reply Reply Quote 0
                • eprostkoE Offline
                  eprostko
                  last edited by

                  Todoist is working on my MM, but the day is not right. I have a daily recurring task that says “today” on my mirror, but is “tomorrow” when I look on todoist.com directly or on my phone app.

                  Has anyone else seen and resolved this behavior?

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Mariba
                    last edited by

                    Hey,
                    is there functionality to see the number of days left for an event? I’d be happy if I could see that.
                    Or is it possible to show it myself by subtracting the date of the event from the current date? If yes, how do I do it?
                    Thanks. Happy New Year.

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      jani.karna
                      last edited by

                      Hi! How can I get sorting working? No matter what I try, items are only added to the end of the list. I would like to sort them by priority and then by due date, but can’t figure of how.

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        Jas
                        last edited by

                        For the OAuth, I can’t seem to find the “Test Token” on ToDoList site. Under the app, I only have Client ID and Client Secret. Under Settings/Integrations, there is a entry for API Token. Which of the 3 should I be using? Right now, I don’t have anything showing up from ToDoList when Mirror is running.

                        Thanks

                        1 Reply Last reply Reply Quote 0
                        • C Offline
                          Clubjack @cbrooker
                          last edited by

                          @cbrooker

                          Hey. I am using your Module.
                          Thank You for your work.

                          Do You think, its easy to change the Look?
                          I youse the Module “Mmm-my calendar”, and it would be great to have the same Look.
                          (two lines, one with Taskname, one with date, and a Symbol)

                          Mayve someone have an idea to realize that

                          C 1 Reply Last reply Reply Quote 0
                          • C Offline
                            Clubjack @Clubjack
                            last edited by

                            Could one of the professionals take a look at the config of MMM-Todoist and MMM-myCalendar and see if it would be possible to easily adapt the look of mycalendar to that of todoist?

                            1 Reply Last reply Reply Quote 0
                            • C Offline
                              Clubjack
                              last edited by

                              I must ask again.🙈

                              Could somebody help me to change the Look of MMM-Todoist?
                              It would be great, if the Look could be the same like MMM-myCalendar.
                              Then it would make a better overall impression.

                              At first, it would be great to know, if this is (easily) makebal.

                              cowboysdudeC 1 Reply Last reply Reply Quote 0
                              • CynicC Offline
                                Cynic
                                last edited by

                                Hello everyone! Need your help. Parameter: showProjects: false does not remove the project from the mirror. Where is the mistake?

                                I am not a wizard. I am just learning.

                                1 Reply Last reply Reply Quote 0
                                • cowboysdudeC Offline
                                  cowboysdude Module Developer @Clubjack
                                  last edited by

                                  @Clubjack said in MMM-Todoist - Your todoist tasks on your mirror:

                                  I must ask again.🙈

                                  Could somebody help me to change the Look of MMM-Todoist?
                                  It would be great, if the Look could be the same like MMM-myCalendar.
                                  Then it would make a better overall impression.

                                  At first, it would be great to know, if this is (easily) makebal.

                                  You’d need to change the css and more then like the innerHTML’s themselves.

                                  1 Reply Last reply Reply Quote 0
                                  • B Offline
                                    banbutcher
                                    last edited by banbutcher

                                    hi,

                                    ive just installed mmm-todoist on my mirror and after the install i can start the mirror fine but it seems that after its installed i think its affecting either mmm-keybindings of mmm-carousel because normally i can use the arrow keys to gleft and right BUT im not able to click on the page indicator to select a page, and after installing mmm-todoist im now not able to use arrow keys to select page BUT i am now able to click on the page indicator to select pages!! Curious!!

                                    i get no errors starting but in the development tools section im getting these warnings and errors:

                                    /home/pi/MagicMirror…rity-warnings.js:95 Electron Security Warning (Insecure Resources) This renderer process loads resources using insecure
                                      protocols.This exposes users of this app to unnecessary security risks.
                                      Consider loading the following resources over HTTPS or FTPS. 
                                     - http://0.0.0.0:8080/css/main.css
                                    - http://0.0.0.0:8080/fonts/roboto.css
                                    - http://0.0.0.0:8080/socket.io/socket.io.js
                                    - http://0.0.0.0:8080/vendor/node_modules/nunjucks/browser/nunjucks.min.js
                                    - http://0.0.0.0:8080/js/defaults.js
                                    - http://0.0.0.0:8080/config/config.js
                                    - http://0.0.0.0:8080/vendor/vendor.js
                                    - http://0.0.0.0:8080/modules/default/defaultmodules.js
                                    - http://0.0.0.0:8080/js/logger.js
                                    - http://0.0.0.0:8080/translations/translations.js
                                    - http://0.0.0.0:8080/js/translator.js
                                    - http://0.0.0.0:8080/js/class.js
                                    - http://0.0.0.0:8080/js/module.js
                                    - http://0.0.0.0:8080/js/loader.js
                                    - http://0.0.0.0:8080/js/socketclient.js
                                    - http://0.0.0.0:8080/js/main.js
                                    - http://0.0.0.0:8080/fonts/node_modules/roboto-fontface/fonts/roboto-condensed/Roboto-Condensed-Regular.woff2
                                    - http://0.0.0.0:8080/translations/en.json
                                    - http://0.0.0.0:8080/translations/en.json
                                    - http://0.0.0.0:8080/modules/MMM-Carousel//MMM-Carousel.js
                                    - http://0.0.0.0:8080/modules/MMM-Carousel/MMM-Carousel.css
                                    - http://0.0.0.0:8080/modules/MMM-GoogleAssistant//MMM-GoogleAssistant.js
                                    - http://0.0.0.0:8080/modules/MMM-GoogleAssistant/components/response.js
                                    - http://0.0.0.0:8080/modules/MMM-GoogleAssistant/MMM-GoogleAssistant.css
                                      
                                     
                                    For more information and help, consult
                                    https://electronjs.org/docs/tutorial/security.
                                     This warning will not show up
                                    once the app is packaged.
                                    /home/pi/MagicMirror…ity-warnings.js:145 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
                                        Policy set or a policy with "unsafe-eval" enabled. This exposes users of
                                        this app to unnecessary security risks.
                                     
                                    For more information and help, consult
                                    https://electronjs.org/docs/tutorial/security.
                                     This warning will not show up
                                    once the app is packaged.
                                    :8080/modules/MMM-Go…ib/highcharts.js:10 Uncaught Error: Highcharts error #16: www.highcharts.com/errors/16
                                        at Object.a.error (:8080/modules/MMM-Go…ib/highcharts.js:10)
                                        at :8080/modules/MMM-CO…lib/highcharts.js:8
                                        at :8080/modules/MMM-CO…lib/highcharts.js:8
                                    TypeError: Cannot read property 'items' of undefined
                                        at Class.getDom (:8080/modules/MMM-To…/MMM-Todoist.js:551)
                                        at main.js:111
                                        at new Promise (<anonymous>)
                                        at updateDom (main.js:110)
                                        at main.js:52
                                        at Array.forEach (<anonymous>)
                                        at createDomObjects (main.js:21)
                                        at Object.modulesStarted (main.js:499)
                                        at startModules (loader.js:56)
                                        at loader.js:38
                                    :8080/modules/MMM-To…/MMM-Todoist.js:551 Uncaught (in promise) TypeError: Cannot read property 'items' of undefined
                                        at Class.getDom (:8080/modules/MMM-To…/MMM-Todoist.js:551)
                                        at main.js:111
                                        at new Promise (<anonymous>)
                                        at updateDom (main.js:110)
                                        at main.js:52
                                        at Array.forEach (<anonymous>)
                                        at createDomObjects (main.js:21)
                                        at Object.modulesStarted (main.js:499)
                                        at startModules (loader.js:56)
                                        at loader.js:38
                                    api.openweathermap.o…ef566eab7f1c9b6c4:1 Failed to load resource: the server responded with a status of 401 (Unauthorized)
                                    :8080/modules/defaul…therforecast.js:261 weatherforecast: Your AppID does not support long term forecasts. Switching to fallback endpoint.
                                    

                                    and my config is:

                                    
                                    /*-------------------- MMM-Todoist Route Start-----------------*/
                                    
                                        {
                                    		module: 'MMM-Todoist',
                                    		position: 'top_left',	
                                    		header: 'Todoski...', 
                                    		config: { 
                                    			hideWhenEmpty: true,
                                    			accessToken: 'xoxoxoxox',
                                    			maximumEntries: 60,
                                    			updateInterval: 10*60*1000, // Update every 10 minutes
                                    			fade: false,      
                                    			// projects and/or labels is mandatory:
                                    			projects: [ xxxxxxx, xxxxxxx ], 
                                    			//labels: [] // Tasks for any projects with these labels will be shown 		     			
                                    			},
                                        },
                                    
                                    

                                    also but not a biggie, i have 2 projects todo and magicmirror after adding a couple to each, the mirror displays them in staggered project order rather than in order as added - ie:

                                    task1 - todo
                                    task5 - MM
                                    task2 - todo
                                    task6 -MM
                                    task3 - todo
                                    task7 - MM
                                    task4 - todo

                                    id like:

                                    task1 - todo
                                    task2 - todo
                                    task3 - todo
                                    task4 - todo
                                    task5 - MM
                                    task6 -MM
                                    task7 - MM

                                    any help or ideas would be great!

                                    Many thanks,

                                    Richie

                                    1 Reply Last reply Reply Quote 0
                                    • edwardssjE Offline
                                      edwardssj @cbrooker
                                      last edited by

                                      @cbrooker Strange thing is happening here, when it refreshes the list at 10 minutes my mirror restarts, any suggestions?

                                      1 Reply Last reply Reply Quote 0

                                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                      With your input, this post could be even better 💗

                                      Register Login
                                      • 1
                                      • 2
                                      • 3
                                      • 4
                                      • 4 / 4
                                      • First post
                                        Last post
                                      Enjoying MagicMirror? Please consider a donation!
                                      MagicMirror created by Michael Teeuw.
                                      Forum managed by Sam, technical setup by Karsten.
                                      This forum is using NodeBB as its core | Contributors
                                      Contact | Privacy Policy