How can I send time and date in message text?

Moderator: leecollings

Post Reply
Scholler
Posts: 6
Joined: Thursday 24 November 2016 13:18
Target OS: Linux
Domoticz version: latest
Contact:

How can I send time and date in message text?

Post 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 :-)
Attachments
domoticz-blockly.png
domoticz-blockly.png (22.12 KiB) Viewed 2021 times
willemd
Posts: 630
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: How can I send time and date in message text?

Post 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 .....
HvdW
Posts: 539
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: How can I send time and date in message text?

Post 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.
Bugs bug me.
User avatar
waltervl
Posts: 5397
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: How can I send time and date in message text?

Post by waltervl »

HvdW wrote: Tuesday 19 December 2023 13:38
Here are some examples. It helped me a lot to master dzVents.
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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests