Access deCONZ GUI in headless setups - dresden-elektronik/deconz-rest-plugin GitHub Wiki
Basically, you have 2 options running binaries usually requiring a Xserver while your Raspi is running headless: X-Forwarding and VNC. Which one you might want to chose depends on your preference and what you plan to do.
1. VNC
You can follow this guide to configure your Pi to serve a virtual desktop via VNC (Remote access via VNC). One of the benefits is that you get a desktop which might be more user friendly.
2. X-Forwarding
This options gives you a more or less regular ssh connection. However, if you run programs which give you a GUI, the connecting host is responsible for providing the Xserver and serving the graphics part (e.g. via Xming or MobaXServer).
In /etc/ssh/sshd_config, make sure the following line is uncommented and the parameter set to 'yes':
X11Forwarding yes
Then, restart the SSH service:
sudo systemctl enable ssh
From now on, when you need to have an app run in GUI-mode, just connect with one of the tools mentioned above and enjoy.
One remark though in case a SSH connection is established with a different user than the one designated for running deCONZ. Copy the .Xauthority file in the user home dir establishing the SSH connection over to the deconz' user home (e.g. sudo cp /home/pi/.Xauthority /home/deconz/.Xauthority
) and ensure you can 'su' to the deconz user to have it run.
Edit the deconz-gui service:
To ensure that deconz-gui opens on your X-window display (not the server display), you may need to override the systemd unit file. (This may occur if your server also supports a gui.) To do so, first find out your DISPLAY variable while running X forwaring:
- If using MobaXServer, open MobaXterm client window and type
echo $DISPLAY
. In this example, it returnedlocalhost:10.0
- If using Xming, first install xterm by running
sudo apt install xterm
, then open up xterm in Xming by runningxterm
. Once the xterm windows is opened, typeecho $DISPLAY
inside it. Like above, we'll pretend it returnedlocalhost:10.0
. - Create an override file for the deconz-gui service by running
sudo systemctl edit deconz-gui
. An editor (probably nano or vi) will open, and now you make sure the contents of this file is as follows:
[Service]
Environment="DISPLAY=localhost:10.0" # use the display number from the first step
- Update the systemd service by running
sudo systemctl daemon-reload
- Start deconz-gui by running
sudo systemctl start deconz-gui
Notes on using putty
If using putty, you need to enable X11 forwarding inside putty as well. To do this, go to Connection - SSH - X11 and check the X11 forwarding box.