[Tuto] Contrôler sa freebox Révolution avec google home

Vous avez créé un script LUA dont vous êtes fier, un .sh génial, un programme Python hors du commun, un Tuto, c'est ici que vous pouvez les partager.
frenchyyii
Messages : 310
Inscription : 16 oct. 2015, 06:29

Re: Contrôler sa freebox avec google home

Message par frenchyyii »

Tu dois avoir zap $ et non zap sur $ dans ton IFTTT

De mon côté j'ai trouvé le souci, merci Loteran de m'avoir bien aiguillé avec les majuscules, c'est un souci d'espace !!!
Toutes mes variables arrivent avec un espace en trop.
Ceci dit du coup ca me pose aussi des problèmes :(

Merci

edit: fichu espace avant le text field, a force de tout bidouiller et rebidouiller ça devait arriver...
frenchyyii
Messages : 310
Inscription : 16 oct. 2015, 06:29

Re: Contrôler sa freebox avec google home

Message par frenchyyii »

Bon.... ca passe très bien avec les variables texte mais pas nombres....on va y arriver lol

ici "petit" rajout de chaines et plus adapté à ma config
Je m'arrete aux chaines à 100 car on n'a pas défini la variable centaine, et il y a deux trois chaines qui m'emmer..... et puis cest longgggggggggggggggg :mrgreen:

Code : Tout sélectionner

commandArray = {}

nom="pi"
touche=""
chaine=""
ifttt=uservariables["freebox"]
ifttt=string.lower(ifttt)

-------On/Off------------

if ifttt=="allume" or ifttt=="allume la" then
      touche="power"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
      commandArray['10seconde'] = 'On'
      
      touche="home"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
      
      touche="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
      print("allumage")
end

if string.sub(ifttt,-15)=="teins la" then
      touche="power"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

--------les autres touches-----------------

if ifttt=="coupe le son de la" then
      touche="mute"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="remets le son de la" or ifttt=="remets le son la" then
      touche="mute"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="fait pause sur la" or ifttt=="pause sur la freebox" then
      touche="play"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="fait lecture sur la" or ifttt=="fait play sur la" then
      touche="play"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="monte le son de la" or ifttt=="monte le son la" or ifttt=="augmente le son de la" then
      touche="vol_inc"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="baisse le son de la" or ifttt=="diminue le son de la" then
      touche="vol_dec"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="fait au sur la" or ifttt=="fait haut sur la" or ifttt=="fait beau sur la"then
      touche="up"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="fait bas sur la" or ifttt=="fait le bas sur la" or string.sub(ifttt,3,-1)=="ba sur la"then
      touche="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="fait droite sur la" or ifttt=="fait Le droite sur la" then
      touche="right"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="fait gauche sur la" or ifttt=="c ' est gauche sur la" then
      touche="left"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="fait ok sur la" or ifttt=="appuyez sur la touche ok de la" or ifttt=="appuyez sur ok sur la" then
      touche="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="fait retour sur la" or ifttt=="appuyez sur retour sur la" then
      touche="back"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if string.sub(ifttt,1,11)=="fait retour" and string.sub(ifttt,15,32)=="l ' accueil sur la" or string.sub(ifttt,1,6)=="retour" and string.sub(ifttt,10,-1)=="l ' accueil sur la"  then 
      touche="home"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="enregistre sur la" or ifttt=="fait enregistrer sur la" then
      touche="rec"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="appuie sur play sur la" or ifttt=="fait play sur la" or ifttt=="appuie sur play sur la" or ifttt=="fait play sur la"then
      touche="play"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="appuyez sur retour sur la" or ifttt=="fait rotor sur la" or ifttt=="fait retour sur la" or ifttt=="appuyez sur la touche rouge de la" then
      touche="red"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="appuyez sur la touche menu de la" or ifttt=="fait manu sur la" or ifttt=="fait menu sur la" or ifttt=="appuyez sur la touche verte de la" then
      touche="green"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="appuyez sur la touche recherche de la" or ifttt=="fait recherche sur la" or ifttt=="appuyez sur la touche bleu de la" then
      touche="blue"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="appuyez sur la touche info de la" or ifttt=="fait info sur la" or ifttt=="appuyez sur la touche jaune de la" then
      touche="yellow"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if ifttt=="reviens au direct sur la" or ifttt=="fait revenir au direct sur la" or ifttt=="reviens en direct sur la" or ifttt=="revenir au direct sur la" then
      touche="green"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
      commandArray['1seconde'] = 'On'
      touche="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

if string.sub(ifttt,1,4)=="la t" and string.sub(ifttt,6,6)=="l" then 
      touche="home"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
      commandArray['10seconde'] = 'On'
      
      touche="home"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
      
      touche="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_touche.sh '..touche)
end

------------------Changement des chaines---------------------
if ifttt=="le replay" then
      chaine="home"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      commandArray['10seconde'] = 'On'
      
      chaine="home"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="right"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      commandArray['3seconde'] = 'On'
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="la vo" or ifttt=="en vo" or ifttt=="la version originale" or ifttt=="en version originale" then
      chaine="green"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      commandArray['1seconde'] = 'On'
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      commandArray['1seconde'] = 'On'
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="red"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="red"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="les sous - titres" or string.sub(ifttt,1,22)=="les sous - titres fran" and string.sub(ifttt,24,-1)=="ais" then
      chaine="green"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      commandArray['1seconde'] = 'On'
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      commandArray['1seconde'] = 'On'
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="red"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="red"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,3)=="enl" and string.sub(ifttt,5,-1)=="ve les sous - titres de la" then
      chaine="green"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      commandArray['1seconde'] = 'On'
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      commandArray['1seconde'] = 'On'
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
         
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="red"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="red"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,7)=="en fran" and string.sub(ifttt,9,11)=="ais" or string.sub(ifttt,1,15)=="la version fran" and string.sub(ifttt,17,-1)=="aise" or ifttt=="la VF" or ifttt=="en VF" then 
        chaine="green"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      commandArray['1seconde'] = 'On'
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      commandArray['1seconde'] = 'On'
      
      chaine="down"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
         
      chaine="ok"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="red"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
      
      chaine="red"
      os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="chaine suivante" or ifttt=="la chaine suivante" or ifttt=="suivante" then
        chaine="prgm_inc"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,2)=="pr" and string.sub(ifttt,4,4)=="c" and string.sub(ifttt,6,-1)=="dente" or string.sub(ifttt,1,6)=="sur la chaine pr" and string.sub(ifttt,18,18)=="c" and string.sub(ifttt,20,-1)=="dente" then
        chaine="prgm_dec"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,3)=="num" and string.sub(ifttt,5,-1)=="ro 23" or string.sub(ifttt,1,3)=="sur num" and string.sub(ifttt,5,-1)=="ro 23"  or ifttt=="la 23" then
        chaine="2 3"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end


if ifttt=="tf 1" or ifttt=="la 1" or ifttt=="sur tf 1" then
        chaine="1"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="france 2" or ifttt=="la 2" or ifttt=="sur france 2"then
        chaine="2"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="france 3" or ifttt=="la 3" or ifttt=="sur france 3" then
        chaine="3"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="canal" or ifttt=="canal plus" or ifttt=="la 4" or ifttt=="sur canal plus" then
        chaine="4"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="france 5" or ifttt=="la 5" or ifttt=="sur france 5"then
        chaine="5"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="m 6" or ifttt=="la 6" or ifttt=="sur m 6"then
        chaine="6"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="arte" or ifttt=="la 7" or ifttt=="sur arte"then
        chaine="7"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="d 8" or ifttt=="c 8" or ifttt=="des 8" or ifttt=="la 8" or ifttt=="sur c 8" or ifttt=="sur d 8"then
        chaine="8"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="w9" or ifttt=="w 9" or ifttt=="la 9" or ifttt=="sur w9"then
        chaine="9"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="tmc" or ifttt=="la 10" or ifttt=="sur tmc"then
        chaine="1 0"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="nt 1" or ifttt=="la 11" or ifttt=="sur nt 1" then
        chaine="1 1"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="nrj 12" or ifttt=="la 12" or ifttt=="sur nrj 12"then
        chaine="1 2"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="lcp" or ifttt=="la 13" or ifttt=="sur lcp"then
        chaine="1 3"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="france 4" or ifttt=="la 14" or ifttt=="sur france 4"then
        chaine="1 4"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="bfm" or ifttt=="bfm tv" or ifttt=="la 15" or ifttt=="sur bfm" or ifttt=="sur bfm tv" then
        chaine="1 5"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="cnews" or ifttt=="c'est news" or ifttt=="la 16" or ifttt=="sur cnews" or ifttt=="c'est news"then
        chaine="1 6"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="cstar" or ifttt=="c'est star" or ifttt=="la 17" or ifttt=="sur cstar" or ifttt=="sur c'est star"then
        chaine="1 7"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="gulli" or ifttt=="la 18" or ifttt=="sur gulli" then
        chaine="1 8"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="france haut" or ifttt=="france O" or ifttt=="la 19" or ifttt=="sur france haut" or ifttt=="sur france outre - mer" then
        chaine="1 9"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="hd1" or ifttt=="hd 1" or ifttt=="la 20" or ifttt=="sur hd1" or ifttt=="sur hd 1"  then
        chaine="2 0"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,4)=="l ' " and string.sub(ifttt,6,-1)=="quipe" or string.sub(ifttt,1,8)=="sur l ' " and string.sub(ifttt,10,-1)=="quipe" or ifttt=="la 21" then     
      chaine="2 1"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="6 ter" or ifttt=="sister" or ifttt=="la 22" or ifttt=="sur 6 ter" or ifttt=="sister" then
        chaine="2 2"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,3)=="num" and string.sub(ifttt,5,-1)=="ro 23" or string.sub(ifttt,1,7)=="sur num" and string.sub(ifttt,9,-1)=="ro 23" or ifttt=="la 23" then
        chaine="2 3"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="rmc" or ifttt=="sur rmc" or string.sub(ifttt,1,9)=="sur RMC d" and string.sub(ifttt,11,-1)=="couverte" or string.sub(ifttt,1,9)=="sur rmc d" and string.sub(ifttt,11,-1)=="couverte" or ifttt=="la 24" then
        chaine="2 4"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,2)=="ch" and string.sub(ifttt,4,-1)=="rie 25" or string.sub(ifttt,1,6)=="sur ch" and string.sub(ifttt,8,-1)=="rie 25" or ifttt=="la 25" then
        chaine="2 5"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
	end
	
if ifttt=="lci" or ifttt=="sur lci" or ifttt=="la 26" then
        chaine="2 6"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="france info" or ifttt=="sur france info" or ifttt=="la 27" then
        chaine="2 7"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="paris" or ifttt=="sur paris" or string.sub(ifttt,1,15)=="sur paris premi" and string.sub(ifttt,17,-1)=="re"  or ifttt=="la 28" then
        chaine="2 8"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="rtl 9" or ifttt=="sur rtl 9" or ifttt=="la 29" then
        chaine="2 9"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="eurosport" or ifttt=="sur eurosport" or ifttt=="la 34" then
        chaine="3 4"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="eurosport 2" or ifttt=="sur eurosport 2" or ifttt=="la 35" then
        chaine="3 5"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="cuve ici" or ifttt=="sur cuve ici" or ifttt=="la 36" then
        chaine="3 6"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="game one" or ifttt=="sur game one" or ifttt=="la 37" then
        chaine="3 7"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,1)=="t" and string.sub(ifttt,3,-1)=="va" or string.sub(ifttt,1,5)=="sur t" and string.sub(ifttt,7,-1)=="va" or ifttt=="la 38" then
        chaine="3 8"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="ab 1" or ifttt=="sur ab 1" or ifttt=="la 39" then
        chaine="3 9"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,9)=="canal cin" and string.sub(ifttt,11,-1)=="ma" or string.sub(ifttt,1,13)=="sur canal cin" and string.sub(ifttt,15,-1)=="ma" or ifttt=="la 42" then
        chaine="4 2"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="canal sport" or ifttt=="sur canal sport" or ifttt=="la 43" then
        chaine="4 3 "
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,7)=="canal s" and string.sub(ifttt,9,-1)=="rie" or string.sub(ifttt,1,11)=="sur canal s" and string.sub(ifttt,13,-1)=="ries" or ifttt=="la 44" then
        chaine="4 4"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="canal family" or ifttt=="sur canal family" or ifttt=="la 45" then
        chaine="4 5 "
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,7)=="canal d" and string.sub(ifttt,9,-1)=="cal" and string.sub(ifttt,11,-1)==" " or string.sub(ifttt,1,11)=="sur canal d" and string.sub(ifttt,13,-1)=="cal" or ifttt=="la 46" then
        chaine="4 6"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="disney channel" or ifttt=="sur disney channel" or ifttt=="la 48" then
        chaine="4 8 "
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="disney channel 1" or ifttt=="disney channel plus 1" or ifttt=="sur disney channel 1" or ifttt=="sur disney channel plus 1" or ifttt=="la 49" then
        chaine="4 9 "
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,10)=="disney cin" and string.sub(ifttt,12,-1)=="ma" or string.sub(ifttt,1,14)=="sur disney cin" and string.sub(ifttt,16,-1)=="ma" or ifttt=="la 50" then
        chaine="5 0"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,3)=="cin" and string.sub(ifttt,6,-1)==" premier" or string.sub(ifttt,1,14)=="sur disney cin" and string.sub(ifttt,16,-1)=="ma" or ifttt=="la 51" then
        chaine="5 1"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="ocs max" or ifttt=="sur ocs max" or ifttt=="la 52" then
        chaine="5 2 "
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="ocs city" or ifttt=="sur ocs city" or ifttt=="la 53" then
        chaine="5 3 "
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="ocs choc" or ifttt=="sur ocs choc" or ifttt=="la 54" then
        chaine="5 4 "
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,5)=="ocs g" and string.sub(ifttt,7,-1)==" ants" or string.sub(ifttt,1,9)=="sur ocs g" and string.sub(ifttt,11,-1)=="ants" or ifttt=="la 55" then
        chaine="5 5"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="action" or ifttt=="sur action" or ifttt=="la 56" then
        chaine="5 6 "
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,7)=="tcm cin" and string.sub(ifttt,9,-1)=="ma" or string.sub(ifttt,1,11)=="sur tcm cin" and string.sub(ifttt,13,-1)=="ma" or ifttt=="la 57" then
        chaine="5 7"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="paramount channel" or ifttt=="sur paramount channel" or ifttt=="la 58" then
        chaine="5 8 "
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if string.sub(ifttt,1,4)=="plan" and string.sub(ifttt,6,-1)=="te" or string.sub(ifttt,1,8)=="sur plan" and string.sub(ifttt,10,-1)=="te" or string.sub(ifttt,1,4)=="plan" and string.sub(ifttt,6,-1)=="te plus" or string.sub(ifttt,1,8)=="sur plan" and string.sub(ifttt,10,-1)=="te plus" or ifttt=="planet" or ifttt=="sur planet" or ifttt=="planet plus" or ifttt=="sur planet plus" or ifttt=="la 59" then
        chaine="5 9"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end
		
if ifttt=="national geographic" or ifttt=="sur national geographic" or ifttt=="la 60" then
        chaine="6 0"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end
		
if ifttt=="national geographic wild" or ifttt=="sur national geographic wild" or ifttt=="la 61" then
        chaine="6 1"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end
	
if ifttt=="voyage" or ifttt=="sur voyage" or ifttt=="la 62" then
        chaine="6 2"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="novelas" or ifttt=="sur novelas" or ifttt=="la 63" then
        chaine="6 3"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="vivolta" or ifttt=="sur vivolta" or ifttt=="la 69" then
        chaine="6 9"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end
	
if ifttt=="tv 5 monde" or ifttt=="sur tv 5 monde" or ifttt=="la 70" then
        chaine="7 0"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end	
	
if ifttt=="tv breizh" or ifttt=="sur tv breizh" or ifttt=="tv bryce" or ifttt=="sur tv bryce" or ifttt=="sur tv braise" or ifttt=="sur tv braise" or ifttt=="la 71" then
        chaine="7 1"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end	

if string.sub(ifttt,1,3)=="com" and string.sub(ifttt,5,-1)=="die" or string.sub(ifttt,1,7)=="sur com" and string.sub(ifttt,9,-1)=="die" or ifttt=="la 80" then
        chaine="8 0"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="polar plus" or ifttt=="sur polar plus" or ifttt=="la 81" then
        chaine="8 1"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end	
	
if ifttt=="warner tv" or ifttt=="sur warner tv" or ifttt=="la 82" then
        chaine="8 2"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end	

if string.sub(ifttt,1,1)=="s" and string.sub(ifttt,3,-1)=="rie" or string.sub(ifttt,1,5)=="sur s" and string.sub(ifttt,7,-1)=="rie" or string.sub(ifttt,1,1)=="s" and string.sub(ifttt,3,-1)=="rie club" or string.sub(ifttt,1,5)=="sur s" and string.sub(ifttt,7,-1)=="rie club" or ifttt=="siri" or ifttt=="sur siri" or ifttt=="la 83" then
        chaine="8 3"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end

if ifttt=="mtv" or ifttt=="sur mtv" or ifttt=="m tv" or ifttt=="sur m tv" or ifttt=="la 84" then
        chaine="8 4"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end		
	
if ifttt=="elle girl" or ifttt=="sur elle girl" or ifttt=="la 85" then
        chaine="8 5"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end		

if ifttt=="non - stop people" or ifttt=="sur non - stop people" or ifttt=="la 86" then
        chaine="8 6"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end	

if ifttt=="mcm" or ifttt=="sur mcm" or ifttt=="la 87" then
        chaine="8 7"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end			
	
if ifttt=="j one" or ifttt=="sur j one" or ifttt=="la 88" then
        chaine="8 8"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end		
	
if ifttt=="game one version plus 1" or ifttt=="sur game one version plus 1" or ifttt=="Game One version plus" or ifttt=="sur Game One version plus" or ifttt=="la 89" then
        chaine="8 9"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end		
	
if ifttt=="manga" or ifttt=="sur manga" or ifttt=="la 90" then
        chaine="9 0"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end		
	
if ifttt=="bet" or ifttt=="sur manga" or ifttt=="la 91" then
        chaine="9 1"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end		
	
if ifttt=="enorme tv" or ifttt=="sur enorme tv" or ifttt=="la 92" then
        chaine="9 2"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end		
			
if ifttt=="nolife" or ifttt=="sur nolife" or ifttt=="la 93" then
        chaine="9 3"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end	
	
if ifttt=="gong" or ifttt=="sur gong" or ifttt=="sur gang"or ifttt=="sur gang" or ifttt=="la 94" then
        chaine="9 4"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end		
	
if ifttt=="ginx" or ifttt=="sur ginx" or ifttt=="gyms"or ifttt=="sur gyms" or ifttt=="la 97" then
        chaine="9 7"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end		

if ifttt=="viceland" or ifttt=="sur viceland" or ifttt=="vin islande"or ifttt=="sur vin islande" or ifttt=="weissland" or ifttt=="sur weissland" or ifttt=="la 98" then
        chaine="9 8"
        os.execute('/home/'..nom..'/domoticz/scripts/chg_chaine.sh '..chaine)
end		
	
