Sjohn21 / MMM-GPIO-HANDLER

A Handler for GPIO Input and Output for Magic Mirror
MIT License
3 stars 0 forks source link

Not starting #2

Open Aergernis opened 9 months ago

Aergernis commented 9 months ago

Hi, i've trouble to get the module to start.

 `.::///+:/-.        --///+//-:``    philipp@MagicMirror
 `+oooooooooooo:   `+oooooooooooo:    -------------------
  /oooo++//ooooo:  ooooo+//+ooooo.    OS: Raspbian GNU/Linux 12 (bookworm) aarch64
  `+ooooooo:-:oo-  +o+::/ooooooo:     Host: Raspberry Pi 4 Model B Rev 1.2
   `:oooooooo+``    `.oooooooo+-      Kernel: 6.1.0-rpi8-rpi-v8
     `:++ooo/.        :+ooo+/.`       Uptime: 44 mins
        ...`  `.----.` ``..           Packages: 2293 (dpkg)
     .::::-``:::::::::.`-:::-`        Shell: bash 5.2.15
    -:::-`   .:::::::-`  `-:::-       Resolution: 2560x1440
   `::.  `.--.`  `` `.---.``.::`      Terminal: /dev/pts/2
       .::::::::`  -::::::::` `       CPU: (4) @ 1.500GHz
 .::` .:::::::::- `::::::::::``::.    Memory: 631MiB / 3793MiB
