Sending push notifications to specific devices

Post Reply
rmbrmb
Posts: 11
Joined: Monday 05 December 2016 10:05
Target OS: Raspberry Pi
Domoticz version: Latest
Location: Netherlands
Contact:

Sending push notifications to specific devices

Post by rmbrmb » Monday 05 December 2016 21:27

Hi,

I am using Domoticz v3.5877 on a RPi3.
I used Pushover with my previous domotics system (Homeseer) and could choose between the several registered devices when sending a push notification.
Is this possible with Domoticz too, via Blockly or LUA or a separate script?
Are there other push notification systems available for sending to specific devices?

Kind regards,
Rene.

User avatar
emme
Posts: 951
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Sending push notifications to specific devices

Post by emme » Monday 05 December 2016 22:00

at code level there is no difference in sending notification: it will be send to all configured ways...
except for email.... where you can define the destination adress
Ad device level, you can choose what kind of notification shall be used
The most dangerous phrase in any language is:
"We always done this way"

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Sending push notifications to specific devices

Post by G3rard » Monday 05 December 2016 23:35

You can use this function in LUA.
Put your key and token in the code.

Code: Select all

function notifyMe(iPriority, sTitle, sBody, sSound, sDevice)
   -- iPriority = -2,-1,0,1,2
   -- sTitle = title of message
   -- sBody = message
   -- sSound = sound, empty is default sound
   -- sDevice = your device name, empty is all devices
   -- Check for optional sound and device parameter
   if sSound == nil then sSound = '' end
   if sDevice == nil then sDevice = '' end
   local sUserKey = '<key_here>'
   local sToken = '<toke_here>'
   -- Replace any percent signs with their ascii values, as they are special characters
   sTitle = string.gsub(sTitle, '%%', '%%25')
   sBody = string.gsub(sBody, '%%', '%%25')
   local sMsg = 'curl --data "token=' .. sToken .. '&user=' .. sUserKey .. '&title=' .. sTitle .. '&message=' .. sBody .. '&priority=' .. tostring(iPriority) .. '&sound=' .. sSound .. '&device=' .. sDevice .. '" https://api.pushover.net/1/messages.json'
   os.execute(sMsg)
end
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

rmbrmb
Posts: 11
Joined: Monday 05 December 2016 10:05
Target OS: Raspberry Pi
Domoticz version: Latest
Location: Netherlands
Contact:

Re: Sending push notifications to specific devices

Post by rmbrmb » Tuesday 06 December 2016 21:06

Hi Gerard,
Thank you, that's what I was searching for!
Kind regards,
Rene.

nizaga
Posts: 110
Joined: Monday 30 November 2015 12:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Sending push notifications to specific devices

Post by nizaga » Tuesday 27 December 2016 0:04

Hi, but it is not possible to send a device pushover notification to only one device, right? One way i found is to define a email alias at pushover level to notify only to one device..


Enviado desde mi iPhone utilizando Tapatalk Pro

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Sending push notifications to specific devices

Post by G3rard » Thursday 29 December 2016 1:20

Yeah it is. You can use the function for it in the following way.

Code: Select all

notifyMe('0', 'Title test', 'Test message', 'Bike', 'iPhone')
Where 'iPhone' is the name of the device as registered in Pushover. You can check pushover.net for the name of your devices.
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

nizaga
Posts: 110
Joined: Monday 30 November 2015 12:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Sending push notifications to specific devices

Post by nizaga » Thursday 29 December 2016 11:42

but.. you execute the LUA when catching a device event, right? it is not possible to configure push notifications to only one device using the notification feature in the device, correct?

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Sending push notifications to specific devices

Post by G3rard » Friday 30 December 2016 1:46

That is correct. If you want that the easiest way would be to make a Delivery Group with it's own group key on pushover.net and use that in the pushover settings in Domoticz.
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

User avatar
Derik
Posts: 2186
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Sending push notifications to specific devices

Post by Derik » Friday 30 December 2016 10:28

Perhaps use a dummy switch.
When xx, then activate the dummy switch that is execute the script
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest