Hi!
how i can get current system time predicate, like “now is $time” to send it in mail?
thanks
-
Getting current system time predicate
-
Hi,
you can use:
"now is {date()}"
. See also pimatic/pimatic#145. -
Can you give an example how to use the format attribute?
I tried it in a rule with
it is {date(‘YYYY-MM-DD hhss’)} but the rule parser didn’t accept this.
Further more I tried to use date() in a VariablesDevice like
{ "id": "testDevice", "name": "testDevice", "class": "VariablesDevice", "variables": [ { "name": "testvar1", "expression": "it is date()", "type": "string" } ] },
This gives ‘Could not parse expression’. date() alone in the expression without other text works.
-
What do you want to archive with the rule?
For the VariableDevice (untested):
{ "id": "testDevice", "name": "testDevice", "class": "VariablesDevice", "variables": [ { "name": "testvar1", "expression": "\"it is {date()}\"", "type": "string" } ] },
-
Ah, the string needs the quotes. Thanks a lot! But how to use a format?
-
"expression": "\"it is {date(\"YYYY-MM-DD hh:mm:ss\")}\"",