Re: [DzVents] LiveBox 4
Publié : 27 nov. 2018, 23:02
je n'arrive pas à lancer le scrypt : Python donne une "invalid syntax" sur le 1er slach de : myBashDir=/var/tmp
Reprenez le contrôle de votre domotique
https://easydomoticz.com/forum/
Code : Tout sélectionner
2018-12-09 13:45:00.138 Status: dzVents: Info: Livebox 1.8: ------ Start external script: livebox_play.lua:, trigger: every 1 minutes
2018-12-09 13:45:04.395 Status: dzVents: Info: Livebox 1.8: ATM Down: 9029
2018-12-09 13:45:04.427 Status: dzVents: Info: Livebox 1.8: ATM Up: 1013
2018-12-09 13:45:04.429 Status: dzVents: Info: Livebox 1.8: Attn : 38.2 dB
2018-12-09 13:45:04.431 Status: dzVents: Info: Livebox 1.8: Marge d'Attn : 8.2 dB
2018-12-09 13:45:04.433 Status: dzVents: Info: Livebox 1.8: Uptime : 0:00:28:28
2018-12-09 13:45:04.441 Status: dzVents: Info: Livebox 1.8: Internet : up
2018-12-09 13:45:04.443 Status: dzVents: Info: Livebox 1.8: IPv6 :
2018-12-09 13:45:04.446 Status: dzVents: Info: Livebox 1.8: IP WAN : 90.xx.xx.xx
2018-12-09 13:45:04.451 Status: dzVents: Info: Livebox 1.8: VoIP : Up
2018-12-09 13:45:04.453 Status: dzVents: Info: Livebox 1.8: TV : Available
2018-12-09 13:45:04.488 Status: dzVents: Info: Livebox 1.8: Wifi 2.4 Ghz : Up
2018-12-09 13:45:04.490 Status: dzVents: Error (2.4.9): Livebox 1.8: An error occured when calling event handler livebox_play
2018-12-09 13:45:04.490 Status: dzVents: Error (2.4.9): Livebox 1.8: /home/pi/domoticz/scripts/dzVents/scripts/livebox_play.lua:295: attempt to index field 'eth6' (a nil value)
2018-12-09 13:45:04.490 Status: dzVents: Info: Livebox 1.8: ------ Finished livebox_play.luaCode : Tout sélectionner
#!/bin/bash
###########################################
# Firmware Livebox 4 = 3.4.10 g0-f-sip-fr #
# Script mis a jour le 06/04/2018 #
###########################################
#Source : https://www.alex-braga.fr/ressources_externe/xdslbox_3.4.10.sh
# https://github.com/rene-d/sysbus
#############################
# Declaration des variables #
#############################
myLivebox="192.168.1.1"
myPassword="motdepasse"
myBashDir=/var/tmp
myOutput=$myBashDir/myOutput.txt
myCookies=$myBashDir/myCookies.txt
########################################
# Connexion et recuperation du cookies #
########################################
curl -s -o "$myOutput" -X POST -c "$myCookies" -H 'Content-Type: application/x-sah-ws-4-call+json' -H 'Authorization: X-Sah-Login' -d "{\"service\":\"sah.Device.Information\",\"method\":\"createContext\",\"parameters\":{\"applicationName\":\"so_sdkut\",\"username\":\"admin\",\"password\":\"$myPassword\"}}" http://$myLivebox/ws > /dev/null
##################################################
# Lecture du cookies pour utilisation ulterieure #
##################################################
myContextID=$(tail -n1 "$myOutput" | sed 's/{"status":0,"data":{"contextID":"//1'| sed 's/",//1' | sed 's/"groups":"http,admin//1' | sed 's/"}}//1')
###############################################################################################
# Envoi des commandes pour recuperer les informtations et ecriture dans un fichier TXT separe #
###############################################################################################
getMIBs=`curl -s -b "$myCookies" -X POST -H 'Content-Type: application/x-sah-ws-4-call+json' -H "X-Context: $myContextID" -d "{\"service\":\"NeMo.Intf.lan\",\"method\":\"getMIBs\",\"parameters\":{}}" http://$myLivebox/ws`
echo $getMIBs > $myBashDir/LAN.txt
#######################################################
# Deconnexion et suppression des fichiers temporaires #
#######################################################
curl -s -b "$myCookies" -X POST http://$myLivebox/logout
rm "$myCookies" "$myOutput"