Appel d'un script Python à partir d'un script LUA

Vous utilisez Windows © pour votre domotique avec Domoticz, ca ne fait rien on vous aime bien quand même. Ce forum est pour vous.
boabroth
Messages : 5
Inscription : 28 oct. 2017, 12:29

Appel d'un script Python à partir d'un script LUA

Message par boabroth »

Bonsoir,

J’aimerai savoir comment on fait pour lancer à partir d’un script LUA, un script Python ?

J’arrive bien à lancer mon script python depuis l' »Action On » et l' »Action Off » d’un interrupteur : « script://scripts\python/play.py scripts\python/lightDining_On.txt » mais impossible depuis un script LUA.
J'ai essayé plein de choses avec la commande "os.execute" mais en vain.

Merci
gawel3164
Messages : 325
Inscription : 07 janv. 2016, 19:51

Re: Appel d'un script Python à partir d'un script LUA

Message par gawel3164 »

Salut,
Depuis un script LUA, il faut écrire:

Code : Tout sélectionner

os.execute('sudo /home/pi/domoticz/scripts/python/script_chauffage.py')
Mais auparavant il faut mettre des autorisations sur le script:
cd /home/pi/domoticz/scripts/python
chmod 777 script_chauffage.py (ou chmod +x je ne sais pas...les puristes du site pourront trancher! :lol: )
Domoticz 2022.1/RFlink V1.1_R48/ prises: DIO, SCS/caméras IP/station météo Auriol/sondes Oregon/PIR/ZK1PA/Relevé compteur Gaz/téléinfo EDF/Mysensors:RGB-3D,Temp.,IR/Arrosage autonome/Google home/ ESP: IR,Temp.,relai,distance,OLED/Withings Ws30
boabroth
Messages : 5
Inscription : 28 oct. 2017, 12:29

Re: Appel d'un script Python à partir d'un script LUA

Message par boabroth »

Salut,

Merci pour cette réponse mais je suis sous Windows...
boabroth
Messages : 5
Inscription : 28 oct. 2017, 12:29

Re: Appel d'un script Python à partir d'un script LUA

Message par boabroth »

Pour ceux que ça intéresse, j'ai fini par arriver à le faire.
Voici un exemple d'appel d'un script python avec 1 paramètre :

Code : Tout sélectionner

	os.execute('start cmd /c C:/Python27/python.exe "C:/Program Files (x86)/Domoticz/scripts/python/play.py" "C:/Program Files (x86)/Domoticz/scripts/python/lightDining_On.txt"')
harada57
Messages : 3
Inscription : 24 déc. 2017, 06:30

Re: Appel d'un script Python à partir d'un script LUA

Message par harada57 »

je ferai un tutoriel pour les gros nuls comme moi afin qu'on puisse s'en sortir plus facilement.


gclub
Dernière modification par harada57 le 23 mars 2018, 06:06, modifié 1 fois.
stephdes
Messages : 285
Inscription : 06 oct. 2016, 20:50

Re: Appel d'un script Python à partir d'un script LUA

Message par stephdes »

Merci !

Je vais peut être me repencher sur le reboot quotidien de ma freebox via script... ça va sans doute m'aider ;)
MiniPC W10 + RFXCom 433e + RFLINK
Elec : Téléinfo
Alexa + Alhau
MQTT...
(merci easydomoticz !)
landaisbenj
Messages : 695
Inscription : 12 mars 2017, 19:24

Re: Appel d'un script Python à partir d'un script LUA

Message par landaisbenj »

Pour info j'ai trouver une méthode pour rebooter la freebox par script lua.

J'ai fais le script il suffit de t'appuyer sur l'api de reboot du site des dev freebox.

Et si vous vous y connaissait en python ce serait bien de faire un plugin materiel pour la freebox. En voyant arriver la V7 bientôt il y a de très grandes chance qu'elle fasse de la domoticz et s'appuie sur l'api json...

Du coup il serait simple de faire un materiel freebox. J'ai l'idée mais je ne sais pas la développer...
Rpbi3b: Domoticz + Homebridge + Monit + Freebox scripts + Shellinabox; Rpbi2: Jarvis
Domoticz: Derniere stable; RFLINK: Dernière stable; Xiaomi Gateway
Répondre