Installing XMPP Notification System

From Domoticz
Jump to: navigation, search


XMPP is a protocol that is among other things used or supported by many chat systems, including Google hangouts. Using the XMPP protocol, you can send notifications directly to any supported chat client easily and without complications. This page discuss only notifications, unlike XMPP-IoT (which example Dombot make use of) which also provides IoT control through the XMPP protocol but is more complicated to install. Note that sendxmpp opens a connection for each notification so it takes a second or two to send the notification. A slightly more complicated system can probably be written to have sendxmpp running in -n mode and pipe the notification into it. As I use Hangouts this setup is geared toward google hangouts but it should work with very little modifications with other systems as well.



These instructions assume you have already installed Domoticz on a Raspberry Pi running Raspbian - however in general they will be a good guide for installation under similar Linux systems.

First step is to create a user for your home automation system. IMPORTANT: Do not use your own user and do not give it the same password as your user. For Google Hangouts/talk its best to "introduce" your new user to your user by adding them to each other contact book. This allows them to communicate with each other if your user is not open to all for chat. From now on this new user will be called [email protected]

Second step, enable less secure apps in google :

Third step is to install sendxmpp:

sudo apt-get install sendxmpp

Now, create/edit the configuration file:

sudo nano /root/.sendxmpprc

Add the following line:

[email protected]; replacethiswithHAUSERpassword

Save and change permissions:

sudo chmod 600 /root/.sendxmpprc

Test that it works (replace HAUSER with the user you created without the domain, replace my.user with your primary user:

sudo sh -c  'echo hi | sendxmpp -t -u HAUSER -o [email protected]'

Assuming this worked, we are almost done!

Now, create the following script in /home/pi/domoticz/scripts/

echo "$4" | sudo sendxmpp -t -u $1 -o $2 $3

Last stage!!!! In domoticz, go to the Setup->settings->notifications tab, in the Custom HTTP/Action part:

  1. Check enable
  2. set #FIELD1=HAUSER
  3. set
  4. set #[email protected]
  5. set URL/Action=script://home/pi/domoticz/scripts/ #FIELD1 #FIELD2 #TO "#MESSAGE"

Press the "Test" button and see that you get the notification. Don't forget to "Apply setting"!!!! You are good to go!

See also

External Links