if chaine~="" then
print ("ok, je zappe sur "..chaine)
end

if touche~="" then
print ("ok, j'appuie sur "..touche)
end

if chaine=="" and touche=="" then
print("la valeur de la variable ifttt contenant '"..ifttt.."', n'est pas reconnu par le script, il faut l'ajouter")
end

return commandArray

loteran
Messages : 59
Inscription : 29 oct. 2017, 18:59

Re: Contrôler sa freebox avec google home

Message par loteran »

frenchyyii a écrit :Tu dois avoir zap $ et non zap sur $ dans ton IFTTT

De mon côté j'ai trouvé le souci, merci Loteran de m'avoir bien aiguillé avec les majuscules, c'est un souci d'espace !!!
Toutes mes variables arrivent avec un espace en trop.
Ceci dit du coup ca me pose aussi des problèmes :(

Merci

edit: fichu espace avant le text field, a force de tout bidouiller et rebidouiller ça devait arriver...
oui il met un espace automatiquement pour textfield ;)

Les mots que j'utilise sont :
-fait $ sur la freebox
-mets $
-mets la #

Edit de mon premier post, ajout de la variable centaine dans le fichier chg_chaine.sh et modification du fichier script_variable_freebox.lua, je me suis arreté à 24 :)
donc maintenant pour donner un numéro de chaine il faut 3 chiffres du type "0 0 1" pour tf1
frenchyyii
Messages : 310
Inscription : 16 oct. 2015, 06:29

Re: Contrôler sa freebox avec google home

Message par frenchyyii »

Le souci avec "mets" et "mets la" c'est qu'il cherche à lancer une vidéo ou une musique parfois, voire même modifier une lumière.
Perso j'ai passé

Code : Tout sélectionner

 zap sur $
et

Code : Tout sélectionner

zap $

Code : Tout sélectionner

zap sur la chaine $
Je ne sais pas si tu as vu mais dans mon code il y a les chaines si tu veux adapter ou si les autres veulent.
Il y'a du temps à gagner.

Merci
loteran
Messages : 59
Inscription : 29 oct. 2017, 18:59

Re: Contrôler sa freebox avec google home

Message par loteran »

frenchyyii a écrit :Le souci avec "mets" et "mets la" c'est qu'il cherche à lancer une vidéo ou une musique parfois, voire même modifier une lumière.
Perso j'ai passé

Code : Tout sélectionner

 zap sur $
et

Code : Tout sélectionner

zap $

Code : Tout sélectionner

zap sur la chaine $
Je ne sais pas si tu as vu mais dans mon code il y a les chaines si tu veux adapter ou si les autres veulent.
Il y'a du temps à gagner.

Merci
Je n'ai pas se soucis la, en tout cas pour le moment, je note et j'adapterai au besoin, pour les chaines oui j'ai vu ça, c'est pour ça que je t'ai rajouté la variable centaine, tu avais l'air motivé de rentrer les autres chaines :)

J'ai mis à jour le code du premier post, tu devrais le récupérer car j'ai fait en sorte que si la valeur d'ifttt est vide, le script s'arette, car cela pose probleme si l'on a d'autre variable globale, comme "freebox" qui se mette à jour, le script freebox se lance en boucle, donc cela permet d'en sortir.
frenchyyii
Messages : 310
Inscription : 16 oct. 2015, 06:29

Re: Contrôler sa freebox avec google home

Message par frenchyyii »

Ca marche merci ;)
loteran
Messages : 59
Inscription : 29 oct. 2017, 18:59

Re: Contrôler sa freebox avec google home

Message par loteran »

ATTENTION,

Ajout de deux variables dans le script script_variables_freebox.lua

IP et PORT
58djarviss
Messages : 16
Inscription : 28 déc. 2016, 18:59

Re: Contrôler sa freebox avec google home

Message par 58djarviss »

Salut,

