Install Domoticz RPI 3 Stretch

Installeer Rasbian Stretch:

  • Install Etcher
  • Install 2017-09-07-raspbian-stretch-lite.img with etcher
  • In the root of the drive place a file called ssh (no extention!) to enable ssh from first boot
  • Boot raspberry pi
  • Connect with putty with the raspberry pi
  • login
    • username: pi
    • password: raspberry
  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo reboot

Raspi-config:

  • sudo raspi-config
  • 1 –> change user password
  • 2
    • N1 –> domoticzpi
    • N2 –> Wireless SID and password
  • 4
    • I2 –> Europe –> Amsterdam
    • I4 –> NL Netherlands
  • 7
    • A1
    • A3 –> 32
  • 8

Static IPaddress:

  • sudo nano /etc/dhcpcd.conf
  • interface eth0
    static ip_address=192.168.x.x/24
    static routers=192.168.x.x
    static domain_name_servers=192.168.x.xinterface wlan0
    static ip_address=192.168.x.x/24
    static routers=192.168.x.x
    static domain_name_servers=192.168.x.x

Setting up a RAM drive on Raspberry Pi:

  • sudo mkdir /var/tmp
  • sudo nano /etc/fstab
  • Add the line
    • tmpfs /var/tmp tmpfs nodev,nosuid,size=1M 0 0
  • sudo mount -a
  • df
  • !!This should give you a small space for your garbage. Instead of writing your tmp files to /tmp, now write them to /var/tmp. And remember that, as is generally the case with RAM drives, data on the drive is lost after a reboot.!!

Domoticz:

  • curl -L install.domoticz.com | sudo bash
  • OK
  • OK
  • OK
  • OK

Fix LIBSSL1.0.0

Fix Python, Failed dynamic library load, install the latest libpython3.x library that is available for your platform:

  • sudo apt-get install python3-dev

Daily backup to external hdd:

  • cd /home/pi/domoticz/scripts
  • sudo nano domoticz_backupdb.sh
  • add to the file and save
    #!/bin/bash
    # LOCAL/FTP/SCP/MAIL PARAMETERS
    SERVER=”192.168.x.x” # IP of Network disk, used for ftp
    USERNAME=”<username>” # FTP username of Network disk used for ftp
    PASSWORD=”<password>” # FTP password of Network disk used for ftp
    DESTDIR=”home/” # used for temorarily storage
    DOMO_IP=”192.168.x.x” # Domoticz IP
    DOMO_PORT=”8080″ # Domoticz port
    ### END OF USER CONFIGURABLE PARAMETERS
    TIMESTAMP=`/bin/date +%Y%m%d%H%M%S`
    BACKUPFILE=”domoticz_$TIMESTAMP.db” # backups will be named “domoticz_YYYYMMDDHHMMSS.db.gz”
    BACKUPFILEGZ=”$BACKUPFILE”.gz
    ### Stop Domoticz, create backup, ZIP it and start Domoticz again
    service domoticz.sh stop
    /usr/bin/curl -s http://$DOMO_IP:$DOMO_PORT/backupdatabase.php > /tmp/$BACKUPFILE
    service domoticz.sh start
    gzip -9 /tmp/$BACKUPFILE
    ### Send to Network disk through FTP
    curl -s –disable-epsv -v -T”/tmp/$BACKUPFILEGZ” -u”$USERNAME:$PASSWORD” “ftp://$SERVER/$DESTDIR”
    ### Remove temp backup file
    /bin/rm /tmp/$BACKUPFILEGZ
    ### Done!
  • sudo chmod +x /home/pi/domoticz/scripts/domoticz_backupdb.sh
  • Test the script
    • sudo /home/pi/domoticz/scripts/domoticz_backupdb.sh
  • crontab -e
  • 0 1 * * * sudo ~/domoticz/scripts/domoticz_backupdb.sh

WiringPi:

  • cd /home/pi
  • git clone git://git.drogon.net/wiringPi
  • cd wiringPi
  • ./build
  • gpio readall

Raspkaku:

  • cd /home/pi
  • git clone https://github.com/chaanstra/raspKaku
  • cd raspKaku
  • g++ -o newkaku newkaku.cpp -I/usr/local/include -L/usr/local/lib -lwiringPi