lenteur d'execution script lua
Publié : 21 janv. 2018, 16:36
bonjour à tous ,
j'ai un ipx800v4 avec un bientôt un x-display , qui me permettra d'avoir un écran déporté et raisin pouvoir lancer , des commandes , ouverture des volets , thermostat ..
je suis en train de réaliser un script en lua , qui me modifiera la valeur de mon thermostat chauffage dans domoticz si il ya une modification de celui de l'ipx via le x-display
je recupere les données de l'ipx via un script bash , et je mets à jour les données de domoticz via l'api .
bien que tout fonctionne , j'ai un message d'erreur :Error: EventSystem: Warning!, lua script /usr/share/domoticz/scripts/lua/script_device_thermostat.lua has been running for more than 10 seconds
qd il ya une modification du thermostat de l'ipx et que je lance le script bash , il ya une certaine lenteur pour la mise à jour de la valuer sur domoticz
Est ce que mes scripts peuvent être améliorés afin d'accélérer l'update de la valeur ? ci joint mes 2 scripts :
d'avance merci
j'ai un ipx800v4 avec un bientôt un x-display , qui me permettra d'avoir un écran déporté et raisin pouvoir lancer , des commandes , ouverture des volets , thermostat ..
je suis en train de réaliser un script en lua , qui me modifiera la valeur de mon thermostat chauffage dans domoticz si il ya une modification de celui de l'ipx via le x-display
je recupere les données de l'ipx via un script bash , et je mets à jour les données de domoticz via l'api .
bien que tout fonctionne , j'ai un message d'erreur :Error: EventSystem: Warning!, lua script /usr/share/domoticz/scripts/lua/script_device_thermostat.lua has been running for more than 10 seconds
qd il ya une modification du thermostat de l'ipx et que je lance le script bash , il ya une certaine lenteur pour la mise à jour de la valuer sur domoticz
Est ce que mes scripts peuvent être améliorés afin d'accélérer l'update de la valeur ? ci joint mes 2 scripts :
Code : Tout sélectionner
#/!bin/bash
#SERVER
DOMOTICZ_SERVER="zz.0.0.zz:yyyy"
IPX800="xx.xx.xx.xx"
api="xxxx"
#SERVER idx
TEMP_LOCAL_INFO="278"
Thermo_IPX="279"
#VARIABLES"
if ping -c 1 $IPX800 > /dev/null ; then
#recuperation de la valeur temperature bureau
TEMPSERV=$(curl -s "http://$IPX800/api/xdevices.json?key=$api&Get=A"| jq -r .A1)
#formatage de la valeur
TEMPSERV=$(awk "BEGIN {printf \"%.1f\",${TEMPSERV}/0.028*0.000050354-0.25/0.028}")
#recuperation de la valeur thermostat
Thermo1=$(curl -s "http://$IPX800/api/xdevices.json?key=$api&Get=T"| jq -r .T1)
#formatage de la valeur
#Thermo1=$(awk "BEGIN {printf \"%.1f\",$Thermo1}")
echo "IPX800 V4"
echo "Temperature Local Serveur :"$TEMPSERV " °C"
echo "Thermostat chauffage :"$Thermo1 " °C"
#envoi de la valeur
curl -s "http://$DOMOTICZ_SERVER/json.htm?type=command¶m=udevice&idx=$TEMP_LOCAL_INFO&svalue=$TEMPSERV"
curl -s "http://$DOMOTICZ_SERVER/json.htm?type=command¶m=udevice&idx=$Thermo_IPX&svalue=$Thermo1"
else
echo "IPX800 ne repond pas , est-il connecté reseau ?"
fi
Code : Tout sélectionner
--chhargement des modules
package.path = package.path..";/usr/share/domoticz/scripts/lua/?.lua"
require "modules"
commandArray = {}
--Config
local debug ='oui'
local thermo_ipx = 'Thermostat_Ipx'
local thermostat = 'Thermostat Chauffage'
local thermo_ipx_cons = tonumber(otherdevices_svalues['Thermostat_Ipx'])
local idx_thermo = 155
local thermo_cons = tonumber(otherdevices_svalues['Thermostat Chauffage'])
var_thermo_ipx =tostring(uservariables['thermo_Ipx'])
if (devicechanged[thermo_ipx] and (var_thermo_ipx ~= tostring(thermo_ipx_cons))) then
if (debug =='oui') then
print('====Debug Thermostat Chauffage====')
print('Modifcation valeur Thermo IPX')
print ('Variable Thermostat : '..var_thermo_ipx..' °C')
print('Consigne Thermo.IPX :'..thermo_ipx_cons..' °C')
print('===Fin debug Thermo===')
end
commandArray['Variable:thermo_Ipx'] = tostring(thermo_ipx_cons)
commandArray['UpdateDevice'] = idx_thermo .. '|0|' .. (tostring(thermo_ipx_cons))
end
return commandArray