Tom-Hirschberger / MMM-GPIO-Notifications

Magic Mirror² Module which sends custom notifications based on GPIO events
MIT License
13 stars 3 forks source link

GPIO out and Pi5 support #20

Closed Aergernis closed 7 months ago

Aergernis commented 8 months ago

Hi,

is it possible to control GPIO Pins to switch relais, or do you have a Module for that? And will it support Pi5?

Tom-Hirschberger commented 8 months ago

Hi,

this module is to react to GPIO state changes only and not to control GPIO pins. It should be working with Pi5 but I do have Pi4 only.

Depending of your needs you may be able to call some simple shell scripts with my https://github.com/Tom-Hirschberger/MMM-Notification-To-Command module and control the GPIO with them. The GPIOs on the Pi are part of the sysfs filesystem and can be read and written in /sys/class/gpio

14.03.2024 16:02:46 Aergernis @.***>:

Hi,

is it possible to control GPIO Pins to switch relais, or do you have a Module for that? And will it support Pi5?

— Reply to this email directly, view it on GitHub[https://github.com/Tom-Hirschberger/MMM-GPIO-Notifications/issues/20], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ALMFULC2YRNMESJHN7ACAGLYYG3ZJAVCNFSM6AAAAABEWJA3BGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE4DMNRQGQ2TCMI]. You are receiving this because you are subscribed to this thread. [Verfolgungsbild][https://github.com/notifications/beacon/ALMFULH2YHS4LDDCEBZAOXTYYG3ZJA5CNFSM6AAAAABEWJA3BGWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHIEVHP34.gif]

Aergernis commented 8 months ago

I've tried wiht a Pi5 and it can't register pins. Used just default config for MM and this module. I also tested it with a Pi4 and latest bookworm install and it also can't register the pins.

0|MagicMirror  | [17.03.2024 13:34.27.986] [LOG]   MMM-GPIO-Notifications: Registering pin: 4
0|MagicMirror  | [17.03.2024 13:34.27.992] [ERROR] Whoops! There was an uncaught exception...
0|MagicMirror  | [17.03.2024 13:34.27.999] [ERROR] Error: EINVAL: invalid argument, write
0|MagicMirror  |     at Object.writeSync (node:fs:936:3)
0|MagicMirror  |     at Object.writeFileSync (node:fs:2330:26)
0|MagicMirror  |     at exportGpio (/home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/node_modules/onoff/onoff.js:18:8)
0|MagicMirror  |     at new Gpio (/home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/node_modules/onoff/onoff.js:172:36)
0|MagicMirror  |     at Class.registerSinglePin (/home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/node_helper.js:296:30)
0|MagicMirror  |     at Class.socketNotificationReceived (/home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/node_helper.js:457:10)
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  |   errno: -22,
0|MagicMirror  |   syscall: 'write',
0|MagicMirror  |   code: 'EINVAL'
0|MagicMirror  | }

Also MMM-Notification-To-Command is not listed in MMPM, would be nice to find it there without adding it manualy

Tom-Hirschberger commented 8 months ago

I read about a different numbering of the pins but the library I am using still should be functional on the Pi5.

Are you sure your user is part of the GPIO group?

You can check it with the groups command.

I think i never added the module to the wiki that's why it is missing in MMPM.

Aergernis commented 8 months ago
id
uid=1000(philipp) gid=1000(philipp) groups=1000(philipp),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),102(input),105(render),106(netdev),115(lpadmin),993(gpio),994(i2c),995(spi)
groups
philipp adm dialout cdrom sudo audio video plugdev games users input render netdev lpadmin gpio i2c spi

But since the problem also is on Pi4, my guess is that it's a problem with bookworm

Tom-Hirschberger commented 8 months ago

The groups look good to me. Maybe this link https://forums.raspberrypi.com/viewtopic.php?t=359302 is helpful. Looks like you need to use a total different numbering.

Aergernis commented 8 months ago

seems to be a old problem and was fixed in newer kernel. pinout seems to be the same for Pi4 and co....

The only thing i would suspect is that sysfs is diabled in kernel 6.6.20 if this is what is used to get the pin states. "When we launch 6.6 the older Pis will have the same, high-numbered GPIOsn - probably still available by sysfs, but eventually that will be switched off."

Edit: found another note about Kernel 6.6 and gpio https://forums.raspberrypi.com/viewtopic.php?t=361116#p2166256 but i have no clue what that meens

Description        : Raspberry Pi 5B rev 1.0
Revision           : d04170
SoC                : BCM2712
RAM                : 8GB
Storage            : MicroSD
USB ports          : 4 (of which 2 USB3)
Ethernet ports     : 1 (1000Mbps max. speed)
Wi-fi              : True
Bluetooth          : True
Camera ports (CSI) : 2
Display ports (DSI): 2

