SendToHTTP problem

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

SendToHTTP problem

#1 Post by nogin » 10 Nov 2019, 09:36

Hello!
There was a problem sending a Get request with the SendToHTTP command. I created a rule to send temperature data every 1.5 minutes to the site (Device Name = T; Values = Temperature):

On system # boot do
timerSet,1,90
endon
On Rules # Timer = 1 do
SendToHTTP open-monitoring.online,80,/get?Cid=....#&key=....&p1=[T#Temperature]
timerSet,1,90
endon

This works very poorly: data is sent once every few hours, or not sent at all. In the Log window, the sending is shown, but the data does not come to the site. When sending data via a browser from the same network, everything is OK. I tried the firmware mega-20190928 and mega-20191003. Please help me figure it out.

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

Re: SendToHTTP problem

#2 Post by TD-er » 10 Nov 2019, 10:29

It looks like you suffer from the same problem as with sending to thingspeak.
The sendtohttp command does not wait for a reply.

Can you transfer your sendtohttp into using one of the http controllers?

The sendtohttp command does need an update to force checking for a reply from the server.

nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

Re: SendToHTTP problem

#3 Post by nogin » 10 Nov 2019, 10:50

Thank you for the quick response.

I wanted to use an HTTP controller, but I don’t know how to make a different period for sending values via MQTT and HTTP. I need the data to be updated 18b20 every 10 seconds and sent via MQTT, and every 1.5 to 2 minutes there should be an additional sending via HTTP. If you can tell me how to do this, I will be very grateful.

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

Re: SendToHTTP problem

#4 Post by TD-er » 10 Nov 2019, 10:58

You can "copy" the values to a dummy device (TaskValueSet, see https://espeasy.readthedocs.io/en/lates ... mmand.html )
You call the 'run' of the dummy device by calling TaskRun
When it is "executed", it will send the data to the assigned controller.

So this way you can have 2 different intervals in sending to both controllers.

nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

Re: SendToHTTP problem

#5 Post by nogin » 10 Nov 2019, 11:05

In addition, the Generic HTTP controller, if I understood correctly, must include the "user" and "password" fields in the query string, but for open-monitoring.online this is unacceptable, it must be "cid" and "key"

nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

Re: SendToHTTP problem

#6 Post by nogin » 10 Nov 2019, 11:09

Thank! Using a Dummy device is a good idea. But what about the second question, so that the "user" and "pass" fields in the request body are not passed?

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

Re: SendToHTTP problem

#7 Post by TD-er » 10 Nov 2019, 11:20

nogin wrote: 10 Nov 2019, 11:09 Thank! Using a Dummy device is a good idea. But what about the second question, so that the "user" and "pass" fields in the request body are not passed?
That's something I don't yet know. I must have to look into the code to see what's possible there.
Maybe someone else has experience with both http controllers regarding the authentication?

nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

Re: SendToHTTP problem

#8 Post by nogin » 10 Nov 2019, 11:48

Я настроил контроллер таким образом:
Image

Это не работает :(

nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

Re: SendToHTTP problem

#9 Post by nogin » 10 Nov 2019, 11:51

Sorry, forgot to enable translation into English

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

Re: SendToHTTP problem

#10 Post by TD-er » 10 Nov 2019, 11:57

You have the 'check reply' set to exactly the same way as sendToHTTP is operating.
So try to set that to a value which does wait for a reply.

nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

Re: SendToHTTP problem

#11 Post by nogin » 10 Nov 2019, 12:17

Did not help. I looked at the _C008 plugin code, it’s installed there

Protocol [protocolCount] .usesAccount = true;
Protocol [protocolCount] .usesPassword = true;

If you change these values to false and rebuild the firmware in the Arduino IDE, will that help?

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

Re: SendToHTTP problem

#12 Post by TD-er » 10 Nov 2019, 13:43

I don't think so. If those field are empty, it should not generate an authentication header.
If it does, then I think we have a bug.

Have you also tested the other Advanced HTTP controller?

nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

Re: SendToHTTP problem

#13 Post by nogin » 10 Nov 2019, 17:42

No, I tested only Generic HTTP, because I used the normal_core assembly. Is Advanced HTTP available in test_core? I'll try to flash it when I get to the workplace. Thank!

nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

Re: SendToHTTP problem

#14 Post by nogin » 10 Nov 2019, 18:03

Unfortunately, there is no ready-made test_core assembly for ESP8266 1Mb in releases. Will have to collect yourself.

nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

Re: SendToHTTP problem

#15 Post by nogin » 11 Nov 2019, 15:34

Cannot compile test_core_1M. In ArduinIDE compiles, but after loading it cannot write the configuration file to FS, it does not compile in Platformio: fatal error.

nogin
Normal user
Posts: 18
Joined: 24 Mar 2019, 07:41

Re: SendToHTTP problem

#16 Post by nogin » 11 Nov 2019, 17:10

Image[/url]
[/img]

miot
New user
Posts: 2
Joined: 02 Dec 2018, 20:14

Re: SendToHTTP problem

#17 Post by miot » 22 Nov 2019, 14:43

Hi
The problem with the command

Code: Select all

SendToHTTP api.thingspeak.com,80,/update?api_key=<WRITE-KEY>&field1=0
only appears as of Release mega-20190813
Release mega-20190809 still works.

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests