Page 1 of 1

help about a rule

Posted: 18 Aug 2021, 01:32
by reza
hi guys
i want have a rule for when espeasy is connect to wifi.
i am using this code but dont work :

Code: Select all

on WiFi#Connected do
SendToHTTP 192.168.1.201,8080,/json.htm?type=command&param=switchlight&idx=25&switchcmd=On
SendToHTTP 192.168.1.142,80,/control?cmd=EXTGPIO,2,1
endon
i want every time my esp connect to my network , so sent 2 http command for 2 devices.
means this rule and this device is a "ping sensor" for me.
can you help me for found problem of this rule ?

Re: help about a rule

Posted: 18 Aug 2021, 01:49
by TD-er
Two ideas of what might be going on here:
- Maybe you need to start some short timer here (1 or 2 seconds) before trying to send out data.
- Check the checkbox on Tools->Advanced to wait for an acknowledgement for sendToHttp

Also double check to see if you need to include credentialswhen using Domoticsz (as it seems to be a Domoticz call on the first line)
You may also want to consider using MQTT for Domoticz as that's way more reliable and responsive.

Re: help about a rule

Posted: 18 Aug 2021, 11:17
by reza
TD-er wrote: 18 Aug 2021, 01:49 Two ideas of what might be going on here
please let me i remove line about domoticz , and just a connection between 2 espeasy nodes with a router(access point) . this code :

Code: Select all

on WiFi#Connected do
SendToHTTP 192.168.1.142,80,/control?cmd=EXTGPIO,2,1
endon
also i test with a timer but dont work. this code :

Code: Select all

on WiFi#Connected do
timerSet,1,3
endon

On Rules#Timer=1 do
SendToHTTP 192.168.1.142,80,/control?cmd=EXTGPIO,2,1
endon
but this strange because after reset, this code work:

Code: Select all

on System#Boot do
SendToHTTP 192.168.1.142,80,/control?cmd=EXTGPIO,2,1
endon
but with"on WiFi#Connected do" dont work after reset !
i am using espeasy v2.0.0 . thank you for help

Re: help about a rule

Posted: 18 Aug 2021, 11:46
by Ath
ESPEasy 2.0.0 isn't very conclusive as a version, best would be to name the Binary Filename like ESP_Easy_mega_<builddate>_normal_ESP8266... that is installed on the unit, you can find that about half-way down the Info page.