Jopyth/MMM-Remote-Control

Restart MagicMirror

swvalenti194 opened this issue · 24 comments

The web page opens just fine (all up to date on everything) but when I hit the power button then restart magicmirror the mirror doesn't restart? At loss as to why?

Thanks,
Scott

Hey! So, this is most probably because your MagicMirror installation doesn't have the PM2 configured. I'll let you the tutorial on how to install and configure it over here.

Let me know if that works for you, or if you already have the PM2 installed in your system so we can proceed. Cheers :D

Pm2 already installed however it's pm2 restart MagicMirror not pm2 restart mm

Well, if you follow the guide, the name of the file it's mm.sh, and that gives the name to the process.

On the other hand, if I'm not reading the file incorrectly, you can use pm2ProcessName inside the config of Remote Control to determine the name of the process, if it's a custom one.

I used Sam's scripts which names the pm2 as MagicMirror, so what is it I need to do in order to rectify? Change config where? Thanks for responding

Oh, I didn't know there was a script for that. Could you send it to me so I can take a look after all this?

Over here it's the Wiki on how to configure the module. The file it's inside your MagicMirror folder, under the config one.
You have to search inside that file for our module: module: 'MMM-Remote-Control'
After that, inside the config of our module, you should add pm2ProcessName: 'MagicMirror',
That portion of the file after the change should be:

{
  module: 'MMM-Remote-Control',
  config: {
    pm2ProcessName: 'MagicMirror',
  },
},

I hope you understand my instructions, I'll be here to answer in case that didn't work. Cheers :D

Here are the scripts https://github.com/sdetweil/MagicMirror_scripts

Sadly that didn't work

{ module: 'MMM-Remote-Control', // uncomment the following line to show the URL of the remote control on the mirror // position: 'bottom_left', // you can hide this module afterwards from the remote control itself config: { customCommand: {}, // Optional, See "Using Custom Commands" below pm2ProcessName: 'MagicMirror', showModuleApiMenu: true, // Optional, Enable the Module Controls menu secureEndpoints: true, // Optional, See API/README.md // uncomment any of the lines below if you're gonna use it // customMenu: "custom_menu.json", // Optional, See "Custom Menu Items" below apiKey: "XXXXXXXXXXXXXXXX", // Optional, See API/README.md for details // classes: {} // Optional, See "Custom Classes" below } },

Refresh browser button works but not restart MagicMirror

I put that in the config.js I guess it needs to go somewhere else?

I think it's fine, let me check it when I get home and I'll let you know. :D

Okay, I can confirm that such command works. I'll explain it to you a bit better.

First, use pm2 list to see every pm2 instance that can be used. You'll see something like this:
image

After that, copy the name that's shown there, and go to the remote.html of your MagicMirror. Go to edit config.js, click into Remote Control, and you'll see something like this:
image

Below config, you have the text area right next to it, over there write pm2ProcessName and add it with the + button.
You'll see the next line inside config:
image

So inside the text area on the right of delete, you should paste the name of the process.
Open the menu burger, click save, and save again. You should restart your MagicMirror from your console the first time, so use pm2 restart [Name of your process], and when the MagicMirror reloads, you'll be able to restart it right inside the menu.

Hope that works just fine, let me know if it works. :D

still doesnt work brother see...

Capture
Capture2

And if you use pm2 restart MagicMirroron the console, it works?

You could try using 0 instead, it also can restart with id.

Yes it works and what with 0?

You can use pm2 logs for the logs, could you send them to me? Of course if there's anything personal, delete it.
Try pressing the restart button while reading pm2 logs.

0 in your pm2 installation it's the id for the MagicMirror. So you could use it to restart the process too.

Error.txt

Here you go sir

Alright! I made some time to see the error, and I can see that's not a problem of the name itself, It's more a problem of the pm2. According to that, seems to not being installed. When you enter node_modules folder, do see the pm2 module?

Sounds to me that pm2 could be installed locally inside the MagicMirror folder, and that shouldn't be that way, the pm2 should be installed globally.

pm2 is installed globally not local in MM

Perfect, now try using npm link pm2 inside your MagicMirror folder.

That did the trick thank you!

Glad to help! Cheers :D

I was having this same issue, the error message telling me PM2 wasn't installed or linked. The suggestion to use npm link pm2 inside my MagicMirror folder broke my mirror. PM2 now throws the following error message repeatedly in the logs:

0|mm | > magicmirror@2.18.0 start 0|mm | > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js 0|mm | sh: 1: ./node_modules/.bin/electron: not found 0|mm | Wrote 0x00000000 to 0xfec02020

How can I fix this?

Seems like your instalation isn't right, this is not a RC problem, because electron wasn't found according to that error. Please re-verify your instalation of MagicMirror, then add RemoteControl and recheck that everything it's working fine.
@SdeGeata

Magic Mirror was all working fine prior to npm link pm2. It was only the command line for MMM-Remote-Control to restart MM that was telling me PM2 wasn't linked. Now everything is broken.

I never had any errors about pm2 or electron prior.

Please create a new issue, or a discussion. There should be something wrong with your configuration, and it's not the same issue. Cheers!