%systime% not working in controller & NTP issue

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
BigAndi
New user
Posts: 3
Joined: 12 Jan 2018, 19:17

%systime% not working in controller & NTP issue

#1 Post by BigAndi » 12 Jan 2018, 19:45

Hello all!

(I'm using Release v2.0-20180112, same is with Release v2.0-20180111, not tried older versions)

I use a Mini D1 ESP8266 module with two sensors, a BMP280 and a SI7021. The data is collected in a SQLite3 database on a Raspberry Pi3. Therefore i configured a controller with Generic HTTP.
The Controller publish string is "wetterstation/sensorwrite.php?ssn=%sysname%&stn=%tskname%&svn=%valname%&sv=%value%&sntp=%systime%". So far this is working except for the %systime%.

In the SQLite database the values are written correctly, but in my field "sd_ntp_time" there is no time but the string "%systime%". In the main page i can see the current local time, when NTP is enabled.

The NTP-function seems to have another bug. I use my ESPs from external places via a DynDNS service. When NTP is enabled, i can not address my ESP, every time i try this, i get an "IP blocked: ip.ad.dr.ess."
With not NTP enabled, i can login to the ESP from external...

Is there a way to fix this issues?

Greetings,
Andi

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: %systime% not working in controller & NTP issue

#2 Post by TD-er » 12 Jan 2018, 20:51

%systime% does work with the OLED display, so it is a valid variable.
However, it contains a ":", which I think is not allowed in a URL (it may be used in a hostfile to separate the port, but not sure about the rest of an URL)

But I think I found your problem:
In C008 (Generic HTTP) is the following source code, with a very clear comment ;)

Code: Select all

  //TODO: move this to a generic replacement function?
  url.replace(F("%sysname%"), URLEncode(Settings.Name));
  url.replace(F("%tskname%"), URLEncode(ExtraTaskSettings.TaskDeviceName));
  url.replace(F("%id%"), String(event->idx));
  url.replace(F("%valname%"), URLEncode(ExtraTaskSettings.TaskDeviceValueNames[varIndex]));
  if (longValue)
    url.replace(F("%value%"), String(longValue));
  else
    url.replace(F("%value%"), toString(value, ExtraTaskSettings.TaskDeviceValueDecimals[varIndex]));
As you can see "%systime%" is not in this list.
Could you please add an issue about this on the Github page?

BigAndi
New user
Posts: 3
Joined: 12 Jan 2018, 19:17

Re: %systime% not working in controller & NTP issue

#3 Post by BigAndi » 12 Jan 2018, 22:58

But I think I found your problem:
In C008 (Generic HTTP) is the following source code, with a very clear comment ;)

//TODO: move this to a generic replacement function?
url.replace(F("%sysname%"), URLEncode(Settings.Name));
url.replace(F("%tskname%"), URLEncode(ExtraTaskSettings.TaskDeviceName));
url.replace(F("%id%"), String(event->idx));
url.replace(F("%valname%"), URLEncode(ExtraTaskSettings.TaskDeviceValueNames[varIndex]));
if (longValue)
url.replace(F("%value%"), String(longValue));
else
url.replace(F("%value%"), toString(value, ExtraTaskSettings.TaskDeviceValueDecimals[varIndex]));
As you can see "%systime%" is not in this list.
Could you please add an issue about this on the Github page?
Done :) . Thank you for your help!

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests