Page 9 sur 34

Re: aide pour réalisation script en lua

Publié : 10 mai 2020, 17:55
par thier
si si vill1driver je lis tes messages mais je ne réponds pas comme je ne suis pas le demandeur.

Re: aide pour réalisation script en lua

Publié : 10 mai 2020, 17:56
par thier
post ton script.

Re: aide pour réalisation script en lua

Publié : 10 mai 2020, 18:00
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

Re: aide pour réalisation script en lua

Publié : 10 mai 2020, 18:03
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

Re: aide pour réalisation script en lua

Publié : 10 mai 2020, 18:07
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.

Re: aide pour réalisation script en lua

Publié : 10 mai 2020, 18:08
par thier
Verifie que ta variable est bien la valeur qui correspond à l'état de ton store.

Re: aide pour réalisation script en lua

Publié : 10 mai 2020, 18:13
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

Re: aide pour réalisation script en lua

Publié : 10 mai 2020, 18:15
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

Re: aide pour réalisation script en lua

Publié : 10 mai 2020, 18:17
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.

Re: aide pour réalisation script en lua

Publié : 10 mai 2020, 18:20
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