Add dynamic parameters to notifications

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.
Post Reply
DomoJev
Posts: 24
Joined: Friday 16 June 2017 23:40
Target OS: Raspberry Pi
Domoticz version:
Contact:

Add dynamic parameters to notifications

Post by DomoJev » Saturday 02 September 2017 23:20

I have a binary sensor that is being used in a doorbell detection system. When the doorbell rings, I should get a notification on my phone. I noticed however Android's notification system is quite unreliable. Notifications sometimes are delayed for up to several hours. On the phone, you'll see a notification popup marked "2 hour ago", but this may be 120 minutes ago, but also 150 minutes or maybe 91 minutes ago.

I would like to propose to add dynamic parameters in the optional "Custom message" notification strings. For example: adding "%t" in the string should be replaced by the time the notification was created by domoticz. Other flags could translate to date, day of week, counters, values, whatever.

Number8
Posts: 285
Joined: Friday 23 May 2014 7:55
Target OS: Raspberry Pi
Domoticz version: 3.5103
Location: Saint Pierre de Jards
Contact:

Re: Add dynamic parameters to notifications

Post by Number8 » Sunday 03 September 2017 7:05

I support this request. Would be great to add to the message the current value of the sensor that triggered the notification

rickvanakkeren
Posts: 37
Joined: Thursday 03 December 2015 14:58
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Add dynamic parameters to notifications

Post by rickvanakkeren » Sunday 03 September 2017 9:44

Yup, this one I like also!

roblom
Posts: 561
Joined: Wednesday 26 February 2014 16:28
Target OS: Raspberry Pi
Domoticz version:
Location: the Netherlands
Contact:

Re: Add dynamic parameters to notifications

Post by roblom » Wednesday 13 September 2017 20:53

This is possible already, only not the time if I'm right.

$name = device name
$value = the value

It is somewhere in a wiki but I can't find it. The above does work but maybe there are more.

funny0frank
Posts: 8
Joined: Friday 20 October 2017 8:33
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Add dynamic parameters to notifications

Post by funny0frank » Thursday 28 December 2017 16:02

roblom wrote:
Wednesday 13 September 2017 20:53
This is possible already, only not the time if I'm right.

$name = device name
$value = the value

It is somewhere in a wiki but I can't find it. The above does work but maybe there are more.
Too bad we can't find this in the wiki, but it does work!

User avatar
Egregius
Posts: 2669
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Add dynamic parameters to notifications

Post by Egregius » Thursday 28 December 2017 16:13

Get another notification system. What is the use if the message could be hours later?
For instance: with Telegram the delay is maximum several seconds, mostly the messages arrives instantly.
If you start using scripts, like pass2php, you can have whatever text you like.

verbem
Posts: 11
Joined: Thursday 26 May 2016 21:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Add dynamic parameters to notifications

Post by verbem » Saturday 13 January 2018 14:03

Is there a variable for the idx, like $name? have tried $device, $idx, no luck.

lost
Posts: 169
Joined: Thursday 10 November 2016 10:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Add dynamic parameters to notifications

Post by lost » Monday 15 January 2018 8:22

Egregius wrote:
Thursday 28 December 2017 16:13
Get another notification system. What is the use if the message could be hours later?
For instance: with Telegram the delay is maximum several seconds, mostly the messages arrives instantly.
If you start using scripts, like pass2php, you can have whatever text you like.
Notification system limitations can be bypassed by attaching scripts to device state changes, that's true... But a few added features would be welcome to avoid scripting so much: Another useful feature would be to allow triggering notifications according to security panel status for instance, to avoid notif spamming when at home.
Well, It's added job I agree. But this one would probably ease using some paid notification systems (many users probably don't use because of notif limits) that could add audience & allow monetization from providers to help the project/buy test devices...

User avatar
Egregius
Posts: 2669
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Add dynamic parameters to notifications

Post by Egregius » Monday 15 January 2018 9:56

All of this can easily be done when you start scripting.
I have different notification settings while I'm at home, or a sleep, or away. Different notification intervals for different scenario's.
If you start scripting only your imagination is your limit.

lost
Posts: 169
Joined: Thursday 10 November 2016 10:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Add dynamic parameters to notifications

Post by lost » Monday 15 January 2018 14:26

Egregius wrote:
Monday 15 January 2018 9:56
If you start scripting only your imagination is your limit.
I know, I also have many scripts myself, mostly python/bash/lua. But this is not so easy for many users, even blockly.
Specific user case should not make their way in Domoticz core... but for such commonalities, this imo makes sense.

Even with a few Linux skills (well, 15 years in embedded Linux bring-up for telecom industry, after several others in vxWorks), but writing much more ASM or C code than scripting I confess (so not as efficient doing so than a sysadmin), I sometime find Lua scripts a bit difficult to debug (to write, it's OK, syntax is quite simple even for beginners I presume) as well: As an interpreted language, if you do not manage to test each code branches you may miss execution blockers compiler checks would spot immediately. Lua linting tools exists & will mostly spot these problems but a casual user will not even think to find&use them.

Having to way for event scheduler to trig your scripts & checking log is also not very straightforward.

For python, it's powerful with a lot of libraries, ability to run script as services... but even worse on some syntax aspects: Especially, relying only on indentation for blocks can lead to tricky bugs with execution that does not conform to the source view in your editor! This can result in last block lines that can be moved at execution outside block context with the adequate tab/space mixup due to various editors configurations. Code checks just cannot spot all mistakes possibilities without using block separators ({} in C, begin/end in pascal...).

The designer of the language wanted to enforce nice indentation, but this is just an unacceptable trade-of with execution correctness: What you see may not be what you execute...

So scripting opens-up a world of possibilities, but requires lots of care if you don't want your nice stuff hanging or misbehaving just before ringing the alarm bell because you just had a code path the burglar is the very first to test!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests