• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Updating Compliments using a spreadsheet

Scheduled Pinned Locked Moved Development
14 Posts 4 Posters 3.4k Views 4 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.
  • E Offline
    emrah_asl @sdetweil
    last edited by Aug 6, 2020, 12:30 AM

    @sdetweil after I created node__helper.js manually, then I typed ‘npm start’ , the file has created, bu this time there was electron error (MM closed) interesting.

    S 1 Reply Last reply Aug 6, 2020, 12:32 AM Reply Quote 0
    • S Away
      sdetweil @emrah_asl
      last edited by Aug 6, 2020, 12:32 AM

      @emrah_asl yeh, that won’t work

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • E Offline
        emrah_asl
        last edited by Aug 6, 2020, 12:33 AM

        @sdetweil so, what is formula to run this ? what do you think acording your experience ?

        S 1 Reply Last reply Aug 6, 2020, 1:32 AM Reply Quote 0
        • S Away
          sdetweil @emrah_asl
          last edited by Aug 6, 2020, 1:32 AM

          @emrah_asl well, the problem is coming up w something u have the skills to do.

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • S Away
            sdetweil
            last edited by sdetweil Aug 6, 2020, 12:02 PM Aug 6, 2020, 12:00 PM

            so, thinking more.

            do you have a js routine that will download the sheet in json and convert to the proper format now? you would execute it with

            node ???whatever your script name is???

            if so, you could add it to the installers/mm.sh script that is used by pm2 to start mm.

            this way every time mm is started, you would download the new compliments file sheet and convert it

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • E Offline
              emrah_asl
              last edited by Aug 7, 2020, 8:51 PM

              Hi @sdetweil ,

              Thanks for reply.

              my code in node_helper.js (under compliments folder) are creating file on root normally when you start mm with npm start

              The problems are,
              1 - I need to change save folder not root side, it needs to be under compliements folder, so I change this but not works

               var fs = require('fs');
                      fs.writeFile("modules/default/compliments/remotefile.json", compliments, function(err) {
                          if (err) {
                              return console.log(err);
                          }
              
                          console.log("The file was saved!");
                      });
              
              1. The second problem , my magic mirror fires electron.js error when I try to create file. I’m new on these, how can i use mm.sh for create&locate remotefile.json under compliments folder ?
              S 1 Reply Last reply Aug 7, 2020, 8:59 PM Reply Quote 0
              • S Away
                sdetweil @emrah_asl
                last edited by sdetweil Aug 10, 2020, 9:47 PM Aug 7, 2020, 8:59 PM

                @emrah_asl said in Updating Compliments using a spreadsheet:

                 fs.writeFile("modules/default/compliments/remotefile.json", compliments, function(err) {
                
                1. my code in node_helper.js (under compliments folder) are creating file on root normally when you start mm with npm start

                don’t make this node_helper.js as MM has a special use for that…
                make it createCompliments.js

                then the best thing is use the full path for the file

                     fs.writeFile("/home/pi/MagicMirror/modules/default/compliments/remotefile.json", compliments, function(err) {
                

                how do you start MM?

                pm2 start 0 (and it starts on boot too…) If you used the automated install script u would have been prompted to set this up.
                (if u want to add it now, you can run the fixuppm2.sh script from here
                https://github.com/sdetweil/MagicMirror_scripts
                just one line to copy/paste
                )

                now, if you use pm2, it launches MM by using the installers/mm.sh script. you can add your

                node modules/default/compliments/createCompliments.js
                

                to the mm.sh and all will continue as normal.

                1. The second problem , my magic mirror fires electron.js error when I try to create file.

                i don’t understand this.

                npm start fires electron.js

                npm reads the package,json file and looks for the command requested

                	"scripts": {
                		"start": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js",
                

                the ‘start’ command executes that line.

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • 1
                • 2
                • 2 / 2
                2 / 2
                • First post
                  12/14
                  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