Read the statement by Michael Teeuw here.
MMM-PIR-Sensor tuning
-
@jc21
Thanks alot for your help. I was on vacation and will try it now.Sebastian
-
@jc21 said in MMM-PIR-Sensor tuning:
debug: true
One stupid question, how is the debug info started?
-
As @jc21 suggested, add the line
debug: true
to the module’s config section, and restart MM, then look at the console log. -
@KirAsh4 said in MMM-PIR-Sensor tuning:
I have add the line to the config section. My question is, how can I look at the console log, when I have start the mm new.
Have I go to a special folder, have I to put something in the consule?pi@raspberrypi:~ $ pm2 stop mm [PM2] Applying action stopProcessId on app [mm](ids: 0) [PM2] [mm](0) ✓ ┌──────────┬────┬──────┬─────┬─────────┬─────────┬────────┬────────┬──────────┐ │ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │ ├──────────┼────┼──────┼─────┼─────────┼─────────┼────────┼────────┼──────────┤ │ mm │ 0 │ fork │ 0 │ stopped │ 0 │ 0 │ 0 B │ disabled │ └──────────┴────┴──────┴─────┴─────────┴─────────┴────────┴────────┴──────────┘ Use `pm2 show <id|name>` to get more details about an app pi@raspberrypi:~ $ pm2 start mm [PM2] Applying action restartProcessId on app [mm](ids: 0) [PM2] [mm](0) ✓ [PM2] Process successfully started ┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬────────────┬──────── ──┐ │ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watchin g │ ├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼────────────┼──────── ──┤ │ mm │ 0 │ fork │ 1246 │ online │ 0 │ 0s │ 2.262 MB │ disable d │ └──────────┴────┴──────┴──────┴────────┴─────────┴────────┴────────────┴──────── ──┘ Use `pm2 show <id|name>` to get more details about an app pi@raspberrypi:~ $
So, what next?
Sebastian
-
You need the browser’s console log. I forgot how to pull it up in Electron, but a search on the forums should give you an answer. Alternatively, you can open your favorite browser on a different machine (on the same network) and visit the rpi’s ip and MM’s port, like so: http://rpi_ip:8080 (fill in rpi_ip). Then hit F12 on the browser to open the console panel.
-
@KirAsh4 actually it looks like most of the Debug log will appear on the server side.
You can check this with ‘pm2 logs mm’. Add ‘–lines 100’ to show more off the logs (100) in this case.
-
Most being the keyword, not all. And honestly, when I’m developing, I don’t rely on what pm2 is telling me, but rather specifically what the browser sees (or doesn’t) and where the errors lie. pm2 doesn’t do that. I can get all errors and debug messages in one place: the browser’s console log. I don’t need to open yet another window just to look at pm2’s logs.
-
-
I’m not saying it’s wrong, nor right. I just prefer to use one facility that will show everything, as opposed to one that might only show some things.
-
I agree, a central place for logging info would be ideal but that’s just not possible with MM at this point.
This is a bit out of scope for this topic, however unless you’re across the module system in depth you may not be aware that there are 2 separate “processes” to the MM for lack of a better word
- The UI, electron app that uses
console.log
and outputs to the chrome dev console if active - The Server App, express & module node_helpers that uses
console.log
to output to stdout of the process
With the way MM module system is implemented, using any additional NPM packages required by a module can only be done on the NodeJS App side (as far as I’m aware?), not in the UI where the browser dev console log is available.
That said, for this module particularly, if the UI was started with the dev console option then when motion is detected or no longer detected, the Node JS App will log a
USER_PRESENCE
socket event where the value will either betrue
orfalse
respectively. This is the case for both the original github repo and my fork. Unfortunately the dev console event system doesn’t log the value so debugging on/off values is not possible:calendar received a module notification: USER_PRESENCE from sender: MMM-PIR-Sensor
I don’t use PM2 yet, but to start the MM with dev console on just add the
dev
argument:electron js/electron.js dev
- The UI, electron app that uses