Created
January 16, 2015 18:50
-
-
Save Krelyx/e0b688dafbb4d0c0ce36 to your computer and use it in GitHub Desktop.
Script de test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Script de test | |
Author Xylerk | |
]]-- | |
-- Définition de fonctions utiles | |
function sendOn(target,nid) | |
target = tostring(target) | |
nid = tostring(nid) | |
cmdToSend = string.format("curl -X GET 'http://localhost:8888/node/on?target=%s&sender=1&nid=%s'",target,nid) | |
os.execute(cmdToSend) | |
end | |
function sendOff(target,nid) | |
target = tostring(target) | |
nid = tostring(nid) | |
cmdToSend = string.format("curl -X GET 'http://localhost:8888/node/off?target=%s&sender=1&nid=%s'",target,nid) | |
os.execute(cmdToSend) | |
end | |
function sendLink(target) | |
target = tostring(target) | |
cmdToSend = string.format("curl -X GET 'http://localhost:8888/node/link?target=%s&sender=1'",target) | |
os.execute(cmdToSend) | |
end | |
function sendReset(target) | |
target = tostring(target) | |
cmdToSend = string.format("curl -X GET 'http://localhost:8888/node/reset?target=%s&sender=1'",target) | |
os.execute(cmdToSend) | |
end | |
function sendAskData(target) | |
target = tostring(target) | |
cmdToSend = string.format("curl -X GET 'http://localhost:8888/node/askdata?target=%s&sender=1'",target) | |
os.execute(cmdToSend) | |
end | |
-- Fonction d'initialisation du script | |
function init() | |
print(" _______________________________") | |
print("| Script de test des plugin Lua |") | |
print("|______________Xylerk___________|") | |
-- Fin de la fonction init() | |
end | |
-- Fonction d'action du script | |
function action() | |
--sendOff(125,12) | |
--sendOn(125,0) | |
--sendOn(125,1) | |
--sendReset(125) | |
sec = tonumber(os.date("%S")) | |
if sec == 0 | |
then | |
sendLink(125) | |
end | |
if sec == 10 | |
then | |
--sendAskData(125) | |
sendOn(125,1) | |
end | |
if sec == 20 | |
then | |
--sendAskData(125) | |
sendOn(125,2) | |
end | |
if sec == 30 | |
then | |
--sendAskData(125) | |
sendOn(125,3) | |
end | |
if sec == 50 | |
then | |
sendOn(125,4) | |
end | |
-- Fin de la fonction action() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment