Celui qui recupere les infos de trajet de Waze :
viewtopic.php?f=17&t=785
Et celui de controler Domoticz par SMS :
viewtopic.php?f=17&t=596
Le but :
lorsque qu'un interrupteur est activé par son planning, il envoie les info du waze text device par sms a son destinataire
La communication entre WAZE et domoticz est OK
La communication entre Domoticz et Ultimate SMS gateway est OK
Si dans mon navigateur je tape :
Code : Tout sélectionner
http://192.168.0.21:8080/json.htm?type=devices&rid=2625Code : Tout sélectionner
{
"ActTime" : 1442309771,
"ServerTime" : "2015-09-15 11:36:11",
"Sunrise" : "07:42",
"Sunset" : "20:12",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "34:27 par A62 - E72",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 4,
"HardwareName" : "Dummy",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveTimeout" : false,
"ID" : "14A90",
"LastUpdate" : "2015-09-14 18:00:07",
"Name" : "Trajet Boulot Maison en Minutes",
"Notifications" : "false",
"PlanID" : "0",
"Protected" : false,
"ShowNotifications" : false,
"SignalLevel" : 12,
"SubType" : "Text",
"Timers" : "false",
"Type" : "General",
"TypeImg" : "text",
"Unit" : 1,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "2625"
}
],
"status" : "OK",
"title" : "Devices"
}Comme le script qui recupere les infos de Waze lit le Json je m'en suit servit comme base et je l 'ai adapté :
Code : Tout sélectionner
commandArray={}
--import des fontions pour lire le JSON
json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()
if (devicechanged['Envoye sms'] == 'On') then
local waze=assert(io.popen('curl "http://192.168.0.21:8080/json.htm?type=devices&rid=2625"'))
local Data = waze:read('all')
waze:close()
local jsonTrajet = json:decode("Data")
Data = jsonTrajet['response']['Data']
commandArray['OpenURL']='192.168.0.10:56692/send.html?smsto=xxxxxxxxxxxxx&smsbody=Data&smstype=sms&smstype=sms'
end
return commandArray
Un peu d'aide ou de sourcing est la bienvenu