Page 1 of 1
Change status on switch from ESPEasy
Posted: Sunday 17 March 2019 20:48
by ulfh2018
I have seen this question adressed before, and they say there is a solution but as far as I can see, it does not work. I have a virtual switch and I want to change the status from ESP Easy. I am using the commands
SendToHTTP x.x.x.x,8080,/json.htm?type=command¶m=udevice&idx=10&nvalue=1
and
SendToHTTP x.x.x.x,8080,/json.htm?type=command¶m=udevice&idx=10&nvalue=0
Both commands turns the switch off, so how can I turn it on?
Have tried with svalue On / Off - same problem
Best regards
Ulf
Re: Change status on switch from ESPEasy
Posted: Sunday 17 March 2019 21:51
by kimot
And where did you find this command format again?
It should be:
SendToHTTP x.x.x.x,8080,/json.htm?type=command¶m=switchlight&idx=26&switchcmd=On
It 100% works.
Always read Domoticz JSON/API documentation :
https://www.domoticz.com/wiki/Domoticz_ ... Fswitch_on
Re: Change status on switch from ESPEasy
Posted: Sunday 17 March 2019 22:19
by ulfh2018
Thank you. Tried this before, and it did not work, but I have tested again manually, and it works, so there must be something wrong with the logic in my rules. I'll check it out tomorrow.
BTW the other syntax I found using google.
Re: Change status on switch from ESPEasy
Posted: Thursday 28 March 2019 15:55
by wvries
Curious: why do you not use the Device tab in the web interface of ESPEASY and enter the IDX etc in there ?
I am working with about 15 different ESP's with different setups and all running ESPEasy.... using tis method to update switches.
Re: Change status on switch from ESPEasy
Posted: Thursday 28 March 2019 23:20
by kimot
Curious too:
How you change switch status in Domoticz from rules using device tab?
For example indicating that temperature is below certain level or heater is heating?
Re: Change status on switch from ESPEasy
Posted: Friday 29 March 2019 8:45
by ulfh2018
I have changed the whole project, and I'm now using Telldus sensors and RFXtrx433XL. Had a problem with wireless connections and stability at some of the rooms, but RF at 433 MHz is working perfec. I also changed and control everything from using the IDX.
When I used rules, it would look like this:
on BadNede do
TaskValueSet 2,1,%eventvalue%
if [Variables#Soverom1]>32
TaskValueSet,2,1,32
endif
timerSet,1,5
if [%eventvalue%] <= [Floor#Bad-Nede]
TaskValueSet 5,1,1
gpio 16,1
SendToHTTP 10.0.0.89,8080,/json.htm?type=command¶m=switchlight&idx=10&switchcmd=On
endif
if [%eventvalue%] > [Floor#Bad-Nede]
TaskValueSet 5,1,0
gpio 16,0
SendToHTTP 10.0.0.89,8080,/json.htm?type=command¶m=switchlight&idx=10&switchcmd=Off
endif
endon
on Soverom1 do
TaskValueSet 2,3,%eventvalue%
if [Variables#Soverom1]>32
TaskValueSet,2,3,32 // Verdi til Soverom1
endif
TaskValueSet 2,4,([Variables#Soverom1]-[Room#Soverom-1])
timerSet,1,5
if [%eventvalue%] <= [Room#Soverom1]
TaskValueSet 1,1,1
gpio 16,1
SendToHTTP 10.0.0.89,8080,/json.htm?type=command¶m=switchlight&idx=11&switchcmd=On
endif
timerSet,1,5
if [%eventvalue%] > [Room#Soverom1]
TaskValueSet 1,1,0
gpio 16,0
SendToHTTP 10.0.0.89,8080,/json.htm?type=command¶m=switchlight&idx=11&switchcmd=Off
endif
endon