Ce tuto est fait pour la freebox révolution.
Je vais faire un nouveau post pour la Mini 4k, j'ai enfin trouver mon bonheur pour le faire
Edit du post : 30/11/2017
Modif de mon post avec modification du script permettant d'utiliser également les touches et possibilité de choisir /home/pi ou autre avec une variable et les accents sont maintenant supportés.
Pour ceux qui ne parvienne pas à controler leur freebox avec google home et domoticz.
Voici un petit tuto pour changer de chaines, je rajouterais les autres fonctions ensuite.
J'utilise IFTTT pour envoyer les commandes vocale en Json.
Donc inscrivez vous sur le site avec votre compte google.
Ensuite il faut créer une "applets", sorte d'appli pour vos commandes vocales (et autres), donc on clique sur MyApplets et sur la droite on clique sur New applet (à droite), on arrive alors sur une page ressemblant à celle-ci
Cliquez sur "+ this" (en bleu)
une barre de recherche apparait, vous tapez "google assistant", une fois l'icone de google assistant apparue, cliquez dessus
Sur cet écran on vous demande de choisir un "trigger" (ce qui va déclancher google home), pour mon tuto il en faudra 2,
- "say a phrase with a number"
- "say a phrase with a text ingredient"
Pourquoi 2 ? simplement pour pouvoir demander de zapper sur la 24 ou zapper sur RMC, l'un est considéré comme un chiffre (booléen) et le second comme une phrase (string)
Commencons par celui avec le chiffre, on clique sur "say a phrase with a number"
un formulaire apparait :
case : What do you want to say
Dans cette case on indique ce que l'on dira à google home pour déclancher l'action, on peut mettre pratiquement ce que l'on veut mais certains mots sont réservé comme "chaine" donc attention, moi j'utilise (sans les guillemets : "mets la #" (le # est très important car il remplace le chiffre que vous allez dire (on va pas faire un applet par chaine
Les deux cases suivantes permettent de mettre d'autre variantes de votre phrase, exemple zappe sur la # (on oubli pas le #)
Case what do you want the assistant to say in response
on indique ce que dira google lorsqu'il entendra la commande, j'ai mis : ok, je zappe sur la # (google va repeter le chiffre de votre chaine grace au #)
language, choisir french et cliquer sur create trigger.
La page de tout à l'heure, reviens, enfin c'est pas tout à fait la même, car le +this de tout à l'heure c'est transformé en icone google assistant.
Cliquez sur +That, action que doit faire google quand il entend mets la #
nouvelle page, choose action service.
Dans la barre de recherche, rechercher webhooks et cliquer dessus, une case bleue apparait "make a web request", cliquer dessus.
Première case URL :
c'est ici que l'on va mettre la commande json, ne pas utiliser l'adresse ip local, cela ne fonctionne pas, si vous n'avez pas d'ip statique, il faut créer une adresse sur un DNS, je vous laisse regarder sur le net.
Notre commande va permettre de renseigner une variable sur domoticz (afin de récupérer le numéro de la chaine)
Code : Tout sélectionner
http://IP:PORT/json.htm?type=command¶m=updateuservariable&id=1&vname=freebox&vtype=2&vvalue=<<<{{NumberField}}>>>vname=freebox --> le nom de la variable (ne pas le modifier si vous ne savez pas ce que vous faites)
Type=2 pour indiquer le type de variable 1 pour les chiffres et 2 pour les phrases (oui j'utilise 2, ca me facilite mes scripts)
value={{NumberField}} la valeur que l'on va donner à la variable (le chiffre de la chaine que l'on viens de demander à google)
Case Method : GET
les autres cases, on s'en fiche.
cliquez sur Save et voilà.
On passe au second, c'est la même chose mais on va choisir l'applet say a phrase with a text ingredient.
on clique sur +this et on recherche google assistant.
premier écran, on remet la même chose que tout à l'heure mais on remplace le # par un $ (# pour les chiffres, $ pour les mots)
on clique sur create a trigger.
on clique sur +That, on recherche webhooks, on clique sur la case bleue.
Dans URL on remet la même chose, mais on remplace {{NumberField}} par {{TextField}} :
Code : Tout sélectionner
http://IP:PORT/json.htm?type=command¶m=updateuservariable&id=1&vname=freebox&vtype=2&vvalue=<<<{{TextField}}>>>On sauvegarde.
Voilà terminé pour IFTTT.
Du côté de domoticz maintenant :
on va créer la variable qui permet de recevoir le chiffre ou la phrase que vous avez demandez à google pour changer de chaine
Cliquez sur Réglages | plus d'options | variables utilisateur
Dans le champ Nom de la variable, mettre : freebox
Type de variable : Chaîne
cliquer sur Ajouter, votre variable apparait dans le tableau du dessus. (on y est presque)
Voilà tout est prêt, ne reste plus qu'à ajouter le script.
J'ai fait un script lua (optimisable surement, je ne suis pas dev
sur votre RPI ou pc où se trouve votre serveur domoticz, allez dans le répertoire /domoticz/scripts/lua
Code : Tout sélectionner
cd ~/domoticz/scripts/lua
Code : Tout sélectionner
Sudo nano script_variable_freebox.luaEt à l'intérieur de celui-ci, coller le code ci-dessous :
Edit : Script du 09/11
Modifier en fonction de votre systeme la variable "user" en remplaçant "pi" par autre chose, qui correspond au répertoire après /home/
ON NE TOUCHE PAS AUX AUTRES ! (sauf si vous savez ce que vous faites;))
Code : Tout sélectionner
commandArray = {}
user="pi"
ifttt=uservariables["freebox"]
ifttt=string.lower(ifttt)
print("valeur d'ifttt au début du script : "..ifttt)
if ifttt=="vide" or ifttt== nil then
print("sortie du script")
return commandArray
else
print("lancement du script freebox.sh avec ifttt = "..ifttt)
os.execute('/home/'..user..'/domoticz/scripts/freebox.sh '..ifttt)
end
raz="vide"
commandArray['Variable:freebox']=''..raz
return commandArray
Ensuite on va créer un script intermédiaire entre script_variable_freebox.lua et chg_chaine.sh ou chg_touche.sh (ceci afin d'avoir un script lua léger et un script sh facile à modifié, contrairement à ma première version.
Donc dans le répertoire ~/domoticz/script, on créer le fichier freebox.sh
On modifie si besoin comme tout à l'heure la variable user
Code : Tout sélectionner
#!/bin/bash
#freebox.sh
#########################declaration des variables#################################
user="pi"
ifttt="" #remise à zéro d'ifttt
chaine="sh /home/$user/domoticz/scripts/chg_chaine.sh"
touche="sh /home/$user/domoticz/scripts/chg_touche.sh"
########################Recuperation de la valeur d'ifttt##########################
case $# in
1) ifttt="$1";;
2) ifttt="$1 $2";;
3) ifttt="$1 $2 $3";;
4) ifttt="$1 $2 $3 $4";;
5) ifttt="$1 $2 $3 $4 $5";;
6) ifttt="$1 $2 $3 $4 $5 $6";;
7) ifttt="$1 $2 $3 $4 $5 $6 $7";;
8) ifttt="$1 $2 $3 $4 $5 $6 $7 $8";;
9) ifttt="$1 $2 $3 $4 $5 $6 $7 $8 $9";;
esac
case "$ifttt" in
######################################Appuie sur une touche######################################################
"allume la") $touche power_on;;
"éteins la") $touche power_off;;
"augmente le son de la") $touche vol_inc;;
"baisse le son de la") $touche vol_dec;;
"appuyez sur ok sur la") $touche ok;;
"en vf") $touche VF;;
"en vo") $touche VO;;
"en version originale") $touche VO;;
"les sous - titres") $touche sub;;
"pas de sous - titres") $touche no_sub;;
"suivante") $touche program_up;;
"précédente") $touche program_down;;
"le replay") $touche replay;;
"le direct") $touche live;;
"coupe le son de la") $touche mute;;
"remets le son de la") $touche mute;;
"fait une pause sur la") $touche play;;
"remets lecture sur la") $touche play;;
"lecture sur la freebox") $touche play;;
"appuie sur haut sur la") $touche up;;
"appuie sur bas sur la") $touche down;;
"appuie sur droite sur la") $touche right;;
"appuie sur gauche sur la") $touche left;;
"appuie sur retour sur la") $touche back;;
"appuie sur ok sur la") $touche ok;;
"appuie sur accueil sur la") $touche home;;
"enregistre la") $touche rec;;
"appuie sur la touche verte de la") $touche green;;
"appuie sur la touche menu de la") $touche green;;
"appuie sur la touche bleu de la") $touche blue;;
"appuie sur la touche recherche de la") $touche blue;;
"appuie sur la touche rouge de la") $touche red;;
"appuie sur la touche retour de la") $touche red;;
"appuie sur la touche jaune de la") $touche yellow;;
"appuie sur la touche info de la") $touche yellow;;
######################################Changement de chaines######################################################
# Par nom de chaine
"tf 1") $chaine 0 0 1;;
"france 2") $chaine 0 0 2;;
"france 3") $chaine 0 0 3;;
"canal plus") $chaine 0 0 4;;
"france 5") $chaine 0 0 5;;
"m 6") $chaine 0 0 6;;
"arte") $chaine 0 0 7;;
"c 8") $chaine 0 0 8;;
"w 9") $chaine 0 0 9;;
"tmc") $chaine 0 1 0;;
"nt1") $chaine 0 1 1;;
"nrj 12") $chaine 0 1 2;;
"lcp") $chaine 0 1 3;;
"france 4") $chaine 0 1 4;;
"bfm") $chaine 0 1 5;;
"cnews") $chaine 0 1 6;;
"cstar") $chaine 0 1 7;;
"gulli") $chaine 0 1 8;;
"france haut") $chaine 0 1 9;;
"hd 1") $chaine 0 2 0;;
"l ' équipe") $chaine 0 2 1;;
"6 ter") $chaine 0 2 2;;
"numro 23") $chaine 0 2 3;;
"rmc") $chaine 0 2 4;;
# Par numéro de chaine
"la 1") $chaine 0 0 1;;
"la 2") $chaine 0 0 2;;
"la 3") $chaine 0 0 3;;
"la 4") $chaine 0 0 4;;
"la 5") $chaine 0 0 5;;
"la 6") $chaine 0 0 6;;
"la 7") $chaine 0 0 7;;
"la 8") $chaine 0 0 8;;
"la 9") $chaine 0 0 9;;
"la 10") $chaine 0 1 0;;
"la 11") $chaine 0 1 1;;
"la 12") $chaine 0 1 2;;
"la 13") $chaine 0 1 3;;
"la 14") $chaine 0 1 4;;
"la 15") $chaine 0 1 5;;
"la 16") $chaine 0 1 6;;
"la 17") $chaine 0 1 7;;
"la 18") $chaine 0 1 8;;
"la 19") $chaine 0 1 9;;
"la 20") $chaine 0 2 0;;
"la 21") $chaine 0 2 1;;
"la 22") $chaine 0 2 2;;
"la 23") $chaine 0 2 3;;
"la 24") $chaine 0 2 4;;
"la 25") $chaine 0 2 5;;
"la 26") $chaine 0 2 6;;
"la 27") $chaine 0 2 7;;
"la 28") $chaine 0 2 8;;
"la 29") $chaine 0 2 9;;
"la 30") $chaine 0 3 0;;
"la 31") $chaine 0 3 1;;
"la 32") $chaine 0 3 2;;
"la 33") $chaine 0 3 3;;
"la 34") $chaine 0 3 4;;
"la 35") $chaine 0 3 5;;
"la 36") $chaine 0 3 6;;
"la 37") $chaine 0 3 7;;
"la 38") $chaine 0 3 8;;
"la 39") $chaine 0 3 9;;
"la 40") $chaine 0 4 0;;
"la 41") $chaine 0 4 1;;
"la 42") $chaine 0 4 2;;
"la 43") $chaine 0 4 3;;
"la 44") $chaine 0 4 4;;
"la 45") $chaine 0 4 5;;
"la 46") $chaine 0 4 6;;
"la 47") $chaine 0 4 7;;
"la 48") $chaine 0 4 8;;
"la 49") $chaine 0 4 9;;
"la 50") $chaine 0 5 0;;
"la 51") $chaine 0 5 1;;
"la 52") $chaine 0 5 2;;
"la 53") $chaine 0 5 3;;
"la 54") $chaine 0 5 4;;
"la 55") $chaine 0 5 5;;
"la 56") $chaine 0 5 6;;
"la 57") $chaine 0 5 7;;
"la 58") $chaine 0 5 8;;
"la 59") $chaine 0 5 9;;
"la 60") $chaine 0 6 0;;
"la 61") $chaine 0 6 1;;
"la 62") $chaine 0 6 2;;
"la 63") $chaine 0 6 3;;
"la 64") $chaine 0 6 4;;
"la 65") $chaine 0 6 5;;
"la 66") $chaine 0 6 6;;
"la 67") $chaine 0 6 7;;
"la 68") $chaine 0 6 8;;
"la 69") $chaine 0 6 9;;
"la 70") $chaine 0 7 0;;
"la 71") $chaine 0 7 1;;
"la 72") $chaine 0 7 2;;
"la 73") $chaine 0 7 3;;
"la 74") $chaine 0 7 4;;
"la 75") $chaine 0 7 5;;
"la 76") $chaine 0 7 6;;
"la 77") $chaine 0 7 7;;
"la 78") $chaine 0 7 8;;
"la 79") $chaine 0 7 9;;
"la 80") $chaine 0 8 0;;
"la 81") $chaine 0 8 1;;
"la 82") $chaine 0 8 2;;
"la 83") $chaine 0 8 3;;
"la 84") $chaine 0 8 4;;
"la 85") $chaine 0 8 5;;
"la 86") $chaine 0 8 6;;
"la 87") $chaine 0 8 7;;
"la 88") $chaine 0 8 8;;
"la 89") $chaine 0 8 9;;
"la 90") $chaine 0 9 0;;
"la 91") $chaine 0 9 1;;
"la 92") $chaine 0 9 2;;
"la 93") $chaine 0 9 3;;
"la 94") $chaine 0 9 4;;
"la 95") $chaine 0 9 5;;
"la 96") $chaine 0 9 6;;
"la 97") $chaine 0 9 7;;
"la 98") $chaine 0 9 8;;
"la 99") $chaine 0 9 9;;
"la 100") $chaine 1 0 0;;
"la 101") $chaine 1 0 1;;
"la 102") $chaine 1 0 2;;
"la 103") $chaine 1 0 3;;
"la 104") $chaine 1 0 4;;
"la 105") $chaine 1 0 5;;
"la 106") $chaine 1 0 6;;
"la 107") $chaine 1 0 7;;
"la 108") $chaine 1 0 8;;
"la 109") $chaine 1 0 9;;
"la 110") $chaine 1 1 0;;
"la 111") $chaine 1 1 1;;
"la 112") $chaine 1 1 2;;
"la 113") $chaine 1 1 3;;
"la 114") $chaine 1 1 4;;
"la 115") $chaine 1 1 5;;
"la 116") $chaine 1 1 6;;
"la 117") $chaine 1 1 7;;
"la 118") $chaine 1 1 8;;
"la 119") $chaine 1 1 9;;
"la 120") $chaine 1 2 0;;
"la 121") $chaine 1 2 1;;
"la 122") $chaine 1 2 2;;
"la 123") $chaine 1 2 3;;
"la 124") $chaine 1 2 4;;
"la 125") $chaine 1 2 5;;
"la 126") $chaine 1 2 6;;
"la 127") $chaine 1 2 7;;
"la 128") $chaine 1 2 8;;
"la 129") $chaine 1 2 9;;
"la 130") $chaine 1 3 0;;
"la 131") $chaine 1 3 1;;
"la 132") $chaine 1 3 2;;
"la 133") $chaine 1 3 3;;
"la 134") $chaine 1 3 4;;
"la 135") $chaine 1 3 5;;
"la 136") $chaine 1 3 6;;
"la 137") $chaine 1 3 7;;
"la 138") $chaine 1 3 8;;
"la 139") $chaine 1 3 9;;
"la 140") $chaine 1 4 0;;
"la 141") $chaine 1 4 1;;
"la 142") $chaine 1 4 2;;
"la 143") $chaine 1 4 3;;
"la 144") $chaine 1 4 4;;
"la 145") $chaine 1 4 5;;
"la 146") $chaine 1 4 6;;
"la 147") $chaine 1 4 7;;
"la 148") $chaine 1 4 8;;
"la 149") $chaine 1 4 9;;
"la 150") $chaine 1 5 0;;
"la 151") $chaine 1 5 1;;
"la 152") $chaine 1 5 2;;
"la 153") $chaine 1 5 3;;
"la 154") $chaine 1 5 4;;
"la 155") $chaine 1 5 5;;
"la 156") $chaine 1 5 6;;
"la 157") $chaine 1 5 7;;
"la 158") $chaine 1 5 8;;
"la 159") $chaine 1 5 9;;
"la 160") $chaine 1 6 0;;
"la 161") $chaine 1 6 1;;
"la 162") $chaine 1 6 2;;
"la 163") $chaine 1 6 3;;
"la 164") $chaine 1 6 4;;
"la 165") $chaine 1 6 5;;
"la 166") $chaine 1 6 6;;
"la 167") $chaine 1 6 7;;
"la 168") $chaine 1 6 8;;
"la 169") $chaine 1 6 9;;
"la 170") $chaine 1 7 0;;
"la 171") $chaine 1 7 1;;
"la 172") $chaine 1 7 2;;
"la 173") $chaine 1 7 3;;
"la 174") $chaine 1 7 4;;
"la 175") $chaine 1 7 5;;
"la 176") $chaine 1 7 6;;
"la 177") $chaine 1 7 7;;
"la 178") $chaine 1 7 8;;
"la 179") $chaine 1 7 9;;
"la 180") $chaine 1 8 0;;
"la 181") $chaine 1 8 1;;
"la 182") $chaine 1 8 2;;
"la 183") $chaine 1 8 3;;
"la 184") $chaine 1 8 4;;
"la 185") $chaine 1 8 5;;
"la 186") $chaine 1 8 6;;
"la 187") $chaine 1 8 7;;
"la 188") $chaine 1 8 8;;
"la 189") $chaine 1 8 9;;
"la 190") $chaine 1 9 0;;
"la 191") $chaine 1 9 1;;
"la 192") $chaine 1 9 2;;
"la 193") $chaine 1 9 3;;
"la 194") $chaine 1 9 4;;
"la 195") $chaine 1 9 5;;
"la 196") $chaine 1 9 6;;
"la 197") $chaine 1 9 7;;
"la 198") $chaine 1 9 8;;
"la 199") $chaine 1 9 9;;
"la 200") $chaine 2 0 0;;
"la 201") $chaine 2 0 1;;
"la 202") $chaine 2 0 2;;
"la 203") $chaine 2 0 3;;
"la 204") $chaine 2 0 4;;
"la 205") $chaine 2 0 5;;
"la 206") $chaine 2 0 6;;
"la 207") $chaine 2 0 7;;
"la 208") $chaine 2 0 8;;
"la 209") $chaine 2 0 9;;
"la 210") $chaine 2 1 0;;
"la 211") $chaine 2 1 1;;
"la 212") $chaine 2 1 2;;
"la 213") $chaine 2 1 3;;
"la 214") $chaine 2 1 4;;
"la 215") $chaine 2 1 5;;
"la 216") $chaine 2 1 6;;
"la 217") $chaine 2 1 7;;
"la 218") $chaine 2 1 8;;
"la 219") $chaine 2 1 9;;
"la 220") $chaine 2 2 0;;
"la 221") $chaine 2 2 1;;
"la 222") $chaine 2 2 2;;
"la 223") $chaine 2 2 3;;
"la 224") $chaine 2 2 4;;
"la 225") $chaine 2 2 5;;
"la 226") $chaine 2 2 6;;
"la 227") $chaine 2 2 7;;
"la 228") $chaine 2 2 8;;
"la 229") $chaine 2 2 9;;
"la 230") $chaine 2 3 0;;
"la 231") $chaine 2 3 1;;
"la 232") $chaine 2 3 2;;
"la 233") $chaine 2 3 3;;
"la 234") $chaine 2 3 4;;
"la 235") $chaine 2 3 5;;
"la 236") $chaine 2 3 6;;
"la 237") $chaine 2 3 7;;
"la 238") $chaine 2 3 8;;
"la 239") $chaine 2 3 9;;
"la 240") $chaine 2 4 0;;
"la 241") $chaine 2 4 1;;
"la 242") $chaine 2 4 2;;
"la 243") $chaine 2 4 3;;
"la 244") $chaine 2 4 4;;
"la 245") $chaine 2 4 5;;
"la 246") $chaine 2 4 6;;
"la 247") $chaine 2 4 7;;
"la 248") $chaine 2 4 8;;
"la 249") $chaine 2 4 9;;
"la 250") $chaine 2 5 0;;
"la 251") $chaine 2 5 1;;
"la 252") $chaine 2 5 2;;
"la 253") $chaine 2 5 3;;
"la 254") $chaine 2 5 4;;
"la 255") $chaine 2 5 5;;
"la 256") $chaine 2 5 6;;
"la 257") $chaine 2 5 7;;
"la 258") $chaine 2 5 8;;
"la 259") $chaine 2 5 9;;
"la 260") $chaine 2 6 0;;
"la 261") $chaine 2 6 1;;
"la 262") $chaine 2 6 2;;
"la 263") $chaine 2 6 3;;
"la 264") $chaine 2 6 4;;
"la 265") $chaine 2 6 5;;
"la 266") $chaine 2 6 6;;
"la 267") $chaine 2 6 7;;
"la 268") $chaine 2 6 8;;
"la 269") $chaine 2 6 9;;
"la 270") $chaine 2 7 0;;
"la 271") $chaine 2 7 1;;
"la 272") $chaine 2 7 2;;
"la 273") $chaine 2 7 3;;
"la 274") $chaine 2 7 4;;
"la 275") $chaine 2 7 5;;
"la 276") $chaine 2 7 6;;
"la 277") $chaine 2 7 7;;
"la 278") $chaine 2 7 8;;
"la 279") $chaine 2 7 9;;
"la 280") $chaine 2 8 0;;
"la 281") $chaine 2 8 1;;
"la 282") $chaine 2 8 2;;
"la 283") $chaine 2 8 3;;
"la 284") $chaine 2 8 4;;
"la 285") $chaine 2 8 5;;
"la 286") $chaine 2 8 6;;
"la 287") $chaine 2 8 7;;
"la 288") $chaine 2 8 8;;
"la 289") $chaine 2 8 9;;
"la 290") $chaine 2 9 0;;
"la 291") $chaine 2 9 1;;
"la 292") $chaine 2 9 2;;
"la 293") $chaine 2 9 3;;
"la 294") $chaine 2 9 4;;
"la 295") $chaine 2 9 5;;
"la 296") $chaine 2 9 6;;
"la 297") $chaine 2 9 7;;
"la 298") $chaine 2 9 8;;
"la 299") $chaine 2 9 9;;
esac
exit 0
Code : Tout sélectionner
sudo chmod +x ~/domoticz/scripts/freebox.shEdit du 10/11
J'ai ajouté un commentaire dans les logs de domoticz lorsque qu'une commande n'est pas reconnue, pour plus de clarté.
Pour vérifier le contenu de la variable "freebox", on met en commentaire dans le fichier script_variable_freebox.lua la ligne commandArray['Variable:freebox']=''..raz en mettant -- devant la ligne, sinon la variable se remet à "vide" automatiquement et on fait un petit :
Code : Tout sélectionner
http://ip:port/json.htm?type=command¶m=getuservariablesCode : Tout sélectionner
{
"result" : [
{
"LastUpdate" : "2017-11-09 23:00:31",
"Name" : "freebox",
"Type" : "2",
"Value" : "TF 1",
"idx" : "1"
}
],
"status" : "OK",
"title" : "GetUserVariables"
}Comme vous le voyez, ce script appel deux autre script "chg_chaine.sh" et "chg_touche.sh"
Dans le répertoire domoticz/scripts, créer un fichier chg_chaine.sh
Code : Tout sélectionner
sudo nano ~/domoticz/scripts/chg_chaine.shCode : Tout sélectionner
#!/bin/bash
#chg_chaine
centaine=$1
dizaine=$2
unite=$3
telecommande=21295xxx
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$centaine"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$dizaine"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$unite"Code : Tout sélectionner
#!/bin/bash
#chg_touche
user=pi
touche=$1
ip_free=192.168.0.x
telecommande=21295xxx
if [ $touche = "vol_inc" ]
then
echo "ok +"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
elif [ $touche = "vol_dec" ]
then
echo "ok -"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
elif [ $touche = "power_on" ]
then
echo "freebox on"
free=$(sudo nmap $ip_free -p 7000 --host-timeout 100 -oG - | grep Ports | awk -F "/" '{print $2}')
if [ $free = "closed" ]
then
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=power"
sleep 5
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=home"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
else
echo "freebox déjà allumée"
end
elif [ $touche = "power_off" ]
then
echo "freebox off"
free=$(sudo nmap $ip_free -p 7000 --host-timeout 100 -oG - | grep Ports | awk -F "/" '{print $2}')
if [ $free = "closed" ]
then echo "la Freebox est déjà éteinte"
else
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=power"
fi
elif [ $touche = "program_up" ]
then
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=prgm_inc"
elif [ $touche = "program_down" ]
then
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=prgm_dec"
elif [ $touche = "replay" ]
then
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=home"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=home"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
elif [ $touche = "live" ]
then
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=green"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
elif [ $touche = "VF" ]
then
echo "VF"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=green"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=red"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=red"
elif [ $touche = "VO" ]
then
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=green"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=red"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=red"
elif [ $touche = "sub" ]
then
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=green"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=red"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=red"
elif [ $touche = "no_sub" ]
then
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=green"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=down"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=ok"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=red"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=red"
else
echo "autre"
sudo curl "http://hd1.freebox.fr/pub/remote_control?code=$telecommande&key=$touche"
fi
Code : Tout sélectionner
sudo chmod +x ~/domoticz/scripts/chg_touche.shPour visualiser l'état de la freebox, je reprends le code fourni par yyoyodams
On install nmap :
Code : Tout sélectionner
sudo apt-get install nmap -yCode : Tout sélectionner
#!/bin/bash
EXTIP=$(sudo nmap 192.168.0.xx -p 7000--host-timeout 100 -oG - | grep Ports | awk -F "/" '{print $2}')
echo $EXTIP
exit 0Code : Tout sélectionner
commandArray = {}
n = os.tmpname ()
os.execute('/home/pi/domoticz/scripts/check_freebox_player.sh > '..n)
for line in io.lines (n) do
local STATUS = line
if (STATUS ~= 'open' and otherdevices['Etat Freebox TV'] == 'On') then
commandArray['Etat Freebox TV']='Off'
elseif (STATUS == 'open' and otherdevices['Etat Freebox TV'] == 'Off') then
commandArray['Etat Freebox TV']='On'
end
end
os.remove (n)
Code : Tout sélectionner
sudo apt-get install libpython3.4Code : Tout sélectionner
sudo apt-get install build-essential nano cmake git libboost-dev libboost-thread-dev libboost-system-dev
sudo apt-get install libsqlite3-dev curl libcurl4-openssl-dev libssl-dev libusb-dev zlib1g-dev python3-devOk google mets la 24, RMC
Ok google monte le son de la freebox, baisse le son de la freebox
Ok google fait suivante, précédente, haut,bas, gauche, droite, pause, lecture, ok, retour, retour à l'accueil, enregistre, reviens au direct sur la freebox
Ok google mets en VO, en version originale, en VF, en version française
Ok google mets les sous titres francais
Ok google enleve les sous titres de la freebox
Ok google mets le replay
Les commentaires sont les bien venus.
PS: la variable ifttt n'est plus sensible à la casse, donc ne mettez plus de majuscule dans la reconnaissance de la phrase.
Ajout des accents pour faciliter le nom des chaines. Merci à Alexbi.