Rule command issue.

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Rule command issue.

#1 Post by budman1758 » 12 Dec 2022, 19:25

I have a simple rule that fires at sunset and sunrise every day. One of the commands does not work in the rule but works fine in the command line on the tools page.

Code: Select all

 sendtohttp,'http://192.168.1.81:80/win&T=1'
That command turns on and off a WLED instance on another unit. 0 or 1 at the end will turn on or off. Any idea why it works fine from command line but not from a rule? I'm stumped. :?:

https://kno.wled.ge/interfaces/http-api/
"The glass is twice as big as it needs to be".

User avatar
Ath
Normal user
Posts: 3513
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Rule command issue.

#2 Post by Ath » 12 Dec 2022, 20:47

Have you tried to use the 'old' format for SendToHTTP?

Code: Select all

SendToHTTP,192.168.1.81,80,/win&T=1
As the new format requires a quite recent release of ESPEasy.

It's also a bit worrying that they don't follow the regular url argument separators, first one should be a '?' and second and next a '&', but it is as documented, so that *should* work :)

And also, you could try to send it from the Tools page for testing, and see if it is accepted by ESPEasy or not.
/Ton (PayPal.me)

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Rule command issue.

#3 Post by budman1758 » 13 Dec 2022, 01:38

Seems the "old" format works fine. Pretty new build this is working on.... :o
I have no idea why I didn't try that.... :oops: :oops:
Works in rules and command line on tools page.
Attachments
Build.jpg
Build.jpg (52.41 KiB) Viewed 2823 times
"The glass is twice as big as it needs to be".

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

Re: Rule command issue.

#4 Post by TD-er » 13 Dec 2022, 08:42

The 'new' format also doesn't work on the command field on the Toolspage?

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

Re: Rule command issue.

#5 Post by TD-er » 13 Dec 2022, 08:46

This one was merged 12 days ago: https://github.com/letscontrolit/ESPEasy/pull/4365
So maybe best to check with a newer build? :)
For example this one: https://github.com/letscontrolit/ESPEas ... 3660056475

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Rule command issue.

#6 Post by budman1758 » 13 Dec 2022, 19:34

TD-er wrote: 13 Dec 2022, 08:42 The 'new' format also doesn't work on the command field on the Toolspage?
New format DOES work on the tools page.
"The glass is twice as big as it needs to be".

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

Re: Rule command issue.

#7 Post by TD-er » 13 Dec 2022, 23:29

Hmm that's strange.
Have you tried this using the latest build I linked ?

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Rule command issue.

#8 Post by budman1758 » 14 Dec 2022, 06:42

TD-er wrote: 13 Dec 2022, 23:29 Hmm that's strange.
Have you tried this using the latest build I linked ?
Not yet. Will try to in a day or so. Wife has other things in mind for me..... :roll:
"The glass is twice as big as it needs to be".

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Rule command issue.

#9 Post by budman1758 » 14 Dec 2022, 23:30

OK. Using the action build @TD-er linked.

Code: Select all

sendtohttp,'http://192.168.1.81:80/win&T=1'

This does NOT work from rules. It DOES work from command line in the tools page. Relevant log entry...

Code: Select all

420807: EVENT: Clock#Time=Wed,14:14
420919: ACT : sendtohttp,'http:
420923: SendToHTTP: Invalid port argument: 0 will use: 80
420928: HTTP : SendToHTTP GET... failed HTTP code: -1 connection failed
420936: EVENT: http#=-1

Code: Select all

SendToHTTP,192.168.1.81,80,/win&T=1
This works from the command line on the tools page. It also works from rules.
So basically, the new format does NOT work from rules. At least as far as this particular command. The actual rule I am testing is this.
I just change the time as needed.

Code: Select all

On Clock#Time=all,14:25 Do
  SendToHTTP,192.168.1.81,80,/win&T=1
Endon
OR

Code: Select all

On Clock#Time=all,14:25 Do
sendtohttp,'http://192.168.1.81:80/win&T=1'
Endon
"The glass is twice as big as it needs to be".

User avatar
Ath
Normal user
Posts: 3513
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Rule command issue.

#10 Post by Ath » 15 Dec 2022, 07:36

Can you try while removing the ":80" port number from the URL, like this:

Code: Select all

On Clock#Time=all,14:25 Do
sendtohttp,'http://192.168.1.81/win&T=1'
Endon
/Ton (PayPal.me)

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Rule command issue.

#11 Post by budman1758 » 15 Dec 2022, 18:23

Ath wrote: 15 Dec 2022, 07:36 Can you try while removing the ":80" port number from the URL, like this:

Code: Select all

On Clock#Time=all,14:25 Do
sendtohttp,'http://192.168.1.81/win&T=1'
Endon
No workie.

Code: Select all

EVENT: Clock#Time=Thu,9:20
69180823: ACT : sendtohttp,'http:
69180827: SendToHTTP: Invalid port argument: 0 will use: 80
69180833: HTTP : SendToHTTP GET... failed HTTP code: -1 connection failed
69180840: EVENT: http#=-1
"The glass is twice as big as it needs to be".

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 131 guests