Page 1 of 1
Add dynamic parameters to notifications
Posted: Saturday 02 September 2017 23:20
by DomoJev
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.
Re: Add dynamic parameters to notifications
Posted: Sunday 03 September 2017 7:05
by Number8
I support this request. Would be great to add to the message the current value of the sensor that triggered the notification
Re: Add dynamic parameters to notifications
Posted: Sunday 03 September 2017 9:44
by rickvanakkeren
Yup, this one I like also!
Re: Add dynamic parameters to notifications
Posted: Wednesday 13 September 2017 20:53
by roblom
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.
Re: Add dynamic parameters to notifications
Posted: Thursday 28 December 2017 15:02
by funny0frank
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!
Re: Add dynamic parameters to notifications
Posted: Thursday 28 December 2017 15:13
by Egregius
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.
Re: Add dynamic parameters to notifications
Posted: Saturday 13 January 2018 13:03
by verbem
Is there a variable for the idx, like $name? have tried $device, $idx, no luck.
Re: Add dynamic parameters to notifications
Posted: Monday 15 January 2018 7:22
by lost
Egregius wrote: ↑Thursday 28 December 2017 15: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...
Re: Add dynamic parameters to notifications
Posted: Monday 15 January 2018 8:56
by Egregius
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.
Re: Add dynamic parameters to notifications
Posted: Monday 15 January 2018 13:26
by lost
Egregius wrote: ↑Monday 15 January 2018 8: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!
Re: Add dynamic parameters to notifications
Posted: Tuesday 20 November 2018 20:24
by Madgeni
verbem wrote: ↑Saturday 13 January 2018 13:03
Is there a variable for the idx, like $name? have tried $device, $idx, no luck.
does anyone know the answer to this? thanks
