Menu

Installation

Pawel Wojtasinski

🛠️ SmartHomePanel Installation and Configuration Guide

The following steps describe the process of installing the SmartHomePanel application, including all necessary dependencies, X server configuration, and user permissions setup to ensure correct operation on a dedicated display (e.g., a 1024 x 600 resolution touchscreen).


Step 1: Install Required Packages (as root)

Log in as the root user and install the Xorg server, along with packages required for compilation and application runtime.

# Log in as root
login

# Update package lists
apt update

# Install Xorg server
apt install xorg

# Install compilation tools (build-essential, pkg-config)
apt install build-essential pkg-config

# Install wxWidgets and MQTT libraries (required by SmartHomePanel)
apt install wx-common
apt install libwxgtk3.2-dev
apt install libwxgtk-webview3.2-dev
apt install libpaho-mqtt-dev

# Install decompression tool
apt install unzip

Step 2: Configure Xorg Server and Monitor Mode (as root)

Create an Xorg configuration file to define the custom screen resolution, in this case, 1024 x 600.

# Create or edit the configuration file
nano /etc/X11/xorg.conf.d/40-monitor.conf

Paste the following content:

Section "Monitor"
    Identifier  "Monitor0"
    # Definition of 1024x600@60Hz mode (from your notes)
    Modeline "1024x600_60.00"    49.00  1024 1056 1152 1312  600 603 609 626 -hsync +vsync
    Option "PreferredMode" "1024x600_60.00"
EndSection

Section "Screen"
    Identifier "Screen0"
    Monitor    "Monitor0"
    DefaultDepth 24
    SubSection "Display"
        Depth      24
        Modes      "1024x600_60.00"
    EndSubSection
EndSection

Step 3: Create User and Configure Permissions (as root)

Create a dedicated user for the application and grant the necessary permissions (e.g., for graphics and input devices).

# Create the "smarthomepanel" user
adduser smarthomepanel

# Add the user to necessary groups (video, input, tty, render)
usermod -a -G video,input,tty,render smarthomepanel

TTY Permissions Configuration (Optional but Recommended for Embedded Systems):

Create a udev rule to ensure correct TTY device permissions.

# Create or edit the udev rules file
nano /etc/udev/rules.d/99-tty-permissions.rules

Paste the following rule:

SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0660"

Reload the udev rules:

udevadm control --reload-rules
udevadm trigger --subsystem-match=tty

Step 4: Test Xorg Server (as smarthomepanel)

Switch to the new user and verify that the Xorg server starts correctly in the defined resolution.

# Switch to the new user
login smarthomepanel

# Create a temporary .xinitrc file for testing
nano .xinitrc

Paste the content into .xinitrc:

xcalc -geometry 1024x600

Start the X server (a calculator should start on the full 1024 x 600 screen):

startx -- -nocursor

After testing (and confirming resolution and touchscreen/mouse work), close the calculator and exit the X server.


Step 5: Compile SmartHomePanel (as smarthomepanel)

Download and compile the SmartHomePanel application.

Option 1: Latest Version (From SVN Trunk)

Use this method to get the absolute latest, potentially unstable, code directly from the SVN development trunk.

# Create directories
mkdir SmartHomePanel
mkdir src
cd src

# Download the source code
wget https://sourceforge.net/code-snapshots/svn/s/sm/smarthomepanel/code/smarthomepanel-code-r20-trunk.zip
unzip smarthomepanel-code-r20-trunk.zip
cd smarthomepanel-code-r20-trunk/

# Compile the program (use -jN, where N is the number of CPU cores, e.g., 4)
make -j4

Option 2: Stable Release Version (From SF.net Files)

Use this method to download the latest stable, tagged release source code package from the official SourceForge files section.

# Create directories
mkdir SmartHomePanel
mkdir src
cd src

# Download the source code
wget https://sourceforge.net/projects/smarthomepanel/files/Release-0.2.0/smarthomepanel-0.2.0.tar.gz/download -O smarthomepanel-0.2.0.tar.gz
tar -xzvf smarthomepanel-0.2.0.tar.gz
cd smarthomepanel-REL-0.2.0 

# Compile the program (use -jN, where N is the number of CPU cores, e.g., 4)
make -j4

Step 6: Test and Configure Application (as smarthomepanel)

Create and copy the executable and configuration files to the target directory.

1. Initial Test (from the source directory):

Create a temporary config.xml file in the source directory to enable a test run.

nano config.xml

Paste a sample configuration (use the URL you wish to display):

<?xml version = "1.0" encoding = "UTF-8"?>
<smart_home_panel_config>
   <gui_config home = "panel-1">
      <panel id = "panel-1">
         <webview position = "0, 0" size = "1, 1" id = "...test..." url = "http://www.google.com"/>
      </panel>
   </gui_config>
</smart_home_panel_config>

Run the panel in the current X session:

xinit ./SmartHomePanel -k

2. Copy Files to Target Directory:

After a successful test, copy the executable and configuration:

cp SmartHomePanel ~/SmartHomePanel/
cp config.xml ~/SmartHomePanel/

cd ~

3. Final .xinitrc Configuration:

Edit the .xinitrc file so the application starts automatically without a screensaver.

nano .xinitrc

Paste the new content:

xset s off # Disable screen saver
xset -dpms # Disable power management (DPMS)
cd /home/smarthomepanel/SmartHomePanel/ # Navigate to the application directory
./SmartHomePanel -k # Start the application

Final test of the panel launch:

startx -- -nocursor

Step 7: Configure systemd Service (as root)

Install the application as a system service so it starts automatically at boot.

# Switch back to root
exit

# Create the systemd service file
nano /lib/systemd/system/smarthomepanel.service

Paste the following service definition:

[Unit]
Description=Smart Home Panel Application
After=network.target

[Service]
User=smarthomepanel
TTYPath=/dev/tty1
TTYVTDisallocate=yes

ExecStart=/usr/bin/startx -- -nocursor

Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable and start the service:

# Enable the service
systemctl enable smarthomepanel.service

# Start the service
systemctl start smarthomepanel.service

Step 8: Secure the User Account (as root)

Lock the console login for the smarthomepanel user and set a non-login shell so it only functions as a system service.

# Lock the user's password (prevents console/ssh login)
passwd -l smarthomepanel

# Change the default shell to nologin (additional security)
usermod -s /sbin/nologin smarthomepanel

Related

Wiki: Home