bonjour à tous. ca fait plusieurs mois que je demande la temperature du salon à mon GH mais il ne me réponds jamais !
quand je le demande sur mon téléphone, il me m'ecrit • (le caractere spécial en forme de gros point) mais ne dit rien
dans domoticz pourtant j'ai bien get:temperature:salon dans le dummy IFTTT.
ensuite j'ai suivi le forum pour ajouter des logs mais ils n'apparaissent pas
si une ame charitable peut consulter mon script_device_ifttt.lua pour voir d'où vient l'erreur.
gnotify parle bien depuis le terminal, et python est à jour.
merci d'avance
Code : Tout sélectionner
commandArray = {}
local blinds = {
}
local captors = {
["Temperature Salon"]="dusalon danslesalon dusjour danslesjour detouteslespices delamaison"
["Temperature Cuisine"]="cuisine delacuisine"
}
local sensors = {
}
local scenes = {
}
local switchs = {
}
function round(num, dec)
if num == 0 then
return 0
else
local mult = 10^(dec or 0)
return math.floor(num * mult + 0.5) / mult
end
end
local function get(deviceValue, position)
local current = 0
for value in string.gmatch(deviceValue, '([^:]+)') do
current = current + 1
if current == position then
return value
end
end
return value
end
for deviceName,deviceValue in pairs(devicechanged) do
if deviceName == 'IFTTT' then
local command = get(deviceValue, 1)
if command == 'blind' then
local value = get(deviceValue, 2)
local text = get(deviceValue, 3):gsub("%W", ""):lower()
for blind,words in pairs(blinds) do
for word in words:gmatch("%w+") do
if text == word then
commandArray[blind] = value
end
end
end
elseif command == 'set' then
local value = get(deviceValue, 3)
local text = get(deviceValue, 2):gsub("%W", ""):lower()
for sensor,words in pairs(sensors) do
for word in words:gmatch("%w+") do
if text == word then
commandArray[sensor] = 'Set Level: ' .. value
end
end
end
elseif command == 'get' then
local raw = get(deviceValue, 3)
local text = raw:gsub("%W", ""):lower()
local sentences = {}
for captor,words in pairs(captors) do
for word in words:gmatch("%w+") do
if text == word then
local property = get(deviceValue, 2)
local values = {}
local index = 0
for value in otherdevices[captor]:gmatch("[^;]+") do
values[index] = value
index = index + 1
end
if property == 'temperature' then
print ("property is "..property)
print ("otherdevices[captor] is "..otherdevices[captor])
print ("values[0] is "..tostring(values[0]))
table.insert(sentences, captor..", "..tostring(values[0]).." °")
end
if property == 'humidity' and index > 1 then
table.insert(sentences, captor..", "..tostring(values[1]).." %")
end
end
end
end
local tts = "404"
if #sentences > 0 then
tts = table.concat(sentences, ".")
end
print ("tts is "..tts)
os.execute("gnotify -H 192.168.0.27 -l fr OK")
os.execute("gnotify -H 192.168.0.27 -l fr "..tts)
elseif command == 'scene' then
local text = get(deviceValue, 2):gsub("%W", ""):lower()
for scene,words in pairs(scenes) do
for word in words:gmatch("%w+") do
if text == word then
commandArray['Scene:'..scene] = 'On'
end
end
end
elseif command == 'switch' then
local value = get(deviceValue, 2)
local text = get(deviceValue, 3):gsub("%W", ""):lower()
for switch,words in pairs(switchs) do
for word in words:gmatch("%w+") do
if text == word then
commandArray[switch] = value
end
end
end
for sensor,words in pairs(sensors) do
for word in words:gmatch("%w+") do
if text == word then
commandArray[sensor] = value
end
end
end
end
end
end
return commandArray