Skip to content
Onkel Andy edited this page Jun 5, 2024 · 40 revisions

SmarthomeNG Raspberry Pi Image

General

You get the newest Image file here: https://github.com/smarthomeNG/raspberrypi-image/releases Use 7zip or similar to extract the file. Since Release 12.10.0 the image has to be split up into two parts, make sure your extraction tool can handle the split file correctly!

Base:

Raspberry Pi OS lite. Version is depending on image version. Recent images are 64 bit only! See changelog below. All setup steps of the image can be seen and reproduced in the ansible Repo: https://github.com/smarthomeNG/ansible

German UTF-8 locale is activated by default. On English keyboards y is z.

Python:

Version is depending on image version. See changelog below.

Compatibility

Images <= 1.9.2: Raspberry Pi 1 B+, Raspberry Pi 2, Raspberry Pi 3, Raspberry Pi 4 Images >= 1.9.3: Raspberry Pi 3, Raspberry Pi 4 (64 bit)

Login

Standard user: smarthome Password: none

You can also login as user root with password root, although this is not recommended.

Security

Avoid direct access to your Pi from outside under any circumstances! Use the openVPN package that is already included in the image to secure your connection. You can also setup a reverse proxy to access VISU and more from outside securely on port 443.

By default the smarthome user can "sudo" all commands without passwords. Consider changing that for increased security. It's also recommended to create SSH certificates to enable direct passwordless access as smarthome or root user while providing the best possible security layer. Certificates should be created automatically on first boot, but you need to configure ssh manually.

Liability Disclaimer

The providers of the software packages as well as of this image file can not be hold responsible for any damage.

Python Packages

All dependencies for SmarthomeNG are installed plus some additional packages like pymysql, awake, etc. List all installed packages with pip3 list

Let shng install needed modules automatically on startup. If it does not work, define the pip command in the etc/smarthome.yaml file, e.g. to pip_command: "/usr/local/smarthome/venvs/py_310/bin/python3 -m pip" or "/usr/local/smarthome/venvs/py_311/bin/python3 -m pip" depending on the virtual environment you want to run smarthomeng in.

Smarthome NG

Latest stable version can be found in /usr/local/smarthome.

Smarthome Admin Tool is accessible in your browser with IP-ADRESS/admin

How to update: system_update

smartvisu

smartvisu 2.8 is installed in /var/www/html/smartvisu2.8 for Image version < 12.10.0, dumped in newer image versions!

Latest smartvisu is installed in /var/www/html/smartvisu

Configure it in the browser via IP-ADDRESS/smartvisu

How to update: system_update

Installation and configuration

  1. "Burn" the image on a SD card using win32DiskImager, PiFiller, Etcher, Raspberry Pi Imager, etc. on a SD card or USB stick (see below) with minimum 8GB < Image 12.10.0, 16B for newer versions. The larger the better.
  2. It's recommended to run your system on a USB stick. Burn this image or copy your SD card on a stick. The procedure depends on your Raspberry Pi version: o Raspi <=2: On your SD card that still needs to be put in your Pi replace in boot/cmdline.txt the root=.. entry with root=/dev/sda2 If you have other USB sticks connected you need to use the PARTUUID. o Raspi 3: echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt && reboot o Raspi >=3+: just plug in your USB stick.
  3. Run setup_all to enable/disable/install or configure services, to expand your file system and change languages. BE AWARE: On English keyboards german y is z.
  4. Update SmarthomeNG configuration with your own:
  • etc/plugin.yaml,
  • etc/logic.yaml,
  • etc/logging.yaml,
  • etc/smarthome.yaml,
  • logics/*,
  • items/*,
  • structs/*

Be aware to change the editor of your choice to save line endings in LINUX style and the text itself as UTF-8!!! Also make sure you have this line in etc/smarthome.yaml: pip_command: /usr/local/smarthome/venvs/py_310/bin/python3 -m pip or pip_command: /usr/local/smarthome/venvs/py_311/bin/python3 -m pip

However, if you want to use python 3.11 you need to change the file /etc/profile.d/tweakbash.sh source /usr/local/smarthome/tools/act 310 -> source /usr/local/smarthome/tools/act 311

In the items directory you might create one file for each room or technology, etc. Also see official smarthomeNG Site

  1. You can transfer files to your Raspberry Pi using one of these methods or directly edit files on the Raspi using nano:

a) SFTP, Port 22. Login: smarthome, Password: none. Using WinSCP, FileZilla, etc.

b) NFS: Enable the service on your Pi with sudo systemctl enable nfs-server && sudo systemctl start nfs-server To access your directories from a remote PC, see [NFS]

c) Samba: Connect to your Pi like you would connect to any other network drive. Username and password are smarthome

d) SSH: Connect to your Raspberry Pi with ssh [email protected] and use nano to edit files manually.

e) Copy via USB stick. mkdir /mnt/usb && mount /dev/sda1 /mnt/usb

  1. Change the file /etc/knxd.ini or /etc/knxd.conf depending on your setup and knxd version. See also: official knxd Wiki

  2. reboot

Be aware that with Image 12.10.0 it is necessary to expand the file system manually using raspi-config!

Debugging

a) Type sh.log or sh.error in your command line to see the most recent SmarthomeNG log in realtime. The full log can be found in the directory /usr/local/smarthome/var/log. You can change log levels based on plugins, etc. in the file /usr/local/smarthome/etc/logging.yaml

b) To debug other services see their respective log file in /var/log or the global log /var/log/syslog. You can also use services like logcheck, monit, monitgraph, etc. to monitor your system. Just enable them. systemctl status SERVICENAME is also a good idea, as well as journalctl -xe

c) To debug knxd you can use knxtool groupswrite ip:localhost 0/0/1 0 Change the group address 0/0/1 respectively suiting your setup.

Services

The following services are installed and enabled. You might update their configuration files based on your preferences.

Service Description Config File(s)
systemd-timesyncd Automatic timesync -
knxd KNX Bus Connection /etc/knxd.ini or /etc/knxd.conf
ssh Console access via Port 22 /etc/ssh/sshd_config
rsyslog System Logging /etc/rsyslog.conf
Samba Access your files from anywhere /etc/samba/smb.conf
nginx Webserver /etc/nginx/nginx.conf, /etc/nginx/sites-available/default

The following services are installed but have to be activated and started with sudo systemctl enable SERVICE && sudo systemctl start SERVICE or via the setup_all script

Service Description Config File(s)
nfs Access your files from anywhere without login /etc/exports
lircd Use infrared capabilities /etc/lirc/lirc_options.conf
monit Monitoring Service to restart failed services, etc. /etc/monit/monitrc
logcheck Monitoring Service that analyzes log files every hour /etc/logcheck/logcheck.logfiles
exim4 Mail Server dpkg-reconfigure exim4-config; /etc/email-addresses, /etc/aliases and /etc/exim4/passwd.client
squeezelite Headless Player for Logitech Squeezebox /usr/local/bin/squeezelite.sh
watchdog Auto restart system on overload /etc/watchdog.conf
freeradius Network authentication service /etc/freeradius
openvpn Connect to your Pi from outside securely /etc/openvpn/server.conf, etc.
1Wire OneWire Server /etc/owfs.conf
mysql MySQL plus phpmyadmin mysql client, /etc/mysql/debian.cnf
mosquitto MQTT Broker Service /etc/mosquitto/mosquitto.conf
ufw Uncomplicated Firewall /etc/ufw/user.rules
nodered Node-Red http://<IP>/nodered
influxdb InfluxDB2 http://<IP>:8386
grafana Grafana http://<IP>/grafana
homebridge Homebridge

Changelog 12.10.0

New:

  • Homebridge, Grafana, InfluxDB pre-installed, no need for ansible playbooks anymore
  • Some more apt and python packages installed
  • dumped smartvisu 2.8 as it is outdated for sure
  • influxdb dumped for influxdb2

Updated:

  • SmarthomeNG 1.10.0
  • SmartVISU 3.4
  • Debian bookworm 64bit lite from December 2023
  • Some logcheck, monit and other improvements
  • EasyRSA updated to 3.1.7
  • Python 3.10 and 3.11, running in virtual environments in folder /usr/local/smarthome/venvs
  • luacrypto replaced by lua-openssl (for reverse proxy)
  • improved system_update script
  • geoip handling for nginx (based on new approach and database)
  • freeradius config
  • updated openvpn pw reading

Fixed:

  • setup script updates for correct handling of domain and alexa user/pw
  • some logging and logrotate fixes and improvements
  • logrotate for samba

Changelog 11.1.9.5

Updated:

  • SmarthomeNG 1.9.5
  • SmartVISU 3.3.1
  • Debian bullseye 64bit lite from February 2023
  • Some logcheck, monit and other improvements
  • xtrabackup Scripts removed
  • Some more apt and python packages installed, some unneeded removed
  • EasyRSA updated to 3.1.2
  • PHP 8.2
  • Lirc updated and improved

Fixed:

  • Github Update now possible without warnings about directory permissions
  • Loki and Promtail issues fixed; Service disabled by default
  • Issues with luacrypto for reverse proxy

Changelog 11.1.9.2

Updated:

  • SmarthomeNG 1.9.2
  • Debian bullseye
  • Some logcheck and other improvements

Fixed:

  • Github Clone is based on https and not git anymore, makes pulls work again

Changelog 11.1.9.1

New:

  • Logging of some services is changed: consistent timestamp, separate log files
  • loki and promtail get installed if you install grafana. This is useful for checking logfiles

Updated:

  • SmarthomeNG 1.9.1
  • smartVISU 3.2.1
  • Debian bullseye
  • Some logcheck and other improvements
  • Most recent GeoIP database for nginx

Fixed:

  • some system setup scripts got improved/fixed

Changelog 10.1.8.2

New:

  • Logging of some services is changed: consistent timestamp, separate log files
  • Rust compiler (for python cryptography)

Updated:

  • SmarthomeNG 1.8.2
  • smartVISU 3.0.1
  • Squeezelite
  • Some logcheck and monit improvements
  • Most recent GeoIP database for nginx

Fixed:

  • fixed missing knxd deb files for downgrading
  • standard knxd is now debian buster version again as compiled version was not reliable enough
  • openvpn service is now masked to avoid unwanted automatic restarts

Changelog 10.1.8.1

New:

  • Python 3.8.6 is installed and standard python3 version
  • Some new packages like whois, etc.

Updated:

  • SmarthomeNG 1.8.1
  • smartVISU 3.0
  • knxd 0.14.41
  • Python modules
  • Raspberry Pi OS Buster lite from January 2021
  • Squeezelite
  • nginx config improvements (e.g. include /plugin/ folder)
  • fail2ban jail for 404 errors
  • logcheck rules improved and put in separate local-* files
  • ssh is not possible as root user anymore

Fixed:

  • fixed problem with backup script
  • improved system_update script permission settings
  • allow numbers in URL for creating certs
  • lirc package is now patched for raspberry pi. Update is prevented.
  • smarthome service improved so automatic restart is now possible
  • mysql backup and other scripts

Changelog 10.1.7.1

New:

  • All python packages are now installed for the smarthome user in its home directory
  • Node-Red pre-installed

Updated:

  • SmarthomeNG 1.7.1
  • smartVISU 2.9.1 final release (folders have changed!)
  • Raspbian Buster lite from February 2020 with recent python version

Fixed:

  • several fixes and improvements to the setup_all process
  • system_update now installs python module updates correctly into the smarthome users home directory
  • Service files for PHP and 1Wire fixed.

Changelog 10.1.6.1

New:

  • possibility to install node-red via setup_nodered.sh

Updated:

  • SmarthomeNG 1.6.1 (Plugin Update Release)
  • Raspbian Buster lite from July 2019
  • Python 2.7.16
  • Python 3.7.3
  • PHP 7.3.11

Changelog 2.3 / 9.1.6

New:

  • installed fail2ban to ban eval IP addresses trying to connect to the web server
  • Installed unattanded upgrades (inactive by default)
  • Additional package for eibd. Optional use of eibd instead of knxd
  • Installed additional packages: atop, snmp, python knx
  • Fixed logrotate for watchdog, openvpn and influxdb
  • Possibility to backup and restore the system configuration via setup_all and setup_backup.sh / setup_restore.sh

Updated:

  • Updated system and python modules
  • Updated several packages and executables
  • Installed SmarthomeNG 1.6 (core and plugins)
  • Updated smartVISU 2.9
  • Disabled Swap file by default
  • Updated setup_all to change hostname and swapfile size.
  • Raspbian "stretch lite" from April 2019

Changed/Fixed:

  • small tweaks