Page 1 of 1

current time in notifications

Posted: Sunday 05 May 2019 13:11
by DennisBradenton
Hi there,

is there an option to add the "current time" into a notification?
Or update a user variable with the "current time" (what could later be used in a notification) when Event was triggered?
Well, i got it to work the way i wanted it too with a dzvents script.

In case someone is looking for this as well:

First i created a user variable called "current time"

Then i created the dzvents script:

Code: Select all

local Time = require('Time')
local now = Time()
return {
   active = true,
   on = {
      devices = {'*'},
   },
   execute = function(domoticz, item, triggerInfo)
     domoticz.variables('current time').set(Time().raw)
   end
}
In my Blockly notification i used the user variable "current time" as message.
Thanks,
Dennis

Re: current time in notifications

Posted: Sunday 05 May 2019 13:17
by gizmocuz
I only have experience with email and push notifications (pushover for example), and in those systems the time is already added
You see the time the email was received, you see the time a push notification is received in the notification application

What notification system are you using that does not display the received time somehow ?

Re: current time in notifications

Posted: Sunday 05 May 2019 14:07
by DennisBradenton
i am using the domoticz for android. If i only have 1 notification it shows like ( x minutes ago) but as soon as i have 2 or more the time disappears.
Screenshot_20190505_140949_com.huawei.android.launcher.jpg
Screenshot_20190505_140949_com.huawei.android.launcher.jpg (192.77 KiB) Viewed 1775 times
Screenshot_20190505_140900_com.huawei.android.launcher.jpg
Screenshot_20190505_140900_com.huawei.android.launcher.jpg (194.92 KiB) Viewed 1775 times

Re: current time in notifications

Posted: Sunday 05 May 2019 15:00
by DennisBradenton
Well, i got it to work the way i wanted it too with a dzvents script.
Screenshot_20190505_150405_com.huawei.android.launcher.jpg
Screenshot_20190505_150405_com.huawei.android.launcher.jpg (203.6 KiB) Viewed 1769 times
In case someone is looking for this as well:

First i created a user variable called "current time"

Then i created the dzvents script:

Code: Select all

local Time = require('Time')
local now = Time()
return {
   active = true,
   on = {
      devices = {'*'},
   },
   execute = function(domoticz, item, triggerInfo)
     domoticz.variables('current time').set(Time().raw)
   end
}
In my Blockly notification i used the user variable "current time" as message.


-Dennis