Sendtohttp - domoticz json

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
hamster
Normal user
Posts: 62
Joined: 27 Sep 2015, 21:01
Location: UK

Sendtohttp - domoticz json

#1 Post by hamster » 18 Jun 2016, 08:47

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

hamster
Normal user
Posts: 62
Joined: 27 Sep 2015, 21:01
Location: UK

Re: Sendtohttp - domoticz json

#2 Post by hamster » 19 Jun 2016, 22:58

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

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: Sendtohttp - domoticz json

#3 Post by Jeff » 16 Dec 2016, 22:50

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

vmfs1968
Normal user
Posts: 42
Joined: 18 Oct 2015, 23:51

Re: Sendtohttp - domoticz json

#4 Post by vmfs1968 » 17 Dec 2016, 15:29

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.

User avatar
Westcott
Normal user
Posts: 24
Joined: 05 Sep 2016, 18:14
Location: Gloucester
Contact:

Re: Sendtohttp - domoticz json

#5 Post by Westcott » 26 Dec 2016, 18:30

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
Last edited by Westcott on 13 Jan 2017, 17:57, edited 1 time in total.
Domoticz, Sonoff, ESP32

DMeekelenkamp
Normal user
Posts: 35
Joined: 11 Nov 2015, 13:52

Re: Sendtohttp - domoticz json

#6 Post by DMeekelenkamp » 08 Jan 2017, 19:08

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

ayasystems
Normal user
Posts: 39
Joined: 09 Aug 2016, 09:45

Re: Sendtohttp - domoticz json

#7 Post by ayasystems » 13 Jan 2017, 11:37

What is the solution?

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

danielchagasrs
Normal user
Posts: 20
Joined: 09 Jan 2017, 20:20
Location: Porto Alegre / Brazil

Re: Sendtohttp - domoticz json

#8 Post by danielchagasrs » 13 Jan 2017, 15:51

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)

nick-head
Normal user
Posts: 48
Joined: 15 Nov 2016, 11:09
Location: North East UK

Re: Sendtohttp - domoticz json

#9 Post by nick-head » 22 Jan 2017, 00:37

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
ESP32, Arduino's,Raspberry Pi's, ESP8266's, Nextion's, Sonoff's, LightWaveRF's, RFXCom 433, and a headache
And a HackRF One, as a present to myself.

danielchagasrs
Normal user
Posts: 20
Joined: 09 Jan 2017, 20:20
Location: Porto Alegre / Brazil

Re: Sendtohttp - domoticz json

#10 Post by danielchagasrs » 29 Jan 2017, 01:20

I updated to 147, and still have the same problem (&param gets replaced by a symbol) and the command doesnt work.

danielchagasrs
Normal user
Posts: 20
Joined: 09 Jan 2017, 20:20
Location: Porto Alegre / Brazil

Re: Sendtohttp - domoticz json

#11 Post by danielchagasrs » 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

vojtishek
Normal user
Posts: 70
Joined: 12 Jan 2017, 08:00

Re: Sendtohttp - domoticz json

#12 Post by vojtishek » 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.

danielchagasrs
Normal user
Posts: 20
Joined: 09 Jan 2017, 20:20
Location: Porto Alegre / Brazil

Re: Sendtohttp - domoticz json

#13 Post by danielchagasrs » 08 May 2017, 01:10

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.

livebelive
Normal user
Posts: 13
Joined: 08 May 2017, 22:50

Re: Sendtohttp - domoticz json

#14 Post by livebelive » 08 May 2017, 23:32

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!!!

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 18 guests