Skip to content

Commit

Permalink
Modification installation / Correction bug 2 compteurs
Browse files Browse the repository at this point in the history
  • Loading branch information
ticed35 committed Mar 16, 2018
1 parent 7831631 commit 86353d4
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ indent_size = 4
charset = utf-8
indent_style = space
indent_size = 4

[*.sh]
charset = utf-8
indent_style = space
indent_size = 4
49 changes: 49 additions & 0 deletions ressources/install_apt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
PROGRESS_FILE=/tmp/jeedom/teleinfo/dependance
PROGRESS_FILE=$1
touch ${PROGRESS_FILE}
echo 0 > ${PROGRESS_FILE}
function apt_install {
sudo apt-get -y install "$@"
if [ $? -ne 0 ]; then
echo "could not install $1 - abort"
rm ${PROGRESS_FILE}
exit 1
fi
}

function pip_install {
sudo pip install "$@"
if [ $? -ne 0 ]; then
echo "could not install $p - abort"
rm ${PROGRESS_FILE}
exit 1
fi
}
#echo "Prérequis python3"
echo 10 > ${PROGRESS_FILE}
#apt_install python3
#apt_install python3-pip
echo "Lancement de l'installation/mise à jour des dépendances Téléinfo"
sudo apt-get update
echo 20 > ${PROGRESS_FILE}
sudo apt-get -y install python-ftdi
sudo apt-get -y install python-ftdi1
#pip_install pyftdi
pip_install pylibftdi
echo 30 > ${PROGRESS_FILE}
#pip_install python-ftdi1
echo 40 > ${PROGRESS_FILE}
pip_install serial
echo 50 > ${PROGRESS_FILE}
if [ -e /dev/ttyAMA0 ]; then
sed -i 's/console=ttyAMA0,115200//; s/kgdboc=ttyAMA0,115200//' /boot/cmdline.txt
if [ -e /etc/inittab ]; then
sed -i 's|[^:]*:[^:]*:respawn:/sbin/getty[^:]*ttyAMA0[^:]*||' /etc/inittab
fi
sudo systemctl stop [email protected]
sudo systemctl disable [email protected]
fi
echo 100 > ${PROGRESS_FILE}
echo "Everything is successfully installed!"
rm ${PROGRESS_FILE}
7 changes: 4 additions & 3 deletions ressources/teleinfo_2_cpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,10 @@ class Teleinfo(object):
def __init__(self, ftdi_):
"""
"""
self._log = MyLogger()
self._log.info("Initialisation de la teleinfo")
if FTDI_TYPE == 0:
self._log = MyLogger()
self._log.info("Initialisation de la teleinfo")
self.context = ""
super(Teleinfo, self).__init__()
self.__ftdi = ftdi_
else:
Expand Down Expand Up @@ -526,7 +527,7 @@ def main():
ftdi_.init()
teleinfo = Teleinfo(ftdi_)
else:
teleinfo = Teleinfo()
teleinfo = Teleinfo("")
pid = str(os.getpid())
file("/tmp/teleinfo2cpt.pid", 'w').write("%s\n" % pid)
signal.signal(signal.SIGTERM, teleinfo.exit_handler)
Expand Down

0 comments on commit 86353d4

Please sign in to comment.