j'ai trouvé ceci pour la detection de telephone sur le wifi de la maison,
https://itechnofrance.wordpress.com/201 ... -domoticz/
Code : Tout sélectionner
commandArray = {}
ping_success=os.execute(‘sudo arping -q -c3 192.168.1.76 -W 1’)
if ping_success then
if ( otherdevices[‘Presence Fabrice’] == ‘Off’) then
commandArray[‘Presence Fabrice’]=’On’
end
else
if (otherdevices[‘Presence Fabrice’] == ‘On’) then
commandArray[‘Presence Fabrice’]=’Off’
end
end
ping_success=os.execute(‘sudo arping -q -c5 192.168.1.22 -W 1’)
if ping_success then
if ( otherdevices[‘Presence Valerie’] == ‘Off’) then
commandArray[‘Presence Valerie’]=’On’
end
else
if (otherdevices[‘Presence Valerie’] == ‘On’) then
commandArray[‘Presence Valerie’]=’Off’
end
end
return commandArrayce script me plait car ça differencie bien chaque telephone contrairement au script ici (qui au passage me sort aussi des erreurs)
https://www.latelierdugeek.fr/2014/12/1 ... telephone/
si vous pouviez me filer un coup de main ce serait bien sympatoche
edit :
j'ai trouvé un autre script qui serait tres bien, mais ça ne fonctionne pas non plus aaaarrrrrggghhhhhh
Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_presence.lua: /home/pi/domoticz/scripts/lua/script_time_presence.lua:9: bad argument #1 to 'sub' (string expected, got nil)
Code : Tout sélectionner
-- Alexandre DUBOIS - Modification 2015
-- Ce script vérifie la présence de 2 téléphones sur le réseau pour savoir si quelqu'un est là.
-- La vérification est effectuée une fois par minute tant qu'aucun téléphone n'est à portée,
-- puis une fois toute les 10 minutes quand au moins un téléphone est connecté pour ne pas trop stresser sa batterie.
commandArray = {}--Cette fonction calcule la différence de temps (en secondes) entre maintenant
--et la date passée en paramètre.
function timedifference (s)
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
t1 = os.time()
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = os.difftime (t1, t2)
return difference
end
--Si le téléphone n'est pas détecté ou qu'il est présent depuis plus de 10 minutes (600 secondes),
--alors on vérifie à nouveau sa présence
if (otherdevices['Presence']=='Off' or (otherdevices['Presence']=='On' and timedifference(otherdevices_lastupdate['Presence']) > 600)) then
ping_success_tel1=os.execute('ping -c1 192.168.0.13')
ping_success_tel2=os.execute('ping -c1 192.168.0.99')
if ping_success_tel1 or ping_success_tel2 then
if ( otherdevices['presence'] == 'Off') then -- Passage du switch ON que s'il était OFF avant
print(" ping connect success ")
commandArray['presence']='On'
else
if otherdevices['Presence']=='On' then --On ne passe l'interrupteur virtuel à Off que s'il est sur On.
print(" ping connect failure ")
commandArray['Presence']='Off'
end
end
end
return commandArray