Page 1 of 1
How can I send time and date in message text?
Posted: Monday 18 December 2023 19:02
by Scholler
Hi all,
I am new in using the Blockly editor for creating actions.
Now I successfully managed to send an email in case of e.g. a door open or close action.
How can I insert the time (and date) of the moment it happened in the message text? See attached picture in the red box.
Is there a way to use a variable, maybe together with a way of formatting the output?
Thank you all for helping

Re: How can I send time and date in message text?
Posted: Tuesday 19 December 2023 10:18
by willemd
As far as I know Blockly can only handle static email text.
So not an answer but: I strongly advice you to learn dzVents. Much more powerful than blockly. Easy to include date and time in a message.
A slightly higher lurning curve but then .....
Re: How can I send time and date in message text?
Posted: Tuesday 19 December 2023 13:38
by HvdW
willemd wrote: ↑Tuesday 19 December 2023 10:18
I strongly advice you to learn dzVents. Much more powerful than blockly. Easy to include date and time in a message.
I strongly agree with @willemd
An example of including current time:
Code: Select all
if domoticz.data.value_9 > 1.48 * domoticz.data.value_0 then
-- switch off Plug Switch
local current_time = os.date("%c")
domoticz.devices(CHARGER_SWITCH).switchOff()
local subject = 'Your battery has been charged. '
local message =
' ' .. current_time .. '\n'..
'Plug Switch value_10: ' .. domoticz.data.value_10 .. '\n'..
domoticz.notify(subject, message, domoticz.PRIORITY_NORMAL)
end
Here are some examples. It helped me a lot to master dzVents.
Re: How can I send time and date in message text?
Posted: Tuesday 19 December 2023 13:48
by waltervl
These examples are a little bit more up to date
examples from Domoticz github
Also in the dzVents subforum loads of examples
viewforum.php?f=59
And of course the dzVents Wiki that also has a lot of examples in it:
https://www.domoticz.com/wiki/DzVents:_ ... _scripting