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 <\>.
vr6man
Messages : 627
Inscription : 18 juil. 2017, 12:15

Re: aide pour réalisation script en lua

Message par vr6man »

oui et même ca a éteint ma lumière de tv
Keros
Messages : 6638
Inscription : 23 juil. 2019, 20:57

Re: aide pour réalisation script en lua

Message par Keros »

Tu peux remplacer le code par celui-ci : j'ai rajouté une ligne pour connaitre la valeur de Nuit :

Code : Tout sélectionner

commandArray = {}

-- loop through all the changed devices
for deviceName,deviceValue in pairs(devicechanged) do
    print ("Device based event fired on '"..deviceName.."', value '"..tostring(deviceValue).."'")
    print('otherdevices[\'Nuit\'] '..otherdevices['Nuit'])
    if (deviceName=='Nuit') then
    	print ("Device "..deviceName.." detected")
        if deviceValue == "On" then
            	print("Nuit is On")
            	print('otherdevices[\'Store Terrasse\'] '..otherdevices['Store Terrasse'])
		commandArray['Store Terrasse']='Off'
        end
    end
print ("End event fired on "..deviceName)
end

return commandArray
Passe Nuit à Off et On.
Si rien n'est dans les logs, change un autre device pour lancer le script
Comment bien utiliser le forum : Poser une question, Mettre un script, un fichier, une image ou des logs
Mes petits guides : Débuter en programmation, Le débogage, Le choix de matériel, Les sauvegardes
Ma présentation - Mes Tutos
vr6man
Messages : 627
Inscription : 18 juil. 2017, 12:15

Re: aide pour réalisation script en lua

Message par vr6man »

