desoler si je suis pas dans le bon forum , mais je sais pas si mon problème viens de easyesp ou du script Lua.
.
j'ai réussi a faire bougé un servo moteur avec un inter domoticz mais pas avec un dimmer ..
.
j'ai suivi le tuto https://www.tutos.eu/3098
avec un inter mon servo moteur fonctionne
.
j'ai configuré mon inter en dimmer et rien ... mon servomoteur reste bloque dans sa position..
pourtant si je fais
http://192.168.0.49/control?cmd=Servo,1,13,16
http://192.168.0.49/control?cmd=Servo,1,13,175
ca fonctionne ( comme avec l'inter dans domoticz)
voici le code du tuto
Code : Tout sélectionner
commandArray = {}
DomDevice = 'servo'; -- Votre peripherique à controler
IP = '192.168.0.49'; -- L'adresse IP de l'ESP8266
PIN = "13"; -- Le pin GPIO du servo
function sleep(n)
os.execute("sleep " .. tonumber(n))
end
if devicechanged[DomDevice] then
if(devicechanged[DomDevice]=='Off') then
print ("OFF dim = "..uservariables['dimmer']);
CalcValue = 0;
else if(devicechanged[DomDevice]=='On') then
DomValue = uservariables['dimmer'];
print ("ON dim = "..uservariables['dimmer']);
CalcValue = DomValue;
else
print("Other");
DomValue = otherdevices_svalues[DomDevice];
CalcValue = math.floor(30 + DomValue * 1.50); -- La fonction de calcul dimmer vers servo
commandArray['Variable:dimmer'] = tostring(CalcValue);
print ("dim Level = "..uservariables['dimmer']);
end
end
runcommand = "curl 'http://" .. IP .. "/control?cmd=Servo,2," ..PIN.. "," .. CalcValue .. "'"; -- Commande de servo
dodo = "curl 'http://" .. IP .. "/control?cmd=Servo,2," ..PIN.. ",9999'"; -- Desactiver lesServo
os.execute(runcommand);
sleep(2) -- Attente entre commande et desactivation
os.execute(dodo);
print("PWM value= "..CalcValue);
end
return commandArray
.runcommand = "curl 'http://" .. IP .. "/control?cmd=Servo,2," ..PIN.. "," .. CalcValue .. "'";
il y a servo,2 ? j'en ai qu'un !et si je met 1 ca change rien ...
et j'ai remarqué qu'avec mon servo moteur je peux aller que de 16 à 175 en position


dans les log , j'ai comme erreur
.2023-03-17 18:34:59.827 Error: EventSystem: in servo: [string "commandArray = {} ..."]:16: attempt to concatenate a nil value (field 'dimmer')
2023-03-17 18:35:00.274 Error: EventSystem: in servo: [string "commandArray = {} ..."]:10: attempt to index a nil value (global 'devicechanged')
et là ,..., je pleure
