JSON multiple devices
Moderators: grovkillen, Stuntteam, TD-er
JSON multiple devices
I want to execute this script http://ip:port/json.htm?type=command¶m=clearlightlog&idx=<idx> using a button in domoticz. Pushing the "ON" it must execute this script for multiple devices. It works for one already (http://ip:port/json.htm?type=command¶m=clearlightlog&idx=200) but now i want to execute it also for IDX 24 . I can I get that working?
Re: JSON multiple devices
Temporary solution for me is a selector switch to start the "
http://127.0.0.1:8080/json.htm?type=com ... log&idx=29"
for each individual idx. Again has somebody any clue how to hget these individual JSON entries
"http://127.0.0.1:8080/json.htm?type=com ... log&idx=29"
in one LUA script?
http://127.0.0.1:8080/json.htm?type=com ... log&idx=29"
for each individual idx. Again has somebody any clue how to hget these individual JSON entries
"http://127.0.0.1:8080/json.htm?type=com ... log&idx=29"
in one LUA script?
Re: JSON multiple devices
is this the right direction to solve this problem:
--log cleanup
If (devicechanged['logSwitch']== "On") then
os.execute('curl -s "http://127.0.0.1:8080/json.htm?type=com ... log&idx=20" &')
end
return commandArray
It does not work but still trying to find a solution.
--log cleanup
If (devicechanged['logSwitch']== "On") then
os.execute('curl -s "http://127.0.0.1:8080/json.htm?type=com ... log&idx=20" &')
end
return commandArray
It does not work but still trying to find a solution.
Re: JSON multiple devices
now I tried to place them in RULES of my esp like this
On clean_log#state do
[GPIO12#State] = 1
SendToHTTP 127.0.0.1,8080,/json.htm?type=command¶m=clearlightlog&idx=29
endon
But still no luck.
Any advise is welcome!
On clean_log#state do
[GPIO12#State] = 1
SendToHTTP 127.0.0.1,8080,/json.htm?type=command¶m=clearlightlog&idx=29
endon
But still no luck.
Any advise is welcome!
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: JSON multiple devices
Have you studied the rules syntax? https://espeasy.readthedocs.io/en/lates ... Rules.html
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: JSON multiple devices
Plus, have you considered using MQTT? HTTP is one to one. MQTT is ideal for this scenario with multiple listeners to an event.
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: JSON multiple devices
Thanks for the reply and yes I have already read the Rules documentation several time but, this evening again. Perhaps you are right to start with MQTT. I must find a good starting point for MQQT in combi with ESP. Will put some effort in it the upcoming week.
About the rules, this I what I have for now
On clean_logs#state=1 do
SendToHTTP 127.0.0.1,8080,/json.htm?type=command¶m=clearlightlog&idx=29
endon
and the HTTP is send out by the ESP, the ipx is correct and the name of the button as well. If I launch this rule, I see in Domoticz no errors but nothing happens. Because with this JSON command, a logfile need to be cleaned.
Any idea?
About the rules, this I what I have for now
On clean_logs#state=1 do
SendToHTTP 127.0.0.1,8080,/json.htm?type=command¶m=clearlightlog&idx=29
endon
and the HTTP is send out by the ESP, the ipx is correct and the name of the button as well. If I launch this rule, I see in Domoticz no errors but nothing happens. Because with this JSON command, a logfile need to be cleaned.
Any idea?
Re: JSON multiple devices
Does the URL work like you expect when executed from the browser?
Re: JSON multiple devices
Good point. tested and Result=OK.
Also mentioned that in Domoticz an switch is working if turned on using
http://127.0.0.1:8080/json.htm?type=com ... log&idx=29
But in a rule it does not work (adjusted to the Rules requirements)
Also mentioned that in Domoticz an switch is working if turned on using
http://127.0.0.1:8080/json.htm?type=com ... log&idx=29
But in a rule it does not work (adjusted to the Rules requirements)
Re: JSON multiple devices
Can you als test if it is working when calling it from a http controller?
If so, then it may be another example of the sendtohttp which needs to wait for a reply/acknowledgement.
If so, then it may be another example of the sendtohttp which needs to wait for a reply/acknowledgement.
Who is online
Users browsing this forum: No registered users and 32 guests