dzvents - problème récupération état d'un site ou d'un API web
Publié : 30 juil. 2019, 11:01
Bonjour,
Je tente de récupérer d'état d'un site web et/ou d'une api web via un script Dsvents directement depuis le dashboard domoticz mais je suis confronté à une erreur : Error: dzVents: Error: (2.4.26) There was a problem handling the request alors que le site répond correctement.
Voici le script que j'utilise et qui s'appuie sur l'exemple générique fourni :
J'ai également testé avec une page web pour tester si elle retourne un 200 OK (dans l'exemple précédent c'est un 204) et le résultat est le même avec une erreur au niveau de la log :
Y a t'il une erreur sur mon script ou un soucis au niveau des scripts Dzvents ?
J'utilise la dernière version beta 4.11062
Merci
Je tente de récupérer d'état d'un site web et/ou d'une api web via un script Dsvents directement depuis le dashboard domoticz mais je suis confronté à une erreur : Error: dzVents: Error: (2.4.26) There was a problem handling the request alors que le site répond correctement.
Voici le script que j'utilise et qui s'appuie sur l'exemple générique fourni :
Code : Tout sélectionner
return {
on = {
timer = {
'every 10 minutes' -- just an example to trigger the request
},
httpResponses = {
'trigger' -- must match with the callback passed to the openURL command
}
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'http://influx:8086/ping',
method = 'GET',
callback = 'trigger', -- see httpResponses above.
})
end
if (item.isHTTPResponse and item.ok) then
if (item.statusCode == 204) then
if (domoticz.devices('Status InfluxDB').state == 'Off') then
domoticz.devices('Status InfluxDB').switchOn()
-- domoticz.notify('Service InfluxDB up','InfluxDB disponible',PRIORITY_HIGH)
end
else
if (domoticz.devices('Status InfluxDB').state == 'On') then
domoticz.devices('Status InfluxDB').switchOff()
domoticz.notify('Service InfluxDB down','InfluxDB non disponible',PRIORITY_HIGH)
domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
domoticz.log(item, domoticz.LOG_ERROR)
end
end
end
end
}
Code : Tout sélectionner
2019-07-30 10:40:04.850 Error: dzVents: Error: (2.4.26) There was a problem handling the request
2019-07-30 10:40:04.854 Error: dzVents: Error: (2.4.26) {["headers"]={["Request-Id"]="9ed4bd50-b2a5-11e9-826b-005056b5686a", ["Date"]="Tue, 30 Jul 2019 08:40:01 GMT", ["X-Influxdb-Build"]="OSS", ["X-Influxdb-Version"]="1.7.7", ["X-Request-Id"]="9ed4bd50-b2a5-11e9-826b-005056b5686a", ["Content-Type"]="application/json"}, ["isDevice"]=false, ["_contentType"]="application/json", ["ok"]=true, ["isScene"]=false, ["baseType"]="httpResponse", ["isVariable"]=false, ["data"]="", ["trigger"]="trigger", ["isGroup"]=false, ["statusCode"]=204, ["callback"]="trigger", ["statusText"]="No Content", ["isSecurity"]=false, ["protocol"]="HTTP/1.1", ["isTimer"]=false, ["isHTTPResponse"]=true, ["isJSON"]=false}
J'utilise la dernière version beta 4.11062
Merci