Page 1 of 1
http request doesn't alter value
Posted: 10 Aug 2019, 21:06
by obod0002c
Dear ESPEasy professional,
being a newbie to this great software, I have a problem which I thought I had solved, but it's back:
when sending http requests I can easily activate the relais of my ESP using a browser, e.g.
http://<ip>/control?cmd=gpio,4,1
But when trying to alter a value it doesn't work (anymore):
http://<ip>/control?cmd=event,httpvalue=5
gives me a nice OK-reply but the cvalue hasn't change when I reload the devices tab
Thanks for help
- header.jpg (12.57 KiB) Viewed 9415 times
- devices.jpg (12.39 KiB) Viewed 9415 times
I thought I had it working already, but now it's not. Could it be 'cause I altered the RulesSet?
I'm using mega-20190630.
Thanks for help
Re: http request doesn't alter value
Posted: 10 Aug 2019, 21:29
by grovkillen
Sorry but I can't set the rules you're using. Please attach them in a "code" syntax.
Re: http request doesn't alter value
Posted: 10 Aug 2019, 21:46
by Shardan
Hm...
Honestly I can't see what you're doing with the "event,httpvalue=5" command in your rules...
"event" creates an event so you can for example test what happens if a temperature goes to a certain value.
For changing a dummy value I'd use TaskValueSet, in your example "TaskValueSet,3,1,5"
(Task 3, Value 1, set to 5)
Re: http request doesn't alter value
Posted: 10 Aug 2019, 23:38
by obod0002c
grovkillen wrote: ↑10 Aug 2019, 21:29
Sorry but I can't set the rules you're using. Please attach them in a "code" syntax.
A bit lengthy hence I thought a zip could be better.
As requested:
Code: Select all
on System#Boot do
gpio,4,0 // sicherheitshalber
TaskValueSet 2,1,2
// 2 = Task# in "Devices"
// 1 = erste Variable=Anzahl
// 2x Bewässern tgl. = default
endon
On Clock#Time=All,06:00 do
if [Bewaesserung#Anzahl] >= 1
gpio,4,1 // Relais ein
gpio,13,1 // rote LED ein
timerSet,1,75 // Timer auf 75 Sekunden setzen
endif
endon
On Clock#Time=All,16:00 do
if [Bewaesserung#Anzahl] >= 2
gpio,4,1 // Relais ein
gpio,13,1 // rote LED ein
timerSet,1,75 // Timer auf 75 Sekunden setzen
endif
endon
On Clock#Time=All,12:00 do
if [Bewaesserung#Anzahl] >= 3
gpio,4,1 // Relais ein
gpio,13,1 // rote LED ein
timerSet,1,75 // Timer auf 75 Sekunden setzen
endif
endon
On Clock#Time=All,22:00 do
if [Bewaesserung#Anzahl] = 4
gpio,4,1 // Relais ein
gpio,13,1 // rote LED ein
timerSet,1,75 // Timer auf 75 Sekunden setzen
endif
endon
On Rules#Timer=1 do
gpio,4,0 // Ende Bewässerung
gpio,13,0 // rote LED aus
endOn
Re: http request doesn't alter value
Posted: 11 Aug 2019, 12:03
by grovkillen
Yes, like Shardan is pointing out, you haven't crashed an event. Maybe talk value set and run would be better?
Re: http request doesn't alter value
Posted: 11 Aug 2019, 16:33
by obod0002c
sorry guys, but I don't understand what you're talking of. I'll try and put it in other words so maybe you understand me:
I simply want to set/alter a variable using an http command like this one
http://<ip>/control?cmd=event,<eventName>=<eventValue>
Thought the way to get it done was:
1. create a 'Generic - Dummy Device' and name it <eventName> and enable the device
2. name first variable to e.g. v1
3. set/alter the variable using http://<ip>/control?cmd=event,<eventName>=<eventValue>
4. new variable's value should now be visible in the device's section in column 'Values'
5. usage of the previously set variable in one of the rules, e.g. if [eventName#v1] = 1
But even step 4. doesn't work, hence step 5. not, too.
Re: http request doesn't alter value
Posted: 11 Aug 2019, 18:34
by ThomasB
I simply want to set/alter a variable using an http command like this one
http://<ip>/control?cmd=event,<eventName>=<eventValue>
Changing a dummy var's value does not use a
event command. It uses the
taskvalueset command.
Working example:
Your screenshot shows the dummy var (httpvalue) is task #
3. The value name (value1) is var #
1.
If you wanted to change the dummy var's value to 5 then it would use this syntax:
Sending this via http would be like this:
Code: Select all
http://<espeasyip>/control?cmd=taskvalueset,3,1,5
- Thomas
Re: http request doesn't alter value
Posted: 12 Aug 2019, 12:28
by obod0002c
ThomasB wrote: ↑11 Aug 2019, 18:34
Changing a dummy var's value does not use a event command. It uses the taskvalueset command.
Thank you very much, I was so focussed on the 'event' that I didn't see how straight forward the solution could be.