Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 18:24
On y arrivera pas si tu ne test pas les scripts que je post. Essaie le dernier et on verra ensuite pour le reste. on ferra un autre script mais en time pour fermer.
Reprenez le contrôle de votre domotique
https://easydomoticz.com/forum/
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 commandArrayCode : 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 commandArrayCode : Tout sélectionner
commandArray={}
-- 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 commandArrayCode : Tout sélectionner
-- 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'
end
end
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
essai la même manip dans le même ordre avec le script en dessous et au passage donne moi la valeur de log de UVvil1driver a écrit : 10 mai 2020, 16:19 Pour récupérer les uv seuls tu peux tester ceci
Code : Tout sélectionner
otherdevices_uv['UV']
Code : Tout sélectionner
commandArray={}
print('uv'..otherdevices_uv['UV'])
-- Fermeture du Store Terrasse
if (devicechanged['Nuit']=='On') then
commandArray['Fermeture Store Terrasse']='On'
commandArray['Store Terrasse']='Off'
print('Fermeture Store Terrasse')
commandArray ['Variable:store exterieur']='ferme'
commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
end
return commandArray