[RÉSOLU] Erreur dans l'execution d'un script


#1

Bonjour,
script éxécuté :

gladys.deviceType.exec({
devicetype: 3,
value: 1
})
.then((result) => console.log(result))
.catch((err) => console.log(err));

le device 3 est une lampe :

erreurs dans les logs :

0|gladys | Error: http does not exist or does not have an exec function
0|gladys | at /home/pi/gladys/api/core/devicetype/deviceType.exec.js:54:39
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:512:31)
0|gladys | at Promise._settlePromise (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:569:18)
0|gladys | at Promise._settlePromise0 (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:614:10)
0|gladys | at Promise._settlePromises (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:693:18)
0|gladys | at Promise._fulfill (/home/pi/gladys/node_modules/bluebird/js/release/promise.js:638: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:116:13)
0|gladys | at Socket.emit (events.js:211:7)
0|gladys | at addChunk (_stream_readable.js:263:12)
0|gladys | at readableAddChunk (_stream_readable.js:250:11)
0|gladys | at Socket.Readable.push (_stream_readable.js:208:10)
0|gladys | at TCP.onread (net.js:594:20)

qqun a une idée s’il vous plaît?
parcequ’a l’éxécution, la lampe ne s’allume pas…


#2

Salut, @clopance
Il faut l’id du devicetype, pas celui du device.


#3

en effet le script marche mieux comme ça
merci