Can not send event request via wget

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mackowiakp
Normal user
Posts: 531
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Can not send event request via wget

#1 Post by mackowiakp » 17 Sep 2019, 17:01

I want to send HTTP request from server to nodeMCU. Such request contain event call defined in rule. It is kind of watchdog. If nodeMCU will hang (because still sometimes occurs WiFi issue), rule reboot it. But the most strange thing is that it works for me in all another nodeMCU`s, but in this new one - no. The same SW - normal mega-20190827, the same HW. I just copy/paste rules but still HTTP request send via wget from server does not work on this particular unit. Wget shows OK as the result of transmission to nodeMCU. Below wget syntax and rule it should run in nodeMCU:

Code: Select all

wget -q -P /home/pi/ramdisk --delete-after --connect-timeout=2 --tries=5 "http://<ip>/control?cmd=event,$event"
# $event could be alive, reboot_on or reboot_off

Code: Select all

on alive do
  timerSet,7,1000
EndOn

on reboot_off do
  Let,16,1
endon

on reboot_on do
  Let,16,0
endon

on Rules#Timer=7 do
 if %v16% = 0
  Reboot
 endif
endon
I cleared flash using blank FW and downloaded config and rules again. What I have to do or check else?

Sensors defined:
- dummy quad
- 4x20 display
- generic uptime
- DS18b20
Additionally buzzer.

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

Re: Can not send event request via wget

#2 Post by grovkillen » 17 Sep 2019, 17:17

Try change this part:

Code: Select all

on Rules#Timer=7 do
 if %v16% = 0
  Reboot
 endif
endon
To this:

Code: Select all

on Rules#Timer=7 do
 if [VAR#16]=0
  Reboot
 endif
endon
The percentage variable is a string while the square brackets is a float value.
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:

mackowiakp
Normal user
Posts: 531
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Can not send event request via wget

#3 Post by mackowiakp » 17 Sep 2019, 17:28

OK. But - ironically - this reboot is done properly. After 1000 sec if there was not "alive" event (which starts timer no 7 again) it reboot device. So primary I have to say that even "alive", "reboot_off" and "reboot_on" does not work. "Reboot_off" assign variable no 16 to 1. But if I look to the wariable list in nodeMCU, only in this particular unit it is not set to 1. So basically event call does not work. Very strange because - as I wrote - it happens only in one device.

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

Re: Can not send event request via wget

#4 Post by grovkillen » 17 Sep 2019, 17:34

If you look on the web log, does any event pop up at all?
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:

mackowiakp
Normal user
Posts: 531
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Can not send event request via wget

#5 Post by mackowiakp » 17 Sep 2019, 17:46

Log does not contain any information about "alive" or other request. But it contain information about setting value of particular entry in dummy sensor by server (via wget and TasValueSet), using (on server) command like this:

Code: Select all

wget -q -O - "http://<ip>/control?cmd=TaskValueSet,1,2,$wyn"
So transmission between server and nodeMCU looks ok.

mackowiakp
Normal user
Posts: 531
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Can not send event request via wget

#6 Post by mackowiakp » 17 Sep 2019, 17:52

EDIT

Running command "event,reboot_off" (and others) from tools menu by hand, works properly.

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

Re: Can not send event request via wget

#7 Post by grovkillen » 17 Sep 2019, 17:54

I guess (and only guess) that your value $event isn't set correctly in your script.

Try hard code it as a test.
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:

mackowiakp
Normal user
Posts: 531
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Can not send event request via wget

#8 Post by mackowiakp » 17 Sep 2019, 18:00

It is impossible. I do it in a loop the same for 8 devices. One thing that changes in the loop is the device's IP address. Of course, I was first looking for a mistake there. And that's why I set wget to work in "very verbose" mode. Each data transfer to individual devices ends in "OK" status. Including the "damn"

mackowiakp
Normal user
Posts: 531
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Can not send event request via wget

#9 Post by mackowiakp » 17 Sep 2019, 18:03

Probably I found out what is wrong. Give me several minutes to test it.

mackowiakp
Normal user
Posts: 531
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Can not send event request via wget

#10 Post by mackowiakp » 17 Sep 2019, 18:29

Yep. Problem solved. I use dnsmasq server on RPi, as DNS for LAN name resolution. From unknown reasons it does not like name "test". I just named this "fatal" unit as "test". If I replace name with IP address in loop, it started to work OK. Solution - upgrade dnsmasq facility to the newest version available. Now works OK even with "test" name. THX for Your support !

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

Re: Can not send event request via wget

#11 Post by grovkillen » 18 Sep 2019, 08:36

Happy to have "helped" :)
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:

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests