Je débute dans le code lua et m'inspire de code déjà present sur le net pour essayer de faire le mien
Je cherche a envoyer une commande curl (qui me permet de transferer le son de mon pc vers la freebox server) et a changer une variable utilisateur en fonction de l'activation de kodi (Kodi passe de On a Audio)
J'ai commencé un bout de code mais je ne sais pas débugguer. Le voici
kodi_bar_play est ma variable
Kodi Bar est mon device
Code : Tout sélectionner
commandArray = {}
kodi_bar_play = uservariables['kodi_bar_play']
if(otherdevices['kodi Bar'] == 'Audio' and kodi_bar_play == 0 ) then
runcommand = curl -X PUT -H "Content-Type: application/json" -H "Content-Length: 35" -d "{\"Status\": \"Connect\", \"Volume\": 95}" http://localhost:40000/devices/F4CAE5407040@FreeboxServer
commandArray['Variable:kodi_bar_play'] = 1
os.execute(runcommand)
end
if(otherdevices['kodi Bar'] == 'Off' and kodi_bar_play == 1 ) then
runcommand = curl -X PUT -H "Content-Type: application/json" -H "Content-Length: 38" -d "{\"Status\": \"Disconnect\", \"Volume\": 95}" http://localhost:40000/devices/F4CAE5407040@FreeboxServer
commandArray['Variable:kodi_bar_play'] = 0
os.execute(runcommand)
end
return commandArray
Merci pour les futures réponses