Page 1 of 1

value with the date and time.

Posted: 18 Jan 2020, 21:27
by Dondolo
I want to send a value with a timestamp. I use sendtohttp and mqqt for this.

When I use the system variables "%lcltime% or %lcltime_am% only the date comes but not the time.

What am I doing wrong?
Greetings Dondolo
(mega-20191104)

SendToHTTP 192.xxx.xxx.xx,80,control?cmd=event,Wasser
SendToHTTP 192.xxx.xxx.xx,80,control?cmd=event,Time=%lcltime_am%
Publish %sysname%/Wassermeldung,Wasser
Publish %sysname%/Wlanstärke,%rssi%
Publish %sysname%/Zeitstempel,%lcltime_am%

Re: value with the date and time.

Posted: 18 Jan 2020, 22:21
by grovkillen
You might need to have it as URL syntax?

Re: value with the date and time.

Posted: 18 Jan 2020, 23:29
by Dondolo
ok thanks, what does that mean?
What should I do?

Re: value with the date and time.

Posted: 19 Jan 2020, 00:01
by ThomasB
Maybe the space between date and time is being interpreted as a parsing character. So try wrapping the var parameter with single quotes. Like this:

Code: Select all

Publish %sysname%/Zeitstempel,'%lcltime_am%'
- Thomas

Re: value with the date and time.

Posted: 19 Jan 2020, 08:28
by dynamicdave
You can also take it a stage further and publish it as a json string.
That means you could pack a number of data-items in the string.
Here's an example from one of my rule-sets.

Publish,node24/ir_detector,'{"ssid":"%ssid%","node_number":"node%unit%"}'

Notice the placing of the single quote marks around the json string.

Re: value with the date and time.

Posted: 19 Jan 2020, 10:10
by Dondolo
Oh yes, both works, thank you very much!