Hi,
is this possible?
More detailed explanation:
I have 8 small buttons, these should directly control 8 devices.
Ex:
- Button 1 pressed should send http://ipaddress:8087/set/device.1?value=true
- Button 2 pressed should send http://ipaddress:8087/toggle/device.2
My steps:
- I flashed on an ESP32 mega-20221224_35f2ff8.
- Under Controllers I added a Generic HTTP device.
- Controller IP and Port filled out es needed.
- In Controler Publish i added %value%
- Under Devices I added 8 times Switch input - Switch
And now I hoped that under each Value of the Switch Device I enter the rest of the URl. So for example set/javascript.0.test?value=1 (and so on for each Button)
But that doesn't work, because no special characters like % / etc. are allowed.
I wonder, if this is possible?
Regards,
mike
Solved: 8 push buttons should send 8 different HTTP REST API calls
Moderators: grovkillen, Stuntteam, TD-er
Solved: 8 push buttons should send 8 different HTTP REST API calls
Last edited by mikel on 29 Jan 2023, 19:35, edited 1 time in total.
Re: 8 push buttons should send 8 different HTTP REST API calls
For this you should use the rules.
In tools->Advanced page you can enable the rules (almost at the top)
After saving, you need to open some other tab to see the rules option appear at the top.
Then you can act on events sent by each switch task.
In this block you can define a command using sendToHttp.
Just to be sure, you're not trying to call the same ESPEasy node in these calls, right?
Let's assume you named your switch task Button1:
In tools->Advanced page you can enable the rules (almost at the top)
After saving, you need to open some other tab to see the rules option appear at the top.
Then you can act on events sent by each switch task.
In this block you can define a command using sendToHttp.
Just to be sure, you're not trying to call the same ESPEasy node in these calls, right?
Let's assume you named your switch task Button1:
Code: Select all
on Button1#State=1 do
sendToHttp,ipaddress,8087,/set/device.1?value=true
endon
Re: 8 push buttons should send 8 different HTTP REST API calls
Thanks a lot! This is working very well.
I had never worked with the "rules" before.
Powerful tool.
Everything works fine in my test environment.
Regards
Mike
I had never worked with the "rules" before.
Powerful tool.
Everything works fine in my test environment.
Regards
Mike
Re: 8 push buttons should send 8 different HTTP REST API calls
See for more inspiration: https://espeasy.readthedocs.io/en/lates ... Rules.html

Glad it is working.

Glad it is working.
Who is online
Users browsing this forum: Bing [Bot] and 20 guests