aide pour réalisation script en lua

Forum dédié aux problématiques concernant les scripts pour DomoticZ.
Entourez votre code et les logs avec les balises nommées code grâce au bouton <\>.
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: aide pour réalisation script en lua

Message par thier »

si si vill1driver je lis tes messages mais je ne réponds pas comme je ne suis pas le demandeur.
Dernière modification par thier le 10 mai 2020, 17:58, modifié 1 fois.
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: aide pour réalisation script en lua

Message par thier »

post ton script.
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
vr6man
Messages : 627
Inscription : 18 juil. 2017, 12:15

Re: aide pour réalisation script en lua

Message par vr6man »

Code : Tout sélectionner

commandArray={}

--pour connaitre les valeurs on met des print. Tu les commentes avec -- quand tu n'en as plus besoin.
        print('otherdevices[\'UV\'] '..otherdevices['UV'])
        print('otherdevices[\'Pluie\'] '..otherdevices['Pluie'])
       -- print('otherdevices[\'Nuit\'] '..otherdevices['Nuit'])
        print('otherdevices[\'Vent\'] '..otherdevices['Vent'])
       -- print('otherdevices[\'Absence\'] '..otherdevices['Absence'])
        print('otherdevices[\'Store Terrasse\'] '..otherdevices['Store Terrasse'])
        print('otherdevices[uservariables["store exterieur"]] '..uservariables["store exterieur"])
-- Ouverture Store Terrasse
if (devicechanged['Store Terrasse']=='On' and otherdevices['Absence']=='Off') then
        commandArray['Ouverture Store Terrasse']='On'
        print('Ouverture Store Terrasse')
        commandArray ['Variable:store exterieur']='ouvert'
        commandArray['SendNotification']='Store Terrasse#Ouverture Store Terrasse'

-- Fermeture du Store Terrasse
elseif (devicechanged['Nuit']=='On'  and otherdevices['Absence']=='Off' and otherdevices['Store Terrasse']=='16.0') then
        commandArray['Fermeture Store Terrasse']='On'
        print('Fermeture Store Terrasse')
        commandArray ['Variable:store exterieur']='ferme'
        commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
end

return commandArray
vr6man
Messages : 627
Inscription : 18 juil. 2017, 12:15

Re: aide pour réalisation script en lua

Message par vr6man »

Code : Tout sélectionner

commandArray={}

--pour connaitre les valeurs on met des print. Tu les commentes avec -- quand tu n'en as plus besoin.
        print('otherdevices[\'UV\'] '..otherdevices['UV'])
        print('otherdevices[\'Pluie\'] '..otherdevices['Pluie'])
       -- print('otherdevices[\'Nuit\'] '..otherdevices['Nuit'])
        print('otherdevices[\'Vent\'] '..otherdevices['Vent'])
       -- print('otherdevices[\'Absence\'] '..otherdevices['Absence'])
        print('otherdevices[\'Store Terrasse\'] '..otherdevices['Store Terrasse'])
        print('otherdevices[uservariables["store exterieur"]] '..uservariables["store exterieur"])
-- Ouverture Store Terrasse
if (devicechanged['Store Terrasse']=='On' and otherdevices['Absence']=='Off') then
        commandArray['Ouverture Store Terrasse']='On'
        print('Ouverture Store Terrasse')
        commandArray ['Variable:store exterieur']='ouvert'
        commandArray['SendNotification']='Store Terrasse#Ouverture Store Terrasse'

-- Fermeture du Store Terrasse
elseif (devicechanged['Nuit']=='On'  and otherdevices['Absence']=='Off' and otherdevices['Store Terrasse']=='16.0') then
        commandArray['Fermeture Store Terrasse']='On'
        print('Fermeture Store Terrasse')
        commandArray ['Variable:store exterieur']='ferme'
        commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
end

return commandArray
Effectivement maintenant la variable s'incremete bien depuis que j'ai supprimé les conditions météo pour l'ouverture
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: aide pour réalisation script en lua

Message par thier »

celui ci fonctionne?

Code : Tout sélectionner

commandArray={}

--pour connaitre les valeurs on met des print. Tu les commentes avec -- quand tu n'en as plus besoin.
        
        print('otherdevices[\'Store Terrasse\'] '..otherdevices['Store Terrasse'])
        print('otherdevices[uservariables["store exterieur"]] '..uservariables["store exterieur"])
