value with the date and time.

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Dondolo
Normal user
Posts: 77
Joined: 03 Jul 2019, 06:56
Location: Germany

value with the date and time.

#1 Post by Dondolo » 18 Jan 2020, 21:27

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%

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: value with the date and time.

#2 Post by grovkillen » 18 Jan 2020, 22:21

You might need to have it as URL syntax?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Dondolo
Normal user
Posts: 77
Joined: 03 Jul 2019, 06:56
Location: Germany

Re: value with the date and time.

#3 Post by Dondolo » 18 Jan 2020, 23:29

ok thanks, what does that mean?
What should I do?

User avatar
ThomasB
Normal user
Posts: 1214
Joined: 17 Jun 2018, 20:41
Location: USA

Re: value with the date and time.

#4 Post by ThomasB » 19 Jan 2020, 00:01

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

User avatar
dynamicdave
Normal user
Posts: 258
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: value with the date and time.

#5 Post by dynamicdave » 19 Jan 2020, 08:28

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.

Dondolo
Normal user
Posts: 77
Joined: 03 Jul 2019, 06:56
Location: Germany

Re: value with the date and time.

#6 Post by Dondolo » 19 Jan 2020, 10:10

Oh yes, both works, thank you very much!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests