Page 1 of 1

Sendtohttp - domoticz json

Posted: 18 Jun 2016, 08:47
by hamster
I'm trying to use a PIR connected to my esp to make a switch connected to domoticz (esp12e with 108 running)

Using the sendtohttp I added the following rule


on Landing_PIR#Switch=1 do
sendtohttp,192.168.0.93,8080,/json.htm? type=command&param=switchlight&idx=42&switchcmd=On
endon

However when I press submit the text is changed as below

on Landing_PIR#Switch=1 do
sendtohttp,192.168.0.93,8080,/json.htm?
type=command¶m=switchlight&idx=42&switchcmd=On
endon

Can anyone make any suggestions? As it replaces '&para' to ¶
Also if I remove the 2nd a within param it submits ok without changing anything but this obviously doesn't work??

Many thanks

Re: Sendtohttp - domoticz json

Posted: 19 Jun 2016, 22:58
by hamster
instead of using sendtohttp I found 'publish' works brilliantly :D

on Landing_PIR#Switch=1 do
if [lux#lux]<2
Publish domoticz/in,{"idx":42,"command":"switchlight","switchcmd":"On"}
timerSet,2,20
endon
On Rules#Timer=2 do
Publish domoticz/in,{"idx":42,"command":"switchlight","switchcmd":"Off"}
endon

Re: Sendtohttp - domoticz json

Posted: 16 Dec 2016, 22:50
by Jeff
I have exactly the same problem.
The publish doesn't work for me, I can not do it

When i do this an i push "submit"

Code: Select all

On BP#Switch=1 do
SendToHTTP 192.168.1.12,8080,/json.htm?type=command&paramm=switchlight&idx=46&switchcmd=On
endon
I get this

Code: Select all

On BP#Switch=1 do
SendToHTTP 192.168.1.12,8080,/json.htm?type=command¶mm=switchlight&idx=46&switchcmd=On
endon
Version R147

Re: Sendtohttp - domoticz json

Posted: 17 Dec 2016, 15:29
by vmfs1968
hamster wrote:instead of using sendtohttp I found 'publish' works brilliantly :D

on Landing_PIR#Switch=1 do
if [lux#lux]<2
Publish domoticz/in,{"idx":42,"command":"switchlight","switchcmd":"On"}
timerSet,2,20
endon
On Rules#Timer=2 do
Publish domoticz/in,{"idx":42,"command":"switchlight","switchcmd":"Off"}
endon

Hello
Can you give a help how to activate mqtt in domoticz
It's just that I can not do this.

Re: Sendtohttp - domoticz json

Posted: 26 Dec 2016, 18:30
by Westcott
Hi Jeff,
I think you have an extra character, perhaps by using copy&paste from Windows?

SendToHTTP 192.168.1.12,8080,/json.htm?type=command¶mm=switchlight&idx=46&switchcmd=On

Perhaps edit the rule to delete a couple of chars back from the '=', and re-add the '&param'.

EDIT!!!
Sorry, I spoke too soon. Ignore the above.
For some reason the exact string "&param" is displayed as "¶m"
Delete one of the two "m" and it seems to work OK

Re: Sendtohttp - domoticz json

Posted: 08 Jan 2017, 19:08
by DMeekelenkamp
I also have the same problem running R147

On RFID#Tag do
if [RFID#Tag]=9235734

SendToHTTP
192.168.1.2:8080/json.htm?type=command&param=switchlight&idx=89&switchcmd=On
Endon

Becomes

On RFID#Tag do
if [RFID#Tag]=9235734

SendToHTTP
192.168.1.2:8080/json.htm?type=command¶m=switchlight&idx=89&switchcmd=On
Endon

When I push enter. And nothing happens In domoticz.

The rule works when is use Gpio,13,1 instead of SendToHTTP. Gpio 13 goes high.

Is this a bug?

Greetings Dennis

Re: Sendtohttp - domoticz json

Posted: 13 Jan 2017, 11:37
by ayasystems
What is the solution?

I want rise http commands with several parameters but i am having the same problem

Re: Sendtohttp - domoticz json

Posted: 13 Jan 2017, 15:51
by danielchagasrs
No solution yet for the "&param" replacement problem?
And the Publish domoticz/in doesn't work for me either. I'd like to use mqtt to update a contact switch (it's a read only switch, used for reed sensors, and only updates with the "udevice" command on json/domoticz)

Re: Sendtohttp - domoticz json

Posted: 22 Jan 2017, 00:37
by nick-head
Mine has the same problem but when I see it in the Log it is ok
and all lights switch ok.

Version 147
Sonoff 16A Switch

Re: Sendtohttp - domoticz json

Posted: 29 Jan 2017, 01:20
by danielchagasrs
I updated to 147, and still have the same problem (&param gets replaced by a symbol) and the command doesnt work.

Re: Sendtohttp - domoticz json

Posted: 29 Jan 2017, 01:35
by danielchagasrs
I tried something, and it worked fine.
Just invert the commands, and put "param" as the first item, without the "&".

Normal way ("&param" gets replaced):
/json.htm?type=command&param=switchlight&idx=174&switchcmd=On

Inverted way (working fine):
/json.htm?param=switchlight&type=command&idx=96&switchcmd=On

Re: Sendtohttp - domoticz json

Posted: 07 May 2017, 22:03
by vojtishek
Hi guys,
could you please advise If I can use that in situation related to my post below
https://www.letscontrolit.com/forum/vie ... 687#p15687

I'm newbie in using scripts so any help more than appreciated.

Thanks
V.

Re: Sendtohttp - domoticz json

Posted: 08 May 2017, 01:10
by danielchagasrs
vojtishek wrote: 07 May 2017, 22:03 Hi guys,
could you please advise If I can use that in situation related to my post below
https://www.letscontrolit.com/forum/vie ... 687#p15687

I'm newbie in using scripts so any help more than appreciated.

Thanks
V.
Ok, replied there.

Re: Sendtohttp - domoticz json

Posted: 08 May 2017, 23:32
by livebelive
danielchagasrs wrote: 29 Jan 2017, 01:35 I tried something, and it worked fine.
Just invert the commands, and put "param" as the first item, without the "&".

Normal way ("&param" gets replaced):
/json.htm?type=command&param=switchlight&idx=174&switchcmd=On

Inverted way (working fine):
/json.htm?param=switchlight&type=command&idx=96&switchcmd=On
Thank you very much!!!