j'ai 2 script qui m'affiche sans arret ce message.
un script de bande passante. et un script de présence wifi/Bluetooth
le problème c'est que vue qu'il met trop longtemps a répondre pour la présence, mon 3 eme téléphone reste tout le temps présent même quand il n'est pas la.
j'ai pense remplacer mes téléphone par des ibeacons, mais je ne sais pas si c'est compatible android et a mon avis j'aurais le même problème. je réfléchi a mettre un clavier code zwave rfid, mais en attendant j'aimerais que je script fonctionne correctement.
Vaut il mieux faire 2 script et mettre uniquement 2 téléphone par script, car je dois ajouter un 4 eme téléphone. ou y a t'il une autre solution.
Code : Tout sélectionner
-- Title: script_time_ping.lua
-- Date: 14-07-2015
commandArray={}
debug=false
prefixe="(PING) "
local ping={}
local ping_success
local bt_success
ping[1]={'192.168.1.30', 'Motion Rhum1', 'TelephoneRhum1', '9C:E0:63:F1:82:40', 5} -- android
ping[2]={'192.168.1.31', 'Motion Lauriana', 'TelephoneLauriana', '68:FB:7E:E0:65:42', 5} -- iphone
ping[3]={'192.168.1.33', 'Motion Invite', 'TelephoneMaman', '', 5} -- android
for ip = 1, #ping do
f = assert (io.popen ("hcitool names "..ping[ip][4]))
bt = f:read()
if bt==nil then
bt_success=false
ping_success=os.execute('ping -c 1 -w 1 '..ping[ip][1])
else
bt_success=true
end
f:close()
if ping_success or bt_success then
if (debug==true) then
print(prefixe.."ping success "..ping[ip][2])
end
if (otherdevices[ping[ip][2]]=='Off') then
commandArray[ping[ip][2]]='On'
end
if (uservariables[ping[ip][3]]) ~= 1 then
commandArray['Variable:'..ping[ip][3]]= tostring(1)
end
else
if (debug==true) then
print(prefixe.."ping fail "..ping[ip][2])
end
if (otherdevices[ping[ip][2]]=='On') then
if (uservariables[ping[ip][3]])==ping[ip][5] then
commandArray[ping[ip][2]]='Off'
else
commandArray['Variable:'..ping[ip][3]]= tostring((uservariables[ping[ip][3]]) + 1)
end
end
end
end
return commandArray