-- Ouverture Store Terrasse
if (devicechanged['Store Terrasse']=='On' and uservariables["store exterieur"] == 'ferme' and otherdevices['Absence']=='Off') then
        commandArray['Ouverture Store Terrasse']='On'
        print('Ouverture Store Terrasse')
        commandArray ['Variable:store exterieur']='ouvert'
        commandArray['SendNotification']='Store Terrasse#Ouverture Store Terrasse'

-- Fermeture du Store Terrasse
elseif (devicechanged['Store Terrasse']=='Off' and uservariables["store exterieur"] == 'ouvert' and otherdevices['Absence']=='Off') then
        commandArray['Fermeture Store Terrasse']='On'
        print('Fermeture Store Terrasse')
        commandArray ['Variable:store exterieur']='ferme'
        commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
end

return commandArray
j'ai toujours un problème avec ton retour 16.0.
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: aide pour réalisation script en lua

Message par thier »

Verifie que ta variable est bien la valeur qui correspond à l'état de ton store.
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
vr6man
Messages : 627
Inscription : 18 juil. 2017, 12:15

Re: aide pour réalisation script en lua

Message par vr6man »

oui la variable est bonne

le script ne fonctionne que si je met 16.0 pour store terrasse

Par contre comment rajouter pour que le store ne s'ouvre pas si il fait nuit
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: aide pour réalisation script en lua

Message par thier »

Chaque chose en son temps.
celui-ci doit fonctionner car il s'affranchie de la valeur de retour de store terrasse

Code : Tout sélectionner

commandArray={}

--pour connaitre les valeurs on met des print. Tu les commentes avec -- quand tu n'en as plus besoin.
        
        print('otherdevices[\'Store Terrasse\'] '..otherdevices['Store Terrasse'])
        print('otherdevices[uservariables["store exterieur"]] '..uservariables["store exterieur"])
-- Ouverture Store Terrasse
if (devicechanged['Store Terrasse'])
    if uservariables["store exterieur"] == 'ferme' and otherdevices['Absence']=='Off') then
        commandArray['Ouverture Store Terrasse']='On'
        print('Ouverture Store Terrasse')
        commandArray ['Variable:store exterieur']='ouvert'
        commandArray['SendNotification']='Store Terrasse#Ouverture Store Terrasse'

-- Fermeture du Store Terrasse
    elseif (uservariables["store exterieur"] == 'ouvert' and otherdevices['Absence']=='Off') then
        commandArray['Fermeture Store Terrasse']='On'
        print('Fermeture Store Terrasse')
        commandArray ['Variable:store exterieur']='ferme'
        commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
    end
end
return commandArray
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: aide pour réalisation script en lua

Message par thier »

vr6man a écrit : 10 mai 2020, 18:13 Par contre comment rajouter pour que le store ne s'ouvre pas si il fait nuit
Je ne vois pas l’intérêt puisque tu appuies sur le bouton, tu regardes s'il fait nuit.
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
vr6man
Messages : 627
Inscription : 18 juil. 2017, 12:15

Re: aide pour réalisation script en lua

Message par vr6man »

Pour éviter une mauvaise manipulation

sinon ca fonctionne

fermeture du store et mise a jour de la variable avec le script suivant:

Code : Tout sélectionner

commandArray={}

--pour connaitre les valeurs on met des print. Tu les commentes avec -- quand tu n'en as plus besoin.
        print('otherdevices[\'UV\'] '..otherdevices['UV'])
        print('otherdevices[\'Pluie\'] '..otherdevices['Pluie'])
       -- print('otherdevices[\'Nuit\'] '..otherdevices['Nuit'])
        print('otherdevices[\'Vent\'] '..otherdevices['Vent'])
       -- print('otherdevices[\'Absence\'] '..otherdevices['Absence'])
        print('otherdevices[\'Store Terrasse\'] '..otherdevices['Store Terrasse'])
        print('otherdevices[uservariables["store exterieur"]] '..uservariables["store exterieur"])
-- Ouverture Store Terrasse
if (devicechanged['Store Terrasse']=='On' and otherdevices['Absence']=='Off') then
        commandArray['Ouverture Store Terrasse']='On'
        print('Ouverture Store Terrasse')
        commandArray ['Variable:store exterieur']='ouvert'
        commandArray['SendNotification']='Store Terrasse#Ouverture Store Terrasse'

-- Fermeture du Store Terrasse
elseif (devicechanged['Nuit']=='On' and uservariables["store exterieur"] == 'ouvert'and otherdevices['Absence']=='Off' and otherdevices['Store Terrasse']=='16.0') then
        commandArray['Fermeture Store Terrasse']='On'
        print('Fermeture Store Terrasse')
        commandArray ['Variable:store exterieur']='ferme'
        commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
end

return commandArray
Répondre