Trigger a script on device value change

Well, listen, no, it’s the only one and there’s not much to do to install Gladys ^^

For HTTPS, I’ll explain later if you want, but you’ll see it’s simple :slight_smile:

Oh yes, I’ll bother you again later then :stuck_out_tongue:

1 Like

Installation Done Maison to fill in as well as machine :slight_smile:

And I am on 3.7.3 :slight_smile:

I just tried to install your module and it starts again
Installation OK
Reboot OK
Module disappeared

What the heck?! Did you try your module or mine?

I tried with your module :frowning:

Oh that’s weird!
I don’t have any problem on my side! :thinking:

By any chance did you extend the partition? Updated Gladys data? Re-downloaded the image? Tried to install a module before the update?

I successfully extended my partition:

<pi@gladys:~ $ sudo raspi-config

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): Disk /dev/mmcblk0: 14.8 GiB, 15836643328 bytes, 30930944 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8871520d

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 137215 129024 63M c W95 FAT32 (LBA)
/dev/mmcblk0p2 137216 7862271 7725056 3.7G 83 Linux

Command (m for help): Partition number (1,2, default 2):
Partition 2 has been deleted.

Command (m for help): Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (2048-30930943, default 2048): Last
sector, +sectors or +size{K,M,G,T,P} (137216-30930943, default 30930943):
Created a new partition 2 of type ‹ Linux › and of size 14.7 GiB.

Command (m for help): Disk /dev/mmcblk0: 14.8 GiB, 15836643328 bytes, 30930944 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8871520d

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 137215 129024 63M c W95 FAT32 (LBA)
/dev/mmcblk0p2 137216 30930943 30793728 14.7G 83 Linux

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

Broadcast message from pi@gladys on pts/0 (Sun 2017-11-19 17:26:40 UTC):

The system is going down for reboot NOW!

I didn’t update the data and of course I downloaded the image again
I didn’t think to install a module before…

I will reinstall if necessary.

If it doesn’t bother you please…
We need to go back to the source of the problem :slight_smile:

I just installed 3.5.2.

Which test would you like me to run? :slight_smile:

First, try installing a module from the store and if everything goes well, attempt to install my module and closely monitor the logs ^^

J’ai installer MP3 Player sans problème ton module même problème :

0|gladys | Cloning module mp3-player…
0|gladys | Installing NPM dependencies for module mp3-player
[STREAMING] Now streaming realtime logs for [gladys] process
0|gladys | Dependencies installed for module mp3-player
0|gladys | Module mp3-player installed with success. Need reboot.
0|gladys | Sentence : create : Inserting sentence e12c18d2-f76d-40f7-9bc5-823de5948c3d
0|gladys | Sentence : create : Inserting sentence 10e7f1ba-f0a2-4b77-ae11-350156a184e5
0|gladys | Sentence : create : Inserting sentence 641b2f46-8d7e-47da-ab4d-c3eb0b0c114f
0|gladys | Sentence : create : Inserting sentence 81381746-7191-4448-93f3-4fa5465c5bca
0|gladys | Sentence : create : Inserting sentence 052c9e7b-f899-467e-b753-790b8a9db792
0|gladys | Sentence : create : Inserting sentence 4add5adc-235c-4eab-9222-54e6af6751ff
0|gladys | Sentence : create : Inserting sentence f96a6761-f0c4-4887-ba32-8fd9a87932db
0|gladys | Sentence : create : Inserting sentence 62285c2f-c709-4c17-a972-c874d8364543
0|gladys | Sentence : create : Inserting sentence 6a9796ce-c9ca-4e71-9148-1de9c6cc9fa8
0|gladys | Sentence : create : Inserting sentence 31763f45-afe1-4c0f-b7ff-fd7a35c4941e
0|gladys | Sentence : create : Inserting sentence b33ebb57-5a74-4a20-8073-bc767a2f58a4
0|gladys | Sentence : create : Inserting sentence 4a013e25-3cf7-48a6-a680-0403f52ed800
0|gladys | Sentence : create : Inserting sentence 0c498fd6-b005-4312-b907-e13c1f854993
0|gladys | Sentence : create : Inserting sentence 9f5f0d6c-03ae-45f5-a106-ca7e50988b56
0|gladys | Sentence : create : Inserting sentence 35815563-98ea-4ded-a30e-5ce033f56d87
0|gladys | Sentence : create : Inserting sentence 80e148a8-e3a3-466c-a61b-dfe814366521
0|gladys | Sentence : create : Inserting sentence 9e4931b5-0a95-4d3c-9649-e55ea6dff4cc
0|gladys | Sentence : create : Inserting sentence ea3b55ed-51d0-44e0-8a11-cc4665183977
0|gladys | Sentence : create : Inserting sentence 12e1d546-43aa-498e-ade5-1f7aaa0f5c53
0|gladys | Sentence : create : Inserting sentence 51af6ea3-2fdb-471f-888c-3d085416cf53
0|gladys | Sentence : create : Inserting sentence 0cc3511e-5750-4e53-bf8c-93bc9795839e
0|gladys | Sentence : create : Inserting sentence 21a5f31f-584f-4486-80be-bea8d4812f24
0|gladys | Sentence : create : Inserting sentence 9a069ae4-bb6c-4725-bfba-c611f3a8762d
0|gladys | Sentence : create : Inserting sentence 8cd199d6-4b5e-4103-8ccb-be1cb0b6cabe
0|gladys | Sentence : create : Inserting sentence df3e6f0f-70f7-44d5-879a-c2103e1c52db
0|gladys | Sentence : create : Inserting sentence e2e1f3a6-772a-4cda-8965-d3cf8b23ccd1
0|gladys | Sentence : create : Inserting sentence f0602923-fcc0-4164-acdf-1278711a4885
0|gladys | Sentence : create : Inserting sentence 271d62bd-9c95-4e2a-9624-640bb1403567
0|gladys | Sentence : create : Inserting sentence 8ab72a99-af2b-4d68-931b-76d6b367c887
0|gladys | Sentence : create : Inserting sentence 34e2167f-0199-4d0b-88c2-22cde8b3dd36
0|gladys | Sentence : create : Inserting sentence 5039f751-919e-4973-a999-2ca356b611ba
0|gladys | Sentence : create : Inserting sentence 3d459435-1040-4af0-aa01-981e3c392425
0|gladys | Sentence : create : Inserting sentence c2cafa3e-584c-4aca-8b2c-2053f1ee823c
0|gladys | Sentence : create : Inserting sentence e3c05467-4faf-4317-a918-b551f0a7b245
0|gladys | Sentence : create : Inserting sentence d5f6b00a-95fe-47dd-adff-76e25896c70b
0|gladys | Sentence : create : Inserting sentence 760881ba-11a4-49c8-89ee-629c0c444171
0|gladys | Sentence : create : Inserting sentence 0fbd8ac7-3d98-49ff-8478-cb6da9ba73ec
0|gladys | Sentence : create : Inserting sentence 3dfca7b5-f040-4161-af99-777b99db4af4
0|gladys | Sentence : create : Inserting sentence 85078dc7-a7fa-4da3-870c-8410b80e3ca5
0|gladys | Sentence : create : Inserting sentence 186c30a2-0c2d-4db6-bb6e-a08dfafc301b
0|gladys | Sentence : create : Inserting sentence d8a386b5-d6ef-40db-bf94-754f0c01de2e
0|gladys | Sentence : create : Inserting sentence d1b0eacf-3c84-45a1-8a03-f84dc5f63788
0|gladys | Sentence : create : Inserting sentence c5d8964d-8cb0-4942-9df2-b02331a2fa71
0|gladys | Sentence : create : Inserting sentence 9bab1bdc-b612-47f5-8023-8469f21b5286
0|gladys | Sentence : create : Inserting sentence 7bd8d661-7580-43ef-b6a5-2d63ad9aea0b
0|gladys | Sentence : create : Inserting sentence eac81b09-be43-41b5-b6a4-1986ae08e075
0|gladys | Sentence : create : Inserting sentence 376976f9-ecf9-4ee0-8f21-8a93023f4df3
0|gladys | Sentence : create : Inserting sentence 5d6a0f1b-749b-4526-aeb0-28cd279f6b05
0|gladys | Sentence : create : Inserting sentence 6d16fd39-5141-48be-a8d6-1352c0b69ffd
0|gladys | Sentence : create : Inserting sentence 32b44e82-eb4e-43df-82ca-518f71f871db
0|gladys | Sentence : create : Inserting sentence cf0370a7-db21-4809-91ba-e67f4c8e6d6f
0|gladys | Sentence : create : Inserting sentence 74119a26-ca93-4ad3-88cc-2f1033f90f80
0|gladys | Sentence : create : Inserting sentence d4026227-d07e-4e9e-91dd-fe1429ee5b4c
0|gladys | Sentence : create : Inserting sentence d768824d-73fc-407d-88f1-af21e4540b3a
0|gladys | Sentence : create : Inserting sentence 1edfe023-d3ed-440b-a7e3-08fcffb53307
0|gladys | Sentence : create : Inserting sentence a79089cf-af78-420a-93eb-561aac079820
0|gladys | Brain trained with success ! Added 56 sentences.
0|gladys | Brain file saved with success
0|gladys | New version of Gladys available : 3.7.3
0|gladys | Warning: connect.session() MemoryStore is not
0|gladys | designed for a production environment, as it will leak
0|gladys | memory, and will not scale past a single process.
0|gladys | Warning: connect.session() MemoryStore is not
0|gladys | designed for a production environment, as it will leak
0|gladys | memory, and will not scale past a single process.
0|gladys | =======================================
0|gladys | WARNING: You currently have your default CORS settings configured to allow
0|gladys | all requests from all origins, with credentials. This may leave your app
0|gladys | open to attack by third-party sites! Consider making your origins setting
0|gladys | more restrictive or setting credentials to false, or else make certain that
0|gladys | none of your routes perform sensitive actions or reveal secure information.
0|gladys | =======================================
0|gladys | Gladys version : 3.5.2
0|gladys | Gladys brain loaded with success !
0|gladys | .-…-.
0|gladys | Sails <| .-…-.
0|gladys | v0.12.11 |
0|gladys | /|.
0|gladys | / ||
0|gladys | ,’ |’
0|gladys | .-'.-==|/–’
0|gladys | --'-------' 0|gladys | __---___--___---___--___---___--___ 0|gladys | ____---___--___---___--___---___--___-__ 0|gladys | Server lifted in /home/pi/gladys0|gladys | To see your app, visit http://localhost:8080 0|gladys | To shut down Sails, press <CTRL> + C at any time. 0|gladys | ------------------------------------------------------- 0|gladys | :: Sun Nov 19 2017 19:55:54 GMT+0000 (UTC) 0|gladys | Environment : production 0|gladys | Port : 8080 0|gladys | ------------------------------------------------------- 0|gladys | Unhandled rejection Error: Param not found 0|gladys | at /home/pi/gladys/api/core/param/param.getValue.js:16:36 0|gladys | at tryCatcher (/home/pi/gladys/node_modules/bluebird/js/release/util.js:16:23) 0|gladys | at Promise._settlePromiseFromHandler (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:510:31) 0|gladys | at Promise._settlePromise (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:567:18) 0|gladys | at Promise._settlePromise0 (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:612:10) 0|gladys | at Promise._settlePromises (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:691:18) 0|gladys | at Promise._fulfill (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:636:18) 0|gladys | at /home/pi/gladys/node_modules/bluebird/js/release/nodeback.js:42:21 0|gladys | at /home/pi/gladys/node_modules/sails-mysql/lib/connections/spawn.js:120:16 0|gladys | at Object.poolfully [as releaseConnection] (/home/pi/gladys/node_modules/sails-mysql/lib/connections/release.js:28:12) 0|gladys | at Query._callback (/home/pi/gladys/node_modules/sails-mysql/lib/connections/spawn.js:105:35) 0|gladys | at Query.Sequence.end (/home/pi/gladys/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24) 0|gladys | at Query._handleFinalResultPacket (/home/pi/gladys/node_modules/mysql/lib/protocol/sequences/Query.js:144:8) 0|gladys | at Query.EofPacket (/home/pi/gladys/node_modules/mysql/lib/protocol/sequences/Query.js:128:8) 0|gladys | at Protocol._parsePacket (/home/pi/gladys/node_modules/mysql/lib/protocol/Protocol.js:280:23) 0|gladys | at Parser.write (/home/pi/gladys/node_modules/mysql/lib/protocol/Parser.js:73:12) 0|gladys | at Protocol.write (/home/pi/gladys/node_modules/mysql/lib/protocol/Protocol.js:39:16) 0|gladys | at Socket.<anonymous> (/home/pi/gladys/node_modules/mysql/lib/Connection.js:96:28) 0|gladys | at emitOne (events.js:96:13) 0|gladys | at Socket.emit (events.js:188:7) 0|gladys | at readableAddChunk (_stream_readable.js:176:18) 0|gladys | at Socket.Readable.push (_stream_readable.js:134:10) 0|gladys | New version of Gladys available : 3.7.3 0|gladys | Socket disconnected, but session could not be loaded to pass to configured disconnect handler:sails.config.sockets.afterDisconnect(). Will pass a fake, empty session as argument to lifecycle callback. Details: 0|gladys | Error: Session could not be loaded 0|gladys | at _createError (/home/pi/gladys/node_modules/sails/lib/hooks/session/index.js:31:19) 0|gladys | at Immediate.<anonymous> (/home/pi/gladys/node_modules/sails/lib/hooks/session/index.js:34:11) 0|gladys | at runCallback (timers.js:676:20) 0|gladys | at tryOnImmediate (timers.js:645:5) 0|gladys | at processImmediate [as _immediateCallback] (timers.js:617:5) 0|gladys | New User connected : Vincent 0|gladys | Cloning module DeviceHTTP... 0|gladys | Installing NPM dependencies for module DeviceHTTP 0|gladys | Dependencies installed for module DeviceHTTP 0|gladys | Module DeviceHTTP installed with success. Need reboot. 0|gladys | Warning: connect.session() MemoryStore is not 0|gladys | designed for a production environment, as it will leak 0|gladys | memory, and will not scale past a single process. 0|gladys | Warning: connect.session() MemoryStore is not 0|gladys | designed for a production environment, as it will leak 0|gladys | memory, and will not scale past a single process. 0|gladys | =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= 0|gladys | WARNING: You currently have your default CORS settings configured to allow 0|gladys | all requests from all origins, with credentials. This may leave your app 0|gladys | open to attack by third-party sites! Consider making your originssetting 0|gladys | more restrictive or settingcredentialsto false, or else make certain that 0|gladys | none of your routes perform sensitive actions or reveal secure information. 0|gladys | =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= 0|gladys | Gladys version : 3.5.2 0|gladys | Gladys brain loaded with success ! 0|gladys | .-..-. 0|gladys | Sails <| .-..-. 0|gladys | v0.12.11 |\ 0|gladys | /|.\ 0|gladys | / || \ 0|gladys | ,' |' \ 0|gladys | .-'.-==|/_--' 0|gladys | –‹ ------- ›
0|gladys |
–___
0|gladys | -
0|gladys | Server lifted in /home/pi/gladys
0|gladys | To see your app, visit http://localhost:8080
0|gladys | To shut down Sails, press + C at any time.
0|gladys | -------------------------------------------------------
0|gladys | :: Sun Nov 19 2017 19:58:40 GMT+0000 (UTC)
0|gladys | Environment : production
0|gladys | Port : 8080
0|gladys | -------------------------------------------------------
0|gladys | Unhandled rejection Error: Param not found
0|gladys | at /home/pi/gladys/api/core/param/param.getValue.js:16:36
0|gladys | at tryCatcher (/home/pi/gladys/node_modules/bluebird/js/release/util.js:16:23)
0|gladys | at Promise._settlePromiseFromHandler (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:510:31)
0|gladys | at Promise._settlePromise (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:567:18)
0|gladys | at Promise._settlePromise0 (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:612:10)
0|gladys | at Promise._settlePromises (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:691:18)
0|gladys | at Promise._fulfill (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:636:18)
0|gladys | at /home/pi/gladys/node_modules/bluebird/js/release/nodeback.js:42:21
0|gladys | at /home/pi/gladys/node_modules/sails-mysql/lib/connections/spawn.js:120:16
0|gladys | at Object.poolfully [as releaseConnection] (/home/pi/gladys/node_modules/sails-mysql/lib/connections/release.js:28:12)
0|gladys | at Query._callback (/home/pi/gladys/node_modules/sails-mysql/lib/connections/spawn.js:105:35)
0|gladys | at Query.Sequence.end (/home/pi/gladys/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
0|gladys | at Query._handleFinalResultPacket (/home/pi/gladys/node_modules/mysql/lib/protocol/sequences/Query.js:144:8)
0|gladys | at Query.EofPacket (/home/pi/gladys/node_modules/mysql/lib/protocol/sequences/Query.js:128:8)
0|gladys | at Protocol._parsePacket (/home/pi/gladys/node_modules/mysql/lib/protocol/Protocol.js:280:23)
0|gladys | at Parser.write (/home/pi/gladys/node_modules/mysql/lib/protocol/Parser.js:73:12)
0|gladys | at Protocol.write (/home/pi/gladys/node_modules/mysql/lib/protocol/Protocol.js:39:16)
0|gladys | at Socket. (/home/pi/gladys/node_modules/mysql/lib/Connection.js:96:28)
0|gladys | at emitOne (events.js:96:13)
0|gladys | at Socket.emit (events.js:188:7)
0|gladys | at readableAddChunk (_stream_readable.js:176:18)
0|gladys | at Socket.Readable.push (_stream_readable.js:134:10)
0|gladys | New version of Gladys available : 3.7.3
0|gladys | Socket disconnected, but session could not be loaded to pass to configured disconnect handler: sails.config.sockets.afterDisconnect(). Will pass a fake, empty session as argument to lifecycle callback. Details:
0|gladys | Error: Session could not be loaded
0|gladys | at _createError (/home/pi/gladys/node_modules/sails/lib/hooks/session/index.js:31:19)
0|gladys | at Immediate. (/home/pi/gladys/node_modules/sails/lib/hooks/session/index.js:34:11)
0|gladys | at runCallback (timers.js:676:20)
0|gladys | at tryOnImmediate (timers.js:645:5)
0|gladys | at processImmediate [as _immediateCallback] (timers.js:617:5)
0|gladys | New User connected : Vincent

Info: I just tried again and before restarting I updated the Gladys data and then after the restart your module was there :smiley:

I was starting to despair ^^
So try the test several times to see!
If it works, try your own module :slight_smile:

I must admit, me too ^^'.
I’ve made a bit of progress, my problem was probably with the slug I gave them.
Until now, I named my module hdmiCec and yours Device-HTTP.
When I tried again an hour ago with yours, I named it test (lazy) and it stayed, I thought it was due to the update given gladys but I encountered the same problem when reinstalling.

So I put cec in the slug of my module and it worked.
I don’t know if it’s because of the capital letter or the compound word in CamelCase.
Anyway, I’ll continue to look tomorrow, but in the meantime, I really thank you @LepetitGeek!

Weird anyway because at my place the slug is named device-http so there is no problem with special characters apparently :thinking:

No problem, keep us updated! :slight_smile:

1 Like

Hi @LepetitGeek, I can confirm that the bug is reproducible on my end when adding a module with an uppercase letter in the slug. Here are my tests:

installation module with Slug and name hdmiCec KO
installation module with Slug hdmiCec and name hdmicec KO
installation module with Slug and name hdmi-cec OK
installation module with Slug hdmi-cec and name hdmi-Cec OK

By the way, if you have a tutorial for HTTPS, I’m interested :slight_smile:

Interesting bug!

I referenced it here →

https://github.com/GladysProject/Gladys/issues/254

I’ll take a look!

It’s totally mystical :thinking:

For HTTPS, you type the command home/pi/enable-ssl-gladys.sh and then you go have a good coffee because it takes about an hour :stuck_out_tongue:

Thanks @pierre-gilles!
Ok I’ll launch it and have my coffee! Thanks again @LepetitGeek :slight_smile:

1 Like