Merci beaucoup pour ce script. J'ai eu aussi le problème d'espace sur IFTTT. Par contre je m'interroge sur la phrase à insérer dans IFTTT. On est bien d'accord que la variable qui est récupérée est celle qui est contenue dans {{TextField}} ou dans {{NumberField}}, donc logiquement tout le blabla avant ou après n'est pas envoyé dans la variable.

Dans le script, la variable est récupérée dans la constante ifttt. OK jusque là. Ensuite, pour l'allumage / extinction de la freebox, la constante qui va déclencher l'action contient aussi du texte qui n'est pas récupéré dans la variable (je sais pas si c'est bien clair tout çà).

En clair :

la variable "freebox" contient "allume la" :

if ifttt=="allume" or ifttt=="allume la" then

Et dans IFTTT j'ai "OK Google, mets la $"

Mais Domoticz récupère uniquement {{TextField}}. Donc ca veut dire que dans IFTTT je dois dire "Ok Google mets la allume la freebox (j'ai souligné ce qui correspond à $ et le reste au blabla

J'ai du loupé un truc avec IFTTT je pense :D

Merci
loteran
Messages : 59
Inscription : 29 oct. 2017, 18:59

Re: Contrôler sa freebox avec google home

Message par loteran »

58djarviss a écrit :Salut,

Merci beaucoup pour ce script. J'ai eu aussi le problème d'espace sur IFTTT. Par contre je m'interroge sur la phrase à insérer dans IFTTT. On est bien d'accord que la variable qui est récupérée est celle qui est contenue dans {{TextField}} ou dans {{NumberField}}, donc logiquement tout le blabla avant ou après n'est pas envoyé dans la variable.

Dans le script, la variable est récupérée dans la constante ifttt. OK jusque là. Ensuite, pour l'allumage / extinction de la freebox, la constante qui va déclencher l'action contient aussi du texte qui n'est pas récupéré dans la variable (je sais pas si c'est bien clair tout çà).

En clair :

la variable "freebox" contient "allume la" :

if ifttt=="allume" or ifttt=="allume la" then

Et dans IFTTT j'ai "OK Google, mets la $"

Mais Domoticz récupère uniquement {{TextField}}. Donc ca veut dire que dans IFTTT je dois dire "Ok Google mets la allume la freebox (j'ai souligné ce qui correspond à $ et le reste au blabla

J'ai du loupé un truc avec IFTTT je pense :D

Merci
Salut,

dans une certains sens tu as raison, mais il y a un bug visiblement, car pour allume et éteins la freebox, je n'ai pas eu besoin de faire d'autres applets ifttt, bizarrement avec la combinaison des 3 applets que j'ai mis en place (si les 3 n'y sont pas ca ne fonctionne pas ), lorsque je dis "allume la freebox", c'est l'applet "fait $ sur la freebox" qui se déclanche et renvoi la valeur : "allume la freebox".

En revanche si cela ne fonctionne pas, j'ai l'impression que tu as fait une erreur sur tes applets, il ne faut pas écrire "OK, google met/fait la $" mais "mets la $" ou "fait $ sur la freebox", le ok google ne doit pas y figurer car c'est le "hot word" mot d''éclancheur qui permet de vérifier les applets existant et d'en déclancher un avec le reste de la phrase.

En revanche je suis d'accord avec toi, cela est surprennant que ca fonctionne, cela ne devrait pas, je devrais ajouter un applet, mais si cela ne fonctionne pas pour toi, ajoute un applet.

Tiens moi au jus de ton avancée.
loteran
Messages : 59
Inscription : 29 oct. 2017, 18:59

Re: Contrôler sa freebox avec google home

Message par loteran »

Petite modification du script, changement de la dernière ligne os.execute.... par commandArray['Variable:freebox']=''..raz, cela evite d'avoir le script qui tourne plus de 10s, de cette façons c'est instantané.

J'ai fait un nouveau script ayant les même fonction mais plus leger et plus facile à gérer, mais pour le moment, quelque chose bloque dans les rouages... je vous le donne dès que je parviens à le faire tourner.
Répondre