-:::` ::::::::::.  ::::::::::.`:::-
::::  -::::::::.   `-::::::::  ::::
-::-   .-:::-.``....``.-::-.   -::-
 .. ``       .::::::::.     `..`..
   -:::-`   -::::::::::`  .:::::`
   :::::::` -::::::::::` :::::::.
   .:::::::  -::::::::. ::::::::
    `-:::::`   ..--.`   ::::::.
      `...`  `...--..`  `...`
            .::::::::::
             `.-::::-`

pigpiod -v 79 pigpiod -l is running

Magic Mirror is controlled with pm2. Adding sudo pigpiod -l to mm.sh gives a error that it can't start (because it's already running) and even when killing the process before start i get the same Error.

Describing process with id 0 - name MagicMirror
┌───────────────────┬───────────────────────────────────────────────┐
│ status            │ online                                        │
│ name              │ MagicMirror                                   │
│ namespace         │ default                                       │
│ version           │ 2.26.0                                        │
│ restarts          │ 4                                             │
│ uptime            │ 5m                                            │
│ script path       │ /home/philipp/MagicMirror/installers/mm.sh    │
│ script args       │ N/A                                           │
│ error log path    │ /home/philipp/.pm2/logs/MagicMirror-error.log │
│ out log path      │ /home/philipp/.pm2/logs/MagicMirror-out.log   │
│ pid path          │ /home/philipp/.pm2/pids/MagicMirror-0.pid     │
│ interpreter       │ bash                                          │
│ interpreter args  │ N/A                                           │
│ script id         │ 0                                             │
│ exec cwd          │ /home/philipp/MagicMirror                     │
│ exec mode         │ fork_mode                                     │
│ node.js version   │ N/A                                           │
│ node env          │ N/A                                           │
│ watch & reload    │ ✘                                             │
│ unstable restarts │ 0                                             │
│ created at        │ 2024-03-08T13:47:47.756Z                      │
└───────────────────┴───────────────────────────────────────────────┘
 Revision control metadata
┌──────────────────┬──────────────────────────────────────────────────────────────┐
│ revision control │ git                                                          │
│ remote url       │ https://github.com/MichMich/MagicMirror.git                  │
│ repository root  │ /home/philipp/MagicMirror                                    │
│ last update      │ 2024-03-08T13:47:47.806Z                                     │
│ revision         │ 118e21238c3a9429092429dd6609a77feb5c4093                     │
│ comment          │ Merge branch 'develop' of https://github.com/MichMich/MagicM │
│ branch           │ master                                                       │
└──────────────────┴──────────────────────────────────────────────────────────────┘

pm2 log:

0|MagicMirror  | [08.03.2024 14:47.54.650] [LOG]   MMM-GPIO-HANDLER: Registering input pin: 8 for Other type of Sensor
0|MagicMirror  | [08.03.2024 14:47.54.658] [LOG]   MMM-GPIO-HANDLER: Registering input pin: 14 for Pir Sensor
0|MagicMirror  | [08.03.2024 14:47.54.660] [LOG]   MMM-GPIO-HANDLER: Registering input pin: 24 for Button 1
0|MagicMirror  | [08.03.2024 14:47.54.661] [LOG]   MMM-GPIO-HANDLER: Registering input pin: 25 for Button 2
0|MagicMirror  | [08.03.2024 14:47.54.663] [LOG]   MMM-GPIO-HANDLER: Registering output pin: 4 for Ledstrip FET cool
0|MagicMirror  | [08.03.2024 14:47.54.665] [LOG]   MMM-GPIO-HANDLER: Registering output pin: 10 for Relay CH1
0|MagicMirror  | [08.03.2024 14:47.54.666] [LOG]   MMM-GPIO-HANDLER: Registering output pin: 12 for Button 8 LED FET
0|MagicMirror  | [08.03.2024 14:47.54.668] [LOG]   MMM-GPIO-HANDLER: Registering output pin: 15 for Display K0
0|MagicMirror  | [08.03.2024 14:47.54.669] [LOG]   MMM-GPIO-HANDLER: Registering output pin: 17 for Button 7 LED FET
0|MagicMirror  | [08.03.2024 14:47.54.671] [LOG]   MMM-GPIO-HANDLER: All pins in configuration are registered.
0|MagicMirror  | [08.03.2024 14:47.54.695] [ERROR] Whoops! There was an uncaught exception...
0|MagicMirror  | [08.03.2024 14:47.54.700] [ERROR] AssertionError [ERR_ASSERTION]: Argument 'steady' must be a numeric bewtween 0 or 300000
0|MagicMirror  |     at _gpio.glitchSet (/home/philipp/MagicMirror/modules/MMM-GPIO-HANDLER/node_modules/pigpio-client/pigpio-client.js:751:9)
0|MagicMirror  |     at Class.inputHandler (/home/philipp/MagicMirror/modules/MMM-GPIO-HANDLER/node_helper.js:113:19)
0|MagicMirror  |     at Class.socketNotificationReceived (/home/philipp/MagicMirror/modules/MMM-GPIO-HANDLER/node_helper.js:79:9)
0|MagicMirror  |     at Socket.<anonymous> (/home/philipp/MagicMirror/js/node_helper.js:104:11)
0|MagicMirror  |     at Socket.emit (node:events:514:28)
0|MagicMirror  |     at Socket.emitUntyped (/home/philipp/MagicMirror/node_modules/socket.io/dist/typed-events.js:69:22)
0|MagicMirror  |     at /home/philipp/MagicMirror/node_modules/socket.io/dist/socket.js:704:39
0|MagicMirror  |     at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
0|MagicMirror  |   generatedMessage: false,
0|MagicMirror  |   code: 'ERR_ASSERTION',
0|MagicMirror  |   actual: false,
0|MagicMirror  |   expected: true,
0|MagicMirror  |   operator: '=='
0|MagicMirror  | }
0|MagicMirror  | [08.03.2024 14:47.54.701] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
0|MagicMirror  | [08.03.2024 14:47.54.704] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues

Any idea?

Sjohn21 commented 9 months ago

Hi @Aergernis, Could you post your MMM-GPIO-HANDLER part of your Config.js? It looks like something is of with the debounce value. When I know your config I could have a look and see if I need to build in a check for this value as well.

Aergernis commented 9 months ago

In only added the the defalut config


    modules: [
        {
            module: "MMM-mmpm",
        },
        {
            module: "alert",
        },
        {
            module: 'MMM-ViewNotifications',
            position: "top_left",
            header: "Notifications",
            config:
            {
                timeout: 60,
                includeModules: ["MMM-GPIO-Notifications", "MMM-Screen-Powersave-Notification", "MMM-MQTTbridge", "MMM-CommandToNotification", "MMM-GPIO-HANDLER" ]
            }
        },
        {
            module: "clock",
            position: "top_left"
        },
        {
            module: "MMM-GPIO-HANDLER",
            config: {
                debounce: 10000,
                longPressTime: 500000,
                longPressTimeOut: 3000000,
                input: {
                    "24": {
                        type: "Button",
                        name: "Button 1",
                        pull: "PUD_DOWN"
                    },
                    "25": {
                        type: "Button",
                        name: "Button 2",
                        pull: "PUD_UP"
                    },
                    "14": {
                        type: "PIR",
                        name: "Pir Sensor",
                        pull: "PUD_DOWN"                
                    },
                    "8": {
                        type: "Other",
                        name: "Other type of Sensor"        
                    }
                },
                output: {
                    "4": {
                        type: "PWM",
                        name: "Ledstrip FET cool",
                        default_PWM_effect: "Fixed",
                        default_PWM_state: 250000
                    },
                    "12": {
                        type: "hardwarePWM",
                        name: "Button 8 LED FET",
                        default_PWM_effect: "Pulse",
                        default_PWM_speed: 50,
                        default_PWM_steps: 50
                    },
                    "15": {
                        type: "On/Off",
                        name: "Display K0",
                        default_state: 1
                    },
                    "10": {
                        type: "On/Off",
                        name: "Relay CH1",
                        default_state: 0
                    },
                    "17": {
                        type: "PWM",
                        name: "Button 7 LED FET",
                        default_PWM_effect: "Breath",
                        default_PWM_speed: 50,
                        default_PWM_steps: 10,
                        default_PWM_upperLimitDCP: 80,
                        default_PWM_lowerLimitDCP: 20
                    }
                }
            }
        },
    ]

also tryed with older OS Verion

 `.::///+:/-.        --///+//-:``    philipp@MagicMirror
 `+oooooooooooo:   `+oooooooooooo:    -------------------
  /oooo++//ooooo:  ooooo+//+ooooo.    OS: Raspbian GNU/Linux 11 (bullseye) aarc
  `+ooooooo:-:oo-  +o+::/ooooooo:     Host: Raspberry Pi 4 Model B Rev 1.2
   `:oooooooo+``    `.oooooooo+-      Kernel: 6.1.21-v8+
     `:++ooo/.        :+ooo+/.`       Uptime: 5 mins
        ...`  `.----.` ``..           Packages: 2031 (dpkg)
     .::::-``:::::::::.`-:::-`        Shell: bash 5.1.4
    -:::-`   .:::::::-`  `-:::-       Resolution: 2560x1440
   `::.  `.--.`  `` `.---.``.::`      Terminal: /dev/pts/0
       .::::::::`  -::::::::` `       CPU: BCM2835 (4) @ 1.500GHz
 .::` .:::::::::- `::::::::::``::.    Memory: 518MiB / 3794MiB
-:::` ::::::::::.  ::::::::::.`:::-
::::  -::::::::.   `-::::::::  ::::
-::-   .-:::-.``....``.-::-.   -::-
 .. ``       .::::::::.     `..`..
   -:::-`   -::::::::::`  .:::::`
   :::::::` -::::::::::` :::::::.
   .:::::::  -::::::::. ::::::::
    `-:::::`   ..--.`   ::::::.
      `...`  `...--..`  `...`
            .::::::::::
             `.-::::-`
Aergernis commented 9 months ago

After some testing, and your hint with debounce time i lowerd it to 300 and it's working.

also is there a config method to connect to a remote pigpiod besides from editing the node_helper.js?

Sjohn21 commented 9 months ago

Ah , yes debounce 300 will do. I've changed some code after making the initial example config and forgot to update the example. I will adjust the example config and will add some error handling for this and some other config values which do not have error handling right now.

At the moment it is not possible to connect to a remote pigpiod instance (without chaning 'node-helper.js'). I will dive into this config option as well.

This will be somewhere next week.

Aergernis commented 9 months ago

Thanks for help and don't stress it, remote connection is "only" a nice to have. But for your Info, the gpio config will only register pins when a client connects to the Magic Mirror Server, maybe there is a way to register them on connect from pigpiod. This way the Pins are not floating and relais will have a defined state.

Edit: and also when reloading the Magic Mirror Page [ERROR] Notification 'CONFIG' received, but MMM-GPIO-HANDLER does not recognize this notification. is logged and the Alert Module shows a empty Box overlaying everything