J'ai besoin d'un coup de main.
j'ai des tags nuts mini et j'aimerais sur une detection de ceux ci (ou non detection de ceux ci), mettre a jour un virtual device accessible par HTTP sur HC.
actuellement, je le met a jour via cette URL
http://192.168.1.22/api/callAction?devi ... DETECTE%22
Mon code de detection de tag est celui ci:
Code : Tout sélectionner
--Variable scripts receive 7 tables from Domoticz:
-- otherdevices, otherdevices_lastupdate, otherdevices_svalues, otherdevices_idx, uservariables, uservariables_lastupdate and uservariablechanged
commandArray = {}
-- Path to curl
local curl = '/usr/bin/curl'
beaconHome=0
for variableName, variableValue in pairs(uservariables) do
if string.sub(variableName,1,3)=="Tag" and variableValue ~= "AWAY" then
beaconHome=beaconHome+1
end
end
if otherdevices['Alarm'] == 'On' and beaconHome>=1 then -- switch Off Alarm because 1 beacon come back Home
table.insert (commandArray, { ['Alarm'] ='Off' } )
elseif otherdevices['Alarm'] == 'Off' and beaconHome==0 then -- switch On Alarm because all beacon are away
table.insert (commandArray, { ['Alarm'] ='On' } )
end
return commandArrayhelp