Sending push notifications to specific devices

Moderator: leecollings

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

Sending push notifications to specific devices

Post 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.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Sending push notifications to specific devices

Post 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
The most dangerous phrase in any language is:
"We always done this way"
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Sending push notifications to specific devices

Post 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
Not using Domoticz anymore
rmbrmb
Posts: 10
Joined: Monday 05 December 2016 9:05
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Netherlands
Contact:

Re: Sending push notifications to specific devices

Post by rmbrmb »

Hi Gerard,
Thank you, that's what I was searching for!
Kind regards,
Rene.
nizaga
Posts: 69
Joined: Monday 30 November 2015 11:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sending push notifications to specific devices

Post 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
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Sending push notifications to specific devices

Post 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.
Not using Domoticz anymore
nizaga
Posts: 69
Joined: Monday 30 November 2015 11:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sending push notifications to specific devices

Post 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?
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Sending push notifications to specific devices

Post 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.
Not using Domoticz anymore
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Sending push notifications to specific devices

Post by Derik »

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