[TUTORIAL] XFCE Notifications

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
Jieffe
Posts: 18
Joined: Wednesday 07 April 2021 19:33
Target OS: Linux
Domoticz version: 2023.2
Location: Belgium
Contact:

[TUTORIAL] XFCE Notifications

Post by Jieffe »

I am a long-time Linux user and my desktop of choice is XFCE4 (running under Debian).
I had a frustrating afternoon trying to send notifications from Domoticz to the XFCE desktop, but it is finally working.

On your Domoticz server, you need to install sshpass

Code: Select all

sudo apt install sshpass
On your XFCE workstation, the SSH daemon must be installed and running.

Code: Select all

sudo apt install ssh
In your domoticz/script directory, create a file "xfce-notify.sh" and make it executable

Code: Select all

#!/bin/bash
sshpass -p YOUR_PASSWORD ssh YOUR_USERNAME@SERVER_ADDRESS DISPLAY=:0 notify-send "Domoticz" \"$1\"
exit 0
In Domoticz, go to Setup/Settings/Notifications/CUSTOM HTTP/ACTION. Check "Enable" and fill "URL/ACTION" with

Code: Select all

script://xfce-notify.sh #MESSAGE
What the script does is opening an SSH session from the Domoticz server to your workstation and then using notify-send to access XFCE's notification system.
For a reason I can't explain, SSH login using key authentication doesn't work (it is working if I manually start the script from the command line), hence the use of sshpass.
Note also the escape character "\" around "$1". Without it, notify-send throws an "invalid arguments number" error.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests