Looking for solution to send notifications to Linux Desktop

Hello all,

So I send notification from OH to my mobile devices with Pushover, and send to my TVs with Notifications for Android but I’ve run into an issue sending notifications to my Linux desktop.

I’m running my main OH install on an RPI and have a separate Linux desktop on the same LAN running Ubuntu. On that desktop, I’ve also installed OH and do a few things on it by connecting via MQTT to my main OH install.

My idea was to send an MQTT message from my main server to my desktop and use the exec binding to run a program on the desktop to send the notification to Gnome. I’ve tried using notify-send, which does exactly what I’m looking for (sending a popup notification directly into my Gnome desktop), however there doesn’t seem to be a reasonable way to get my “openhab” user to be able to send a notification using notify-send to my desktop user’s desktop without defeating a bunch of security.

So: Since I cannot be the only person trying to send notifications to a Linux desktop on the same LAN as my OH server, wondering what others are doing to accomplish this?

On what system are you running OH?

If is it Openhabian or Linux you could write a bash script and make it work.

I use Pushover for notifications on my Linux desktop using a pinned browser tab. The first thing I do is open a browser after logging in. :wink: The browser will restore the pinned tab. After that I never close the browser… until the computer is shut down again.

Do you guys remember the old active background option in Windows XP?

Where you could set the desktop picture as a website?

Apparently, there’s a way to do something similar in Linux.

(I haven’t tried this, but I like the idea of using a desktop background as a permanent status monitoring / messaging method)

It would be easy enough to create a Dashboard within openHAB2.


Particularly the answer that refers to screenlets

 sudo apt-get install screenlets

Yeah - I’m running openhabian Linux. What command do you propose to sue to send a desktop notification to another machine running on my LAN?

Thanks @wborn. I saw that as a possibility.

Sending a broadcast to logged in Linux computers

https://www.tecmint.com/send-a-message-to-logged-users-in-linux-terminal/

1 Like

If you’re into Java you can also use this OS agnostic approach. Maybe we can also integrate it in an add-on :slight_smile:

It’s also used by the progress-maven-plugin which worked well on Linux when I used it.

Linux network broadcast popup message

The wall command is like a forceful telegram. It will deliver a message to all terminal users

Windows network popup message

1 Like

@Charley & @MDAR,

Thanks for the ideas. I took a look at the wall command and it seems that it can only sends messages to users logged directly into an actual terminal session on a TTY and does not affect GUI users even when running a virtual terminal in a GUI.

Sorry Tom

It read at first glance like it created a pop up in a GUI.

There must be something out there that does what you want, surely you’re not the first person to want this kind of pop-up in Linux.

Out of curiosity, do you want a pop-up on top of whatever the user is doing, or do you want a monitoring window that you can push alerts / updates into?

Update

I’ve found this in a thread from 2010, so it might not be valid anymore.

According to the man pages, wall only accept the content of a file or input after wall command.
It depends on the window manager if the message is displayed, you need to have notifications enabled.

https://www.linuxquestions.org/questions/slackware-14/how-do-i-send-broadcast-messages-from-root-852165/

The thread goes on in more detail about the Wall command, comment #13 might be of use to you.

The more I think about what you’re trying to achieve, the more I like the idea of being able to push popups to Windows and Linux users on a LAN from openHAB2.

I can think of a number of serious and playful uses for it.

@MDAR - no problem. Thanks for looking at this!

What I am really looking for can be done with notify-send and it looks like this:

This is the build in notification from Gnome and is accessed by the super simple command:

notify-send -i /etc/openhab2/icons/classic/oh.jpg "openHAB" "The Washing Machine has completed a cycle"

The issue is that this typically only works when sent by the currently logged in user. there are many scripts out there to also make this work form the root user, but there doesn’t seem to be a way to do this from the user that OH is running under without disabling some security.

I took a look at that thread and I think it is going to have the same issue, where this scheme would work as the root user, but I don’t think the OH user is going to have permission to do this.

2 Likes

I like what you’ve done there…

Does this help you?

Unfortunately this doesn’t help. In this example the user could send messages to his desktop running notify-send as sudo but not as his regular user. That isn’t the issue I have. For me, notify-send either as my desktop user or using it with sudo (as root) sends messages to my desktop without issue.

What I cannot do is have my openhab user send a desktop message with notify-send to my desktop user’s desktop.

How frustrating.

There must be a solution that those pesky IT administrators use… :wink:

Well, I think I just found a path to do what I wanted, it is a MQTT to notify-send bridge. Its gets around the issue of running as a different user because it runs as your desktop user… I did a little testing and this will do exactly what I was looking for. Just stinks that it is 'yet another program" I have to maintain. too bad OH cannot do this on its own.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.