ok voila
  • 2020-05-12 23:06:31.828 Status: LUA: Device based event fired on 'Electrovanne AR_Temperature', value '13.800000190735'
    2020-05-12 23:06:31.828 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:31.828 Status: LUA: End event fired on Electrovanne AR_Temperature
    2020-05-12 23:06:32.121 Status: LUA: Device based event fired on 'Puissance Volet Terrasse', value '0.0'
    2020-05-12 23:06:32.121 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:32.121 Status: LUA: End event fired on Puissance Volet Terrasse
    2020-05-12 23:06:32.230 Status: LUA: Device based event fired on 'Conso Volet Terrasse', value '0.000;0.000'
    2020-05-12 23:06:32.230 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:32.230 Status: LUA: End event fired on Conso Volet Terrasse
    2020-05-12 23:06:32.466 Status: LUA: Device based event fired on 'Conso Prise Tablettes Entree_Utility', value '6.5999999046326'
    2020-05-12 23:06:32.467 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:32.467 Status: LUA: End event fired on Conso Prise Tablettes Entree_Utility
    2020-05-12 23:06:32.467 Status: LUA: Device based event fired on 'Conso Prise Tablettes Entree', value '6.6'
    2020-05-12 23:06:32.467 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:32.467 Status: LUA: End event fired on Conso Prise Tablettes Entree
    2020-05-12 23:06:32.576 Status: LUA: Device based event fired on 'kWh Meter Prise Tablettes Entree', value '6.590;0.000'
    2020-05-12 23:06:32.577 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:32.577 Status: LUA: End event fired on kWh Meter Prise Tablettes Entree
    2020-05-12 23:06:32.577 Status: LUA: Device based event fired on 'kWh Meter Prise Tablettes Entree_Utility', value '6.5900001525879'
    2020-05-12 23:06:32.577 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:32.577 Status: LUA: End event fired on kWh Meter Prise Tablettes Entree_Utility
    2020-05-12 23:06:32.820 Status: LUA: Device based event fired on 'Conso Prise Tablettes Entree_Utility', value '6.5999999046326'
    2020-05-12 23:06:32.821 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:32.821 Status: LUA: End event fired on Conso Prise Tablettes Entree_Utility
    2020-05-12 23:06:32.821 Status: LUA: Device based event fired on 'Conso Prise Tablettes Entree', value '6.6'
    2020-05-12 23:06:32.821 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:32.821 Status: LUA: End event fired on Conso Prise Tablettes Entree
    2020-05-12 23:06:32.930 Status: LUA: Device based event fired on 'kWh Meter Prise Tablettes Entree', value '6.590;0.000'
    2020-05-12 23:06:32.930 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:32.930 Status: LUA: End event fired on kWh Meter Prise Tablettes Entree
    2020-05-12 23:06:32.930 Status: LUA: Device based event fired on 'kWh Meter Prise Tablettes Entree_Utility', value '6.5900001525879'
    2020-05-12 23:06:32.930 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:32.930 Status: LUA: End event fired on kWh Meter Prise Tablettes Entree_Utility
    2020-05-12 23:06:33.039 Status: LUA: Device based event fired on 'Volet aurelia_Temperature', value '126.0'
    2020-05-12 23:06:33.039 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.039 Status: LUA: End event fired on Volet aurelia_Temperature
    2020-05-12 23:06:33.039 Status: LUA: Device based event fired on 'Volet aurelia', value '126.0'
    2020-05-12 23:06:33.039 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.039 Status: LUA: End event fired on Volet aurelia
    2020-05-12 23:06:33.278 Status: LUA: Device based event fired on 'Volet aurelia_Temperature', value '126.0'
    2020-05-12 23:06:33.280 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.280 Status: LUA: End event fired on Volet aurelia_Temperature
    2020-05-12 23:06:33.280 Status: LUA: Device based event fired on 'Volet aurelia', value '126.0'
    2020-05-12 23:06:33.280 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.280 Status: LUA: End event fired on Volet aurelia
    2020-05-12 23:06:33.393 Status: LUA: Device based event fired on 'Conso Vanne 3 voies', value '0.5'
    2020-05-12 23:06:33.393 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.393 Status: LUA: End event fired on Conso Vanne 3 voies
    2020-05-12 23:06:33.393 Status: LUA: Device based event fired on 'Conso Vanne 3 voies_Utility', value '0.5'
    2020-05-12 23:06:33.393 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.393 Status: LUA: End event fired on Conso Vanne 3 voies_Utility
    2020-05-12 23:06:33.501 Status: LUA: Device based event fired on 'kWh Meter Vanne 3 voies', value '0.500;0.000'
    2020-05-12 23:06:33.502 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.502 Status: LUA: End event fired on kWh Meter Vanne 3 voies
    2020-05-12 23:06:33.502 Status: LUA: Device based event fired on 'kWh Meter Vanne 3 voies_Utility', value '0.5'
    2020-05-12 23:06:33.502 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.502 Status: LUA: End event fired on kWh Meter Vanne 3 voies_Utility
    2020-05-12 23:06:33.738 Status: LUA: Device based event fired on 'Sonde SDB RDC', value '18.4;51;1'
    2020-05-12 23:06:33.740 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.740 Status: LUA: End event fired on Sonde SDB RDC
    2020-05-12 23:06:33.740 Status: LUA: Device based event fired on 'Sonde SDB RDC_Humidity', value '51.0'
    2020-05-12 23:06:33.740 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.740 Status: LUA: End event fired on Sonde SDB RDC_Humidity
    2020-05-12 23:06:33.740 Status: LUA: Device based event fired on 'Sonde SDB RDC_Dewpoint', value '8.0799055099487'
    2020-05-12 23:06:33.740 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.740 Status: LUA: End event fired on Sonde SDB RDC_Dewpoint
    2020-05-12 23:06:33.740 Status: LUA: Device based event fired on 'Sonde SDB RDC_Temperature', value '18.39999961853'
    2020-05-12 23:06:33.740 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:33.740 Status: LUA: End event fired on Sonde SDB RDC_Temperature
    2020-05-12 23:06:35.016 Status: LUA: Device based event fired on 'Conso Vanne 3 voies_Utility', value '1.2000000476837'
    2020-05-12 23:06:35.016 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:35.016 Status: LUA: End event fired on Conso Vanne 3 voies_Utility
    2020-05-12 23:06:35.016 Status: LUA: Device based event fired on 'Conso Vanne 3 voies', value '1.2'
    2020-05-12 23:06:35.016 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:35.016 Status: LUA: End event fired on Conso Vanne 3 voies
    2020-05-12 23:06:35.255 Status: LUA: Device based event fired on 'kWh Meter Vanne 3 voies', value '1.200;0.000'
    2020-05-12 23:06:35.257 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:35.257 Status: LUA: End event fired on kWh Meter Vanne 3 voies
    2020-05-12 23:06:35.257 Status: LUA: Device based event fired on 'kWh Meter Vanne 3 voies_Utility', value '1.2000000476837'
    2020-05-12 23:06:35.257 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:35.257 Status: LUA: End event fired on kWh Meter Vanne 3 voies_Utility
    2020-05-12 23:06:35.366 Status: LUA: Device based event fired on 'Sonde Salon_Temperature', value '18.200000762939'
    2020-05-12 23:06:35.366 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:35.366 Status: LUA: End event fired on Sonde Salon_Temperature
    2020-05-12 23:06:35.366 Status: LUA: Device based event fired on 'Sonde Salon_Dewpoint', value '6.3876857757568'
    2020-05-12 23:06:35.366 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:35.366 Status: LUA: End event fired on Sonde Salon_Dewpoint
    2020-05-12 23:06:35.367 Status: LUA: Device based event fired on 'Sonde Salon_Humidity', value '46.0'
    2020-05-12 23:06:35.367 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:35.367 Status: LUA: End event fired on Sonde Salon_Humidity
    2020-05-12 23:06:35.367 Status: LUA: Device based event fired on 'Sonde Salon', value '18.2;46;1'
    2020-05-12 23:06:35.367 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:35.367 Status: LUA: End event fired on Sonde Salon
    2020-05-12 23:06:35.571 Status: OpenZWave: Received timeout notification from HomeID: 3616049346, NodeID: 7 (0x07)
    2020-05-12 23:06:36.053 Status: LUA: Device based event fired on 'Conso Vanne 3 voies', value '0.2'
    2020-05-12 23:06:36.054 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:36.054 Status: LUA: End event fired on Conso Vanne 3 voies
    2020-05-12 23:06:36.054 Status: LUA: Device based event fired on 'Conso Vanne 3 voies_Utility', value '0.20000000298023'
    2020-05-12 23:06:36.054 Status: LUA: otherdevices['Nuit'] On
    2020-05-12 23:06:36.054 Status: LUA: End event fired on Conso Vanne 3 voies_Utility
Keros
Messages : 6638
Inscription : 23 juil. 2019, 20:57

Re: aide pour réalisation script en lua

Message par Keros »

Dans tout ces log, je vois nul part Nuit à off.

Fait moi ces manip svp :
  • Appui sur un device (Lumiere Terrasse par exemple)
  • appui sur Nuit
  • rappui le le premier device
  • appui sur Nuit
  • rappui le le premier device
Comment bien utiliser le forum : Poser une question, Mettre un script, un fichier, une image ou des logs
Mes petits guides : Débuter en programmation, Le débogage, Le choix de matériel, Les sauvegardes
Ma présentation - Mes Tutos
vil1driver
Messages : 5661
Inscription : 30 janv. 2015, 11:07
Localisation : Rennes (35)

Re: aide pour réalisation script en lua

Message par vil1driver »

Aurais tu dans le dossier lua un script nommé précisément comme cela

script_device_Nuit.lua

?

Si oui il intercepterait alors tout changement du device Nuit.
Le device Nuit ne déclancherait du coup que celui-ci (parmis les scripts de type device)

Mais c'est vrai qu'il est étrange que le print otherdevices ne remonte jamais Nuit à Off..

Nuit est bien unique ? Rien d'autre n'a le même nom ?
MAJ = VIDER LE CACHE(<-Clicable)
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua

Un ex domoticzien
vr6man
Messages : 627
Inscription : 18 juil. 2017, 12:15

Re: aide pour réalisation script en lua

Message par vr6man »

Non aucun script portant le nom nuit

Nuit est un interrupteur virtuel qui peu être piloté manuellement ou via une plannification

Voici les captures écran

Image

Image

En espérant que cela vous aide

Merci à tous
Keros
Messages : 6638
Inscription : 23 juil. 2019, 20:57

Re: aide pour réalisation script en lua

Message par Keros »

Tu pourrais nous mettre les log de Nuit stp ?

Tu peux vérifier que dans les dispositifs, tu n'en n'a pas deux qui s'appellent Nuit ?
Comment bien utiliser le forum : Poser une question, Mettre un script, un fichier, une image ou des logs
Mes petits guides : Débuter en programmation, Le débogage, Le choix de matériel, Les sauvegardes
Ma présentation - Mes Tutos
vr6man
Messages : 627
Inscription : 18 juil. 2017, 12:15

Re: aide pour réalisation script en lua

Message par vr6man »

voici les logs

non un seul dispositif Nuit

Image

Image
Keros
Messages : 6638
Inscription : 23 juil. 2019, 20:57

Re: aide pour réalisation script en lua

Message par Keros »

Tu nous as mis précédemment les log de 2020-05-12 23:06:31.828 à 2020-05-12 23:06:36.054

Or tu as basculer Nuit à Off le 2020-05-12 23:06:19 et à On le 2020-05-12 23:06:22

Les logs que tu nous as mis ne correspondent pas au moment où tu as fait la bascule de Nuit : c'est normal qu'on ne voit rien :roll:
Comment bien utiliser le forum : Poser une question, Mettre un script, un fichier, une image ou des logs
Mes petits guides : Débuter en programmation, Le débogage, Le choix de matériel, Les sauvegardes
Ma présentation - Mes Tutos
vr6man
Messages : 627
Inscription : 18 juil. 2017, 12:15

Re: aide pour réalisation script en lua

Message par vr6man »

Effectivement je n'avais pas fait attention

Voici le log par contre je n'ai pas plus d'historique

Image
Répondre