,--------------------------------.
| oooooooooooooooooooo J8   : +====
| 1ooooooooooooooooooo      : |USB2
|  Wi  Pi Model 5B  V1.0  fan +====
|  Fi     +---+      +---+       |
|         |RAM|      |RP1|    +====
||p       +---+      +---+    |USB3
||c      -------              +====
||i        SoC      |c|c J14     |
(        -------  J7|s|s 12 +======
|  J2 bat   uart   1|i|i oo |   Net
| pwr\..|hd|...|hd|o|1|0    +======
`-| |-1o|m0|---|m1|--------------'

J8:
   3V3  (1) (2)  5V
 GPIO2  (3) (4)  5V
 GPIO3  (5) (6)  GND
 GPIO4  (7) (8)  GPIO14
   GND  (9) (10) GPIO15
GPIO17 (11) (12) GPIO18
GPIO27 (13) (14) GND
GPIO22 (15) (16) GPIO23
   3V3 (17) (18) GPIO24
GPIO10 (19) (20) GND
 GPIO9 (21) (22) GPIO25
GPIO11 (23) (24) GPIO8
   GND (25) (26) GPIO7
 GPIO0 (27) (28) GPIO1
 GPIO5 (29) (30) GND
 GPIO6 (31) (32) GPIO12
GPIO13 (33) (34) GND
GPIO19 (35) (36) GPIO16
GPIO26 (37) (38) GPIO20
   GND (39) (40) GPIO21

J2:
RUN (1)
GND (2)

J7:
COMPOSITE (1)
      GND (2)

J14:
TR01 TAP (1) (2) TR00 TAP
TR03 TAP (3) (4) TR02 TAP

For further information, please refer to https://pinout.xyz/
Tom-Hirschberger commented 8 months ago

If I do understand correctly you will need to call

grep -s . /sys/class/gpio/gpiochip*/*

And check for the base number which is 512 in the post.

Some Kernels add the GPIO number to the base some substract it of the base.

So if your base is 512 the GPIO 4 will either be 508 or 512.

But I will have to look carefully if the onoff library will be updated or if I will have to switch to a different one in the future.

Main problem is that there is no full replacement at the moment.

Aergernis commented 8 months ago

I've tested a little..... gpio 18 and 27 are working, but i can not get 4 to work. I'll try again next week, maybe i'll find something

Tom-Hirschberger commented 8 months ago

Looks like there is a problem with kernel 6.6 that has been released last month. A lot of libraries are broken a the moment (Python and Javascript) some of them will never be fixed.

https://github.com/raspberrypi/linux/issues/6037

I followed this guide https://www.markjunghanns.de/de_DE/index.php/2017/12/27/raspberry-pi-kernel-upgraden-downgraden/ and downgraded my kernel to the previous 6.1 version with

sudo rpi-update 5fc4f643d2e9c5aa972828705a902d184527ae3f

After this everything is working on my Bookworm system. My fully updated Bullseye system still uses 6.1 kernel so no problem there.

Aergernis commented 8 months ago

Thanks for your help so fare. Tried with Kernel 6.1, but GPIO4 (Pin7) is set to Pull high when the module starts, but i need it to be Pull down.

gpiochip4: GPIOs 399-452, parent: platform/1f000d0000.gpio, pinctrl-rp1:
 gpio-399 (ID_SD               )
 gpio-400 (ID_SC               )
 gpio-401 (PIN3                )
 gpio-402 (PIN5                )
 gpio-403 (PIN7                |sysfs               ) in  hi IRQ
 gpio-404 (PIN29               )
 gpio-405 (PIN31               )
 gpio-406 (PIN26               )
 gpio-407 (PIN24               )
 gpio-408 (PIN21               )
 gpio-409 (PIN19               )
 gpio-410 (PIN23               )
 gpio-411 (PIN32               )
 gpio-412 (PIN33               )
 gpio-413 (PIN8                )
 gpio-414 (PIN10               )
 gpio-415 (PIN36               )
 gpio-416 (PIN11               )
 gpio-417 (PIN12               |sysfs               ) in  lo IRQ
 gpio-418 (PIN35               )
 gpio-419 (PIN38               )
 gpio-420 (PIN40               )
 gpio-421 (PIN15               )
 gpio-422 (PIN16               )
 gpio-423 (PIN18               )
 gpio-424 (PIN22               )
 gpio-425 (PIN37               )
 gpio-426 (PIN13               |sysfs               ) in  lo IRQ
Tom-Hirschberger commented 8 months ago

Hi,

you can set the pull up and pull down in the /boot/config.txt but I do not know if it is still working

21.03.2024 16:43:07 Aergernis @.***>:

Thanks for your help so fare. Tried with Kernel 6.1, but GPIO4 (Pin7) is set to Pull high when the module starts, but i need it to be Pull down.

— Reply to this email directly, view it on GitHub[https://github.com/Tom-Hirschberger/MMM-GPIO-Notifications/issues/20#issuecomment-2012704151], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ALMFULE3VYWUDVMPIMUVOULYZL5YTAVCNFSM6AAAAABEWJA3BGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJSG4YDIMJVGE]. You are receiving this because you commented. [Verfolgungsbild][https://github.com/notifications/beacon/ALMFULAGPADXIQFJOYDVMSDYZL5YTA5CNFSM6AAAAABEWJA3BGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTX65WZO.gif]

Aergernis commented 8 months ago

Tried to install your new release, but it's not installaing. node_modules folder is not created.

0 verbose cli /usr/local/bin/node /usr/local/bin/npm
1 info using npm@10.1.0
2 info using node@v20.8.0
3 timing npm:load:whichnode Completed in 2ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 0ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/.npmrc Completed in 0ms
10 timing config:load:project Completed in 3ms
11 timing config:load:file:/home/philipp/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 0ms
16 timing config:load Completed in 9ms
17 timing npm:load:configload Completed in 10ms
18 timing config:load:flatten Completed in 2ms
19 timing npm:load:mkdirpcache Completed in 1ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm install
22 verbose argv "install"
23 timing npm:load:setTitle Completed in 1ms
24 timing npm:load:display Completed in 1ms
25 verbose logfile logs-max:10 dir:/home/philipp/.npm/_logs/2024-03-22T19_07_35_911Z-
26 verbose logfile /home/philipp/.npm/_logs/2024-03-22T19_07_35_911Z-debug-0.log
27 timing npm:load:logFile Completed in 9ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 38ms
31 timing arborist:ctor Completed in 1ms
32 timing arborist:ctor Completed in 0ms
33 silly logfile start cleaning logs, removing 1 files
34 silly logfile done cleaning log files
35 timing idealTree:init Completed in 15ms
36 timing idealTree:userRequests Completed in 0ms
37 silly idealTree buildDeps
38 silly fetch manifest opengpio@latest
39 http fetch GET 200 https://registry.npmjs.org/opengpio 1292ms (cache miss)
40 silly placeDep ROOT opengpio@1.0.11 OK for: MMM-GPIO-Notifications@0.2.0 want: latest
41 silly fetch manifest bindings@^1.5.0
42 silly fetch manifest debug@^4.3.4
43 silly fetch manifest node-addon-api@^7.0.0
44 http fetch GET 200 https://registry.npmjs.org/node-addon-api 72ms (cache miss)
45 http fetch GET 200 https://registry.npmjs.org/debug 155ms (cache revalidated)
46 http fetch GET 200 https://registry.npmjs.org/bindings 164ms (cache revalidated)
47 timing idealTree:#root Completed in 1469ms
48 silly placeDep ROOT bindings@1.5.0 OK for: opengpio@1.0.11 want: ^1.5.0
49 silly fetch manifest file-uri-to-path@1.0.0
50 silly placeDep ROOT debug@4.3.4 OK for: opengpio@1.0.11 want: ^4.3.4
51 silly fetch manifest ms@2.1.2
52 silly placeDep ROOT node-addon-api@7.1.0 OK for: opengpio@1.0.11 want: ^7.0.0
53 http fetch GET 200 https://registry.npmjs.org/file-uri-to-path 64ms (cache revalidated)
54 http fetch GET 200 https://registry.npmjs.org/ms 90ms (cache revalidated)
55 timing idealTree:node_modules/opengpio Completed in 98ms
56 silly placeDep ROOT file-uri-to-path@1.0.0 OK for: bindings@1.5.0 want: 1.0.0
57 timing idealTree:node_modules/bindings Completed in 2ms
58 silly placeDep ROOT ms@2.1.2 OK for: debug@4.3.4 want: 2.1.2
59 timing idealTree:node_modules/debug Completed in 3ms
60 timing idealTree:node_modules/file-uri-to-path Completed in 0ms
61 timing idealTree:node_modules/ms Completed in 0ms
62 timing idealTree:node_modules/node-addon-api Completed in 0ms
63 timing idealTree:buildDeps Completed in 1574ms
64 timing idealTree:fixDepFlags Completed in 0ms
65 timing idealTree Completed in 1590ms
66 timing reify:loadTrees Completed in 1591ms
67 timing reify:diffTrees Completed in 1ms
68 silly reify moves {}
69 timing reify:retireShallow Completed in 1ms
70 timing reify:createSparse Completed in 1ms
71 timing reify:loadBundles Completed in 0ms
72 silly audit bulk request {
72 silly audit   opengpio: [ '1.0.11' ],
72 silly audit   bindings: [ '1.5.0' ],
72 silly audit   debug: [ '4.3.4' ],
72 silly audit   'node-addon-api': [ '7.1.0' ],
72 silly audit   'file-uri-to-path': [ '1.0.0' ],
72 silly audit   ms: [ '2.1.2' ]
72 silly audit }
73 silly tarball no local data for node-addon-api@https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz. Extracting by manifest.
74 silly tarball no local data for opengpio@https://registry.npmjs.org/opengpio/-/opengpio-1.0.11.tgz. Extracting by manifest.
75 timing reifyNode:node_modules/bindings Completed in 36ms
76 timing reifyNode:node_modules/ms Completed in 37ms
77 timing reifyNode:node_modules/debug Completed in 37ms
78 timing reifyNode:node_modules/file-uri-to-path Completed in 38ms
79 http fetch GET 200 https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz 105ms (cache miss)
80 timing reifyNode:node_modules/node-addon-api Completed in 117ms
81 http fetch GET 200 https://registry.npmjs.org/opengpio/-/opengpio-1.0.11.tgz 108ms (cache miss)
82 timing reifyNode:node_modules/opengpio Completed in 121ms
83 timing reify:unpack Completed in 122ms
84 timing reify:unretire Completed in 0ms
85 timing build:queue Completed in 1ms
86 info run opengpio@1.0.11 install node_modules/opengpio node-gyp rebuild
87 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 223ms
88 timing auditReport:getReport Completed in 225ms
89 silly audit report {}
90 timing auditReport:init Completed in 0ms
91 timing reify:audit Completed in 226ms
92 info run opengpio@1.0.11 install { code: 1, signal: null }
93 timing reify:rollback:createSparse Completed in 9ms
94 timing reify:rollback:retireShallow Completed in 0ms
95 timing command:install Completed in 3495ms
96 verbose stack Error: command failed
96 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
96 verbose stack     at ChildProcess.emit (node:events:514:28)
96 verbose stack     at maybeClose (node:internal/child_process:1105:16)
96 verbose stack     at Socket.<anonymous> (node:internal/child_process:457:11)
96 verbose stack     at Socket.emit (node:events:514:28)
96 verbose stack     at Pipe.<anonymous> (node:net:337:12)
97 verbose pkgid opengpio@1.0.11
98 verbose cwd /home/philipp/MagicMirror/modules/MMM-GPIO-Notifications
99 verbose Linux 6.6.22-v8-16k+
100 verbose node v20.8.0
101 verbose npm  v10.1.0
102 error code 1
103 error path /home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/node_modules/opengpio
104 error command failed
105 error command sh -c node-gyp rebuild
106 error make: Entering directory '/home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/node_modules/opengpio/build'
106 error   CXX(target) Release/obj.target/opengpio/cpp/opengpio.o
106 error make: Leaving directory '/home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/node_modules/opengpio/build'
107 error gyp info it worked if it ends with ok
107 error gyp info using node-gyp@9.4.1
107 error gyp info using node@20.8.0 | linux | arm64
107 error gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"
107 error gyp info spawn /usr/bin/python3
107 error gyp info spawn args [
107 error gyp info spawn args   '/home/philipp/MagicMirror/node_modules/node-gyp/gyp/gyp_main.py',
107 error gyp info spawn args   'binding.gyp',
107 error gyp info spawn args   '-f',
107 error gyp info spawn args   'make',
107 error gyp info spawn args   '-I',
107 error gyp info spawn args   '/home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/node_modules/opengpio/build/config.gypi',
107 error gyp info spawn args   '-I',
107 error gyp info spawn args   '/home/philipp/MagicMirror/node_modules/node-gyp/addon.gypi',
107 error gyp info spawn args   '-I',
107 error gyp info spawn args   '/home/philipp/.cache/node-gyp/20.8.0/include/node/common.gypi',
107 error gyp info spawn args   '-Dlibrary=shared_library',
107 error gyp info spawn args   '-Dvisibility=default',
107 error gyp info spawn args   '-Dnode_root_dir=/home/philipp/.cache/node-gyp/20.8.0',
107 error gyp info spawn args   '-Dnode_gyp_dir=/home/philipp/MagicMirror/node_modules/node-gyp',
107 error gyp info spawn args   '-Dnode_lib_file=/home/philipp/.cache/node-gyp/20.8.0/<(target_arch)/node.lib',
107 error gyp info spawn args   '-Dmodule_root_dir=/home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/node_modules/opengpio',
107 error gyp info spawn args   '-Dnode_engine=v8',
107 error gyp info spawn args   '--depth=.',
107 error gyp info spawn args   '--no-parallel',
107 error gyp info spawn args   '--generator-output',
107 error gyp info spawn args   'build',
107 error gyp info spawn args   '-Goutput_dir=.'
107 error gyp info spawn args ]
107 error gyp info spawn make
107 error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
107 error ../cpp/opengpio.cpp:3:10: fatal error: gpiod.hpp: No such file or directory
107 error     3 | #include <gpiod.hpp>
107 error       |          ^~~~~~~~~~~
107 error compilation terminated.
107 error make: *** [opengpio.target.mk:111: Release/obj.target/opengpio/cpp/opengpio.o] Error 1
107 error gyp ERR! build error 
107 error gyp ERR! stack Error: `make` failed with exit code: 2
107 error gyp ERR! stack     at ChildProcess.onExit (/home/philipp/MagicMirror/node_modules/node-gyp/lib/build.js:203:23)
107 error gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
107 error gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
107 error gyp ERR! System Linux 6.6.22-v8-16k+
107 error gyp ERR! command "/usr/local/bin/node" "/home/philipp/MagicMirror/node_modules/.bin/node-gyp" "rebuild"
107 error gyp ERR! cwd /home/philipp/MagicMirror/modules/MMM-GPIO-Notifications/node_modules/opengpio
107 error gyp ERR! node -v v20.8.0
107 error gyp ERR! node-gyp -v v9.4.1
107 error gyp ERR! not ok
108 verbose exit 1
109 timing npm Completed in 3872ms
110 verbose unfinished npm timer reify 1711134456287
111 verbose unfinished npm timer reify:build 1711134458033
112 verbose unfinished npm timer build 1711134458033
113 verbose unfinished npm timer build:deps 1711134458034
114 verbose unfinished npm timer build:run:install 1711134458035
115 verbose unfinished npm timer build:run:install:node_modules/opengpio 1711134458035
116 verbose code 1
117 error A complete log of this run can be found in: /home/philipp/.npm/_logs/2024-03-22T19_07_35_911Z-debug-0.log
Tom-Hirschberger commented 8 months ago

Looks like the libdpiod-dev package had not been installed.

Can you please got to the module directory, run the preinstall script manually and provide the output.

Additionally the output of

sudo apt list --installed ¦ grep gpio

would be great.

Aergernis commented 8 months ago

./preinstall

Check for package libgpiod-dev and install if needed...missing
Installing missing package libgpiod-dev...
OK:1 http://archive.raspberrypi.com/debian bookworm InRelease
OK:2 http://deb.debian.org/debian bookworm InRelease
OK:3 http://deb.debian.org/debian-security bookworm-security InRelease
OK:4 http://deb.debian.org/debian bookworm-updates InRelease
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
Alle Pakete sind aktuell.
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
Vorgeschlagene Pakete:
  libgpiod-doc
Die folgenden NEUEN Pakete werden installiert:
  libgpiod-dev
0 aktualisiert, 1 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Es müssen 58,4 kB an Archiven heruntergeladen werden.
Nach dieser Operation werden 352 kB Plattenplatz zusätzlich benutzt.
Holen:1 http://deb.debian.org/debian bookworm/main arm64 libgpiod-dev arm64 1.6.3-1+b3 [58,4 kB]
Es wurden 58,4 kB in 0 s geholt (632 kB/s).
Vormals nicht ausgewähltes Paket libgpiod-dev:arm64 wird gewählt.
(Lese Datenbank ... 252307 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von .../libgpiod-dev_1.6.3-1+b3_arm64.deb ...
Entpacken von libgpiod-dev:arm64 (1.6.3-1+b3) ...
libgpiod-dev:arm64 (1.6.3-1+b3) wird eingerichtet ...
done
Check for package gpiod and install if needed...Skipping. Already installed.
Calling converter script to gather info about the gpio chips, lines and names...
Will write results to: gpioinfo.json
Gathering infos with gpioinfo
Processing the output of gpioinfo
Writing result file
Got the info we need and got it converted.

sudo apt list --installed | grep gpio

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

gpiod/stable,now 1.6.3-1+b3 arm64  [installiert]
libgpiod-dev/stable,now 1.6.3-1+b3 arm64  [installiert]
libgpiod2/stable,now 1.6.3-1+b3 arm64  [Installiert,automatisch]
liblgpio1/stable,now 0.2.2-1~rpt1 arm64  [Installiert,automatisch]
libpigpio-dev/stable,now 1.79-1+rpt1 arm64  [Installiert,automatisch]
libpigpio1/stable,now 1.79-1+rpt1 arm64  [Installiert,automatisch]
libpigpiod-if-dev/stable,now 1.79-1+rpt1 arm64  [Installiert,automatisch]
libpigpiod-if1/stable,now 1.79-1+rpt1 arm64  [Installiert,automatisch]
libpigpiod-if2-1/stable,now 1.79-1+rpt1 arm64  [Installiert,automatisch]
pigpio-tools/stable,now 1.79-1+rpt1 arm64  [Installiert,automatisch]
pigpio/stable,now 1.79-1+rpt1 arm64  [installiert]
pigpiod/stable,now 1.79-1+rpt1 arm64  [Installiert,automatisch]
python3-gpiozero/stable,stable,now 2.0-1 all  [installiert]
python3-lgpio/stable,now 0.2.2-1~rpt1 arm64  [Installiert,automatisch]
python3-libgpiod/stable,now 1.6.3-1+b3 arm64  [installiert]
python3-pigpio/stable,stable,now 1.79-1+rpt1 all  [installiert]
python3-rpi.gpio/stable,now 0.7.1~a4-1+b4 arm64  [installiert]
raspi-gpio/stable,now 0.20231127 arm64  [installiert]
rpi.gpio-common/stable,now 0.7.1~a4-1+b4 arm64  [Installiert,automatisch]
Tom-Hirschberger commented 8 months ago

I am pretty sure if you run npm install it will work now. Do not know why the preinstall script is not getting called.

Added a hint to the readme a few seconds ago.

22.03.2024 20:59:10 Aergernis @.***>:

./preinstall

*Check for package libgpiod-dev and install if needed...missing Installing missing package libgpiod-dev... OK:1 http://archive.raspberrypi.com/debian bookworm InRelease OK:2 http://deb.debian.org/debian bookworm InRelease OK:3 http://deb.debian.org/debian-security bookworm-security InRelease OK:4 http://deb.debian.org/debian bookworm-updates InRelease Paketlisten werden gelesen… Fertig Abhängigkeitsbaum wird aufgebaut… Fertig Statusinformationen werden eingelesen… Fertig Alle Pakete sind aktuell. Paketlisten werden gelesen… Fertig Abhängigkeitsbaum wird aufgebaut… Fertig Statusinformationen werden eingelesen… Fertig Vorgeschlagene Pakete: libgpiod-doc Die folgenden NEUEN Pakete werden installiert: libgpiod-dev 0 aktualisiert, 1 neu installiert, 0 zu entfernen und 0 nicht aktualisiert. Es müssen 58,4 kB an Archiven heruntergeladen werden. Nach dieser Operation werden 352 kB Plattenplatz zusätzlich benutzt. Holen:1 http://deb.debian.org/debian bookworm/main arm64 libgpiod-dev arm64 1.6.3-1+b3 [58,4 kB] Es wurden 58,4 kB in 0 s geholt (632 kB/s). Vormals nicht ausgewähltes Paket libgpiod-dev:arm64 wird gewählt. (Lese Datenbank ... 252307 Dateien und Verzeichnisse sind derzeit installiert.) Vorbereitung zum Entpacken von .../libgpiod-dev_1.6.3-1+b3_arm64.deb ... Entpacken von libgpiod-dev:arm64 (1.6.3-1+b3) ... libgpiod-dev:arm64 (1.6.3-1+b3) wird eingerichtet ... done Check for package gpiod and install if needed...Skipping. Already installed. Calling converter script to gather info about the gpio chips, lines and names... Will write results to: gpioinfo.json Gathering infos with gpioinfo Processing the output of gpioinfo Writing result file Got the info we need and got it converted.

sudo apt list --installed | grep gpio*

*WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

gpiod/stable,now 1.6.3-1+b3 arm64 [installiert] libgpiod-dev/stable,now 1.6.3-1+b3 arm64 [installiert] libgpiod2/stable,now 1.6.3-1+b3 arm64 [Installiert,automatisch] liblgpio1/stable,now 0.2.2-1~rpt1 arm64 [Installiert,automatisch] libpigpio-dev/stable,now 1.79-1+rpt1 arm64 [Installiert,automatisch] libpigpio1/stable,now 1.79-1+rpt1 arm64 [Installiert,automatisch] libpigpiod-if-dev/stable,now 1.79-1+rpt1 arm64 [Installiert,automatisch] libpigpiod-if1/stable,now 1.79-1+rpt1 arm64 [Installiert,automatisch] libpigpiod-if2-1/stable,now 1.79-1+rpt1 arm64 [Installiert,automatisch] pigpio-tools/stable,now 1.79-1+rpt1 arm64 [Installiert,automatisch] pigpio/stable,now 1.79-1+rpt1 arm64 [installiert] pigpiod/stable,now 1.79-1+rpt1 arm64 [Installiert,automatisch] python3-gpiozero/stable,stable,now 2.0-1 all [installiert] python3-lgpio/stable,now 0.2.2-1~rpt1 arm64 [Installiert,automatisch] python3-libgpiod/stable,now 1.6.3-1+b3 arm64 [installiert] python3-pigpio/stable,stable,now 1.79-1+rpt1 all [installiert] python3-rpi.gpio/stable,now 0.7.1~a4-1+b4 arm64 [installiert] raspi-gpio/stable,now 0.20231127 arm64 [installiert] rpi.gpio-common/stable,now 0.7.1~a4-1+b4 arm64 [Installiert,automatisch]

* — Reply to this email directly, view it on GitHub[https://github.com/Tom-Hirschberger/MMM-GPIO-Notifications/issues/20#issuecomment-2015813972], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ALMFULAKA2YBBQWT55VXQITYZSEQZAVCNFSM6AAAAABEWJA3BGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJVHAYTGOJXGI]. You are receiving this because you commented. [Verfolgungsbild][https://github.com/notifications/beacon/ALMFULDZ26SQJNSJNSI52OTYZSEQZA5CNFSM6AAAAABEWJA3BGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTYE3QVI.gif]

Aergernis commented 8 months ago

i think ./preinstall is called to late in install process. It is called after trying to create gpioinfo.json

Schwerwiegend: Zielpfad 'MMM-GPIO-Notifications' existiert bereits und ist kein leeres Verzeichnis.
Check for package libgpiod-dev and install if needed...Skipping. Already installed.
Check for package gpiod and install if needed...Skipping. Already installed.
Calling converter script to gather info about the gpio chips, lines and names...
Will write results to: gpioinfo.json
Gathering infos with gpioinfo
Processing the output of gpioinfo
Writing result file
Got the info we need and got it converted.

> MMM-GPIO-Notifications@0.2.0 preinstall
> ./preinstall

Check for package libgpiod-dev and install if needed...Skipping. Already installed.
Check for package gpiod and install if needed...Skipping. Already installed.
Calling converter script to gather info about the gpio chips, lines and names...
Will write results to: gpioinfo.json
Gathering infos with gpioinfo
Processing the output of gpioinfo
Writing result file
Got the info we need and got it converted.

added 6 packages, and audited 7 packages in 8s

found 0 vulnerabilities
Aergernis commented 8 months ago

Maybe this will help https://github.com/npm/cli/issues/2660

Tom-Hirschberger commented 8 months ago

As the converter script which creates the gpioinfo.json is called by the preinstall script Ido not think it is called to late.

It looks more like it does not get called the first time npm install is called and libgpiod-dev is missing.

22.03.2024 21:15:08 Aergernis @.***>:

i think ./preinstall is called to late in install process. It is called after trying to create gpioinfo.json

*Schwerwiegend: Zielpfad 'MMM-GPIO-Notifications' existiert bereits und ist kein leeres Verzeichnis. Check for package libgpiod-dev and install if needed...Skipping. Already installed. Check for package gpiod and install if needed...Skipping. Already installed. Calling converter script to gather info about the gpio chips, lines and names... Will write results to: gpioinfo.json Gathering infos with gpioinfo Processing the output of gpioinfo Writing result file Got the info we need and got it converted.

@.*** preinstall ./preinstall

Check for package libgpiod-dev and install if needed...Skipping. Already installed. Check for package gpiod and install if needed...Skipping. Already installed. Calling converter script to gather info about the gpio chips, lines and names... Will write results to: gpioinfo.json Gathering infos with gpioinfo Processing the output of gpioinfo Writing result file Got the info we need and got it converted.

added 6 packages, and audited 7 packages in 8s

found 0 vulnerabilities

* — Reply to this email directly, view it on GitHub[https://github.com/Tom-Hirschberger/MMM-GPIO-Notifications/issues/20#issuecomment-2015837535], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ALMFULDKOUQ44E7YD7OD33DYZSGMVAVCNFSM6AAAAABEWJA3BGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJVHAZTONJTGU]. You are receiving this because you commented. [Verfolgungsbild][https://github.com/notifications/beacon/ALMFULGMSORUX24NG65CRBTYZSGMVA5CNFSM6AAAAABEWJA3BGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTYE46V6.gif]

Tom-Hirschberger commented 8 months ago

Maybe this will help https://github.com/npm/cli/issues/2660

You are right. Looks like exactly the same problem.

Aergernis commented 8 months ago

it's installoing fine, but to get pin 4 as input pulled down i still had to set it in config.txt

gpioinfo without config.txt

gpiochip4 - 54 lines:
        line   0:     "ID_SDA"       unused   input  active-high
        line   1:     "ID_SCL"       unused   input  active-high
        line   2:      "GPIO2"       unused   input  active-high
        line   3:      "GPIO3"       unused   input  active-high
        line   4:      "GPIO4" "opengpio_4_4_watch" input active-high [used]
        line   5:      "GPIO5"       unused   input  active-high
        line   6:      "GPIO6"       unused   input  active-high
        line   7:      "GPIO7"       unused   input  active-high

with config.txt

gpiochip4 - 54 lines:
        line   0:     "ID_SDA"       unused   input  active-high
        line   1:     "ID_SCL"       unused   input  active-high
        line   2:      "GPIO2"       unused   input  active-high
        line   3:      "GPIO3"       unused   input  active-high
        line   4:      "GPIO4" "opengpio_4_4_watch" input active-high [used]
        line   5:      "GPIO5"       unused   input  active-high
        line   6:      "GPIO6"       unused   input  active-high
        line   7:      "GPIO7"       unused   input  active-high

it's both showing the same for the pin, but it's not wirking without the edit

Tom-Hirschberger commented 8 months ago

I opened a feature request at the libraries repo to support pull-up and pull-down but it may take a moment to be implemented.

Can you do me a favour and post a complete output of your gpioinfo so I can add Raspberry 5 as a devide to the opengpio library?

If it is OK for you I will close the issue as long as the library does not support pull the pins to a state.

Aergernis commented 8 months ago

GPIO 4,17,18,22,23,24 and 27 are used by MMM and set by config.txt. Normaly they are also unused input active-high (If i remember correctly, this applys to Kernerl 6.6, a older Kernel i had for testing had different gpiochip numbers)

gpiochip0 - 32 lines:
        line   0:          "-"       unused   input  active-high
        line   1: "2712_BOOT_CS_N" "spi10 CS0" output active-low [used]
        line   2: "2712_BOOT_MISO" unused input active-high
        line   3: "2712_BOOT_MOSI" unused input active-high
        line   4: "2712_BOOT_SCLK" unused input active-high
        line   5:          "-"       unused   input  active-high
        line   6:          "-"       unused   input  active-high
        line   7:          "-"       unused   input  active-high
        line   8:          "-"       unused   input  active-high
        line   9:          "-"       unused   input  active-high
        line  10:          "-"       unused   input  active-high
        line  11:          "-"       unused   input  active-high
        line  12:          "-"       unused   input  active-high
        line  13:          "-"       unused   input  active-high
        line  14:   "PCIE_SDA"       unused   input  active-high
        line  15:   "PCIE_SCL"       unused   input  active-high
        line  16:          "-"       unused   input  active-high
        line  17:          "-"       unused   input  active-high
        line  18:          "-"       unused   input  active-high
        line  19:          "-"       unused   input  active-high
        line  20:   "PWR_GPIO" "pwr_button"   input   active-low [used]
        line  21: "2712_G21_FS" unused input active-high
        line  22:          "-"       unused   input  active-high
        line  23:          "-"       unused   input  active-high
        line  24:     "BT_RTS"       unused   input  active-high
        line  25:     "BT_CTS"       unused   input  active-high
        line  26:     "BT_TXD"       unused   input  active-high
        line  27:     "BT_RXD"       unused   input  active-high
        line  28:      "WL_ON"  "wl_on_reg"  output  active-high [used]
        line  29:      "BT_ON"   "shutdown"  output  active-high [used]
        line  30: "WIFI_SDIO_CLK" unused input active-high
        line  31: "WIFI_SDIO_CMD" unused input active-high
gpiochip1 - 4 lines:
        line   0: "WIFI_SDIO_D0" unused input active-high
        line   1: "WIFI_SDIO_D1" unused input active-high
        line   2: "WIFI_SDIO_D2" unused input active-high
        line   3: "WIFI_SDIO_D3" unused input active-high
gpiochip2 - 17 lines:
        line   0:    "RP1_SDA"       unused   input  active-high
        line   1:    "RP1_SCL"       unused   input  active-high
        line   2:    "RP1_RUN" "RP1 RUN pin" output active-high [used]
        line   3: "SD_IOVDD_SEL" "vdd-sd-io" output active-high [used]
        line   4:  "SD_PWR_ON" "sd_vcc_reg"  output  active-high [used]
        line   5:  "SD_CDET_N"         "cd"   input   active-low [used]
        line   6:   "SD_FLG_N"       unused   input  active-high
        line   7:          "-"       unused   input  active-high
        line   8:  "2712_WAKE"       unused   input  active-high
        line   9: "2712_STAT_LED" "ACT" output active-low [used]
        line  10:          "-"       unused   input  active-high
        line  11:          "-"       unused   input  active-high
        line  12:   "PMIC_INT"       unused   input  active-high
        line  13: "UART_TX_FS"       unused   input  active-high
        line  14: "UART_RX_FS"       unused   input  active-high
        line  15:          "-"       unused   input  active-high
        line  16:          "-"       unused   input  active-high
gpiochip3 - 6 lines:
        line   0:  "HDMI0_SCL"       unused   input  active-high
        line   1:  "HDMI0_SDA"       unused   input  active-high
        line   2:  "HDMI1_SCL"       unused   input  active-high
        line   3:  "HDMI1_SDA"       unused   input  active-high
        line   4:   "PMIC_SCL"       unused   input  active-high
        line   5:   "PMIC_SDA"       unused   input  active-high
gpiochip4 - 54 lines:
        line   0:     "ID_SDA"       unused   input  active-high
        line   1:     "ID_SCL"       unused   input  active-high
        line   2:      "GPIO2"       unused   input  active-high
        line   3:      "GPIO3"       unused   input  active-high
        line   4:      "GPIO4" "opengpio_4_4_watch" input active-high [used]
        line   5:      "GPIO5"       unused   input  active-high
        line   6:      "GPIO6"       unused   input  active-high
        line   7:      "GPIO7"       unused   input  active-high
        line   8:      "GPIO8"       unused   input  active-high
        line   9:      "GPIO9"       unused   input  active-high
        line  10:     "GPIO10"       unused   input  active-high
        line  11:     "GPIO11"       unused   input  active-high
        line  12:     "GPIO12"       unused   input  active-high
        line  13:     "GPIO13"       unused   input  active-high
        line  14:     "GPIO14"       unused   input  active-high
        line  15:     "GPIO15"       unused   input  active-high
        line  16:     "GPIO16"       unused   input  active-high
        line  17:     "GPIO17"       unused  output  active-high
        line  18:     "GPIO18" "opengpio_4_18_watch" input active-high [used]
        line  19:     "GPIO19"       unused   input  active-high
        line  20:     "GPIO20"       unused   input  active-high
        line  21:     "GPIO21"       unused   input  active-high
        line  22:     "GPIO22"       unused  output  active-high
        line  23:     "GPIO23"       unused  output  active-high
        line  24:     "GPIO24"       unused  output  active-high
        line  25:     "GPIO25"       unused   input  active-high
        line  26:     "GPIO26"       unused   input  active-high
        line  27:     "GPIO27" "opengpio_4_27_watch" input active-high [used]
        line  28: "PCIE_RP1_WAKE" unused input active-high
        line  29:   "FAN_TACH"       unused   input  active-high
        line  30:   "HOST_SDA"       unused   input  active-high
        line  31:   "HOST_SCL"       unused   input  active-high
        line  32:  "ETH_RST_N"  "phy-reset"  output   active-low [used]
        line  33:          "-"       unused   input  active-high
        line  34: "CD0_IO0_MICCLK" "cam0_reg" output active-high [used]
        line  35: "CD0_IO0_MICDAT0" unused input active-high
        line  36: "RP1_PCIE_CLKREQ_N" unused input active-high
        line  37:          "-"       unused   input  active-high
        line  38:    "CD0_SDA"       unused   input  active-high
        line  39:    "CD0_SCL"       unused   input  active-high
        line  40:    "CD1_SDA"       unused   input  active-high
        line  41:    "CD1_SCL"       unused   input  active-high
        line  42: "USB_VBUS_EN" unused output active-high
        line  43:   "USB_OC_N"       unused   input  active-high
        line  44: "RP1_STAT_LED" "PWR" output active-low [used]
        line  45:    "FAN_PWM"       unused  output  active-high
        line  46: "CD1_IO0_MICCLK" "cam1_reg" output active-high [used]
        line  47:  "2712_WAKE"       unused   input  active-high
        line  48: "CD1_IO1_MICDAT1" unused input active-high
        line  49: "EN_MAX_USB_CUR" unused output active-high
        line  50:          "-"       unused   input  active-high
        line  51:          "-"       unused   input  active-high
        line  52:          "-"       unused   input  active-high
        line  53:          "-"       unused   input  active-high