Page 1 of 1

Sending push notifications to specific devices

Posted: Monday 05 December 2016 20:27
by rmbrmb
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.

Re: Sending push notifications to specific devices

Posted: Monday 05 December 2016 21:00
by emme
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

Re: Sending push notifications to specific devices

Posted: Monday 05 December 2016 22:35
by G3rard
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

Re: Sending push notifications to specific devices

Posted: Tuesday 06 December 2016 20:06
by rmbrmb
Hi Gerard,
Thank you, that's what I was searching for!
Kind regards,
Rene.

Re: Sending push notifications to specific devices

Posted: Monday 26 December 2016 23:04
by nizaga
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

Re: Sending push notifications to specific devices

Posted: Thursday 29 December 2016 0:20
by G3rard
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.

Re: Sending push notifications to specific devices

Posted: Thursday 29 December 2016 10:42
by nizaga
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?

Re: Sending push notifications to specific devices

Posted: Friday 30 December 2016 0:46
by G3rard
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.

Re: Sending push notifications to specific devices

Posted: Friday 30 December 2016 9:28
by Derik
Perhaps use a dummy switch.
When xx, then activate the dummy switch that is execute the script