Page 3 sur 34
Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 14:26
par vr6man
toujours pas avec On et dan les logs
2020-05-10 14:25:01.974 Status: LUA: otherdevices['Store Terrasse'] 16.0
2020-05-10 14:25:01.974 Status: LUA: otherdevices['Nuit'] On
je ne comprends pas le 16.0 devant Store Terrasse
Par contre si je met
Code : Tout sélectionner
commandArray={}
print('otherdevices[\'Store Terrasse\'] '..otherdevices['Store Terrasse'])
print('otherdevices[\'Nuit\'] '..otherdevices['Nuit'])
-- Fermeture du Store Terrasse
if(otherdevices['Store Terrasse']=='16.0' and otherdevices['Nuit']=='On') then
commandArray['Store Terrasse']='Off'
print('Fermeture Store Terrasse')
commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
end
return commandArray
ca fonctionne
Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 14:31
par thier
@vr6man
Tu cherches quoi:
1- fermer ou ouvrir ton store en fonction de conditions et sans action sur un bouton de l'interface domoticz -> script_time
2- fermer ou ouvrir ton store en fonction de conditions et avec action sur un bouton de l'interface domoticz -> script_device
Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 14:35
par thier
16 je ne sais pas. un pourcentage? il avait fini de s'ouvrir? tu as donc un problème avec le retour On/Off de ton/tes bouton(s). Regarde dans l'interface de domoticz/interrupteur les log de tes boutons.
Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 14:36
par vr6man
je cherche à fermer ou ouvrir le store en fonction de conditions et avec action sur un bouton de l'interface domoticz -> script_device
Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 14:36
par vr6man
thier a écrit : 10 mai 2020, 14:35
16 je ne sais pas. un pourcentage? tu as donc un problème avec le retour On/Off de ton/tes bouton(s). Regarde dans l'interface de domoticz/interrupteur les log de tes boutons.
dans l'interface les logs sont On ou Off
Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 14:41
par thier
donc enregistre en script_device_store.lua
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'])
if
-- Fermeture du Store Terrasse
if(devicechanged['Store Terrasse']=='Off' and otherdevices['Absence']=='Off' and otherdevices['Nuit']=='On') then
commandArray['Store Terrasse']='Off'
print('Fermeture Store Terrasse')
commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
end
return commandArray
pense à enlever .lua des autres scripts pour pas que ça se morde la queue.
Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 14:43
par vr6man
donc ca marche avec en script time
Code : Tout sélectionner
commandArray={}
print('otherdevices[\'Store Terrasse\'] '..otherdevices['Store Terrasse'])
print('otherdevices[\'Nuit\'] '..otherdevices['Nuit'])
-- Fermeture du Store Terrasse
if(otherdevices['Store Terrasse']=='16.0' and otherdevices['Nuit']=='On') then
commandArray['Store Terrasse']='Off'
print('Fermeture Store Terrasse')
commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
end
return commandArray
Par contre en script device
avec le même script ca plante Domoticz car le script tourne en boucle
Ps j'ai supprimé tout les autre scripts
Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 14:45
par thier
Edit. Une boulette un if en trop.
correction
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'])
-- Fermeture du Store Terrasse
if(devicechanged['Store Terrasse']=='Off' and otherdevices['Absence']=='Off' and otherdevices['Nuit']=='On') then
commandArray['Store Terrasse']='Off'
print('Fermeture Store Terrasse')
commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
end
return commandArray
Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 14:46
par thier
Normale que ça tourne en boucle car dans un script_device il faut la condition devicechanged. essai le dernier script posté en script_device.
Re: aide pour réalisation script en lua
Publié : 10 mai 2020, 14:48
par vr6man
j'essaie ce script : ?
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'])
-- Fermeture du Store Terrasse
if(devicechanged['Store Terrasse']=='Off' and otherdevices['Absence']=='Off' and otherdevices['Nuit']=='On') then
commandArray['Store Terrasse']='Off'
print('Fermeture Store Terrasse')
commandArray['SendNotification']='Store Terrasse#Fermeture Store Terrasse'
end
return commandArray