Send data to Emomcms from rules

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
jvm1000
Normal user
Posts: 11
Joined: 11 Feb 2017, 14:23

Send data to Emomcms from rules

#1 Post by jvm1000 » 18 Jan 2021, 16:08

hi, i am trying to send data from rules to emocms, and i not want to use controlers
after wasting a lot of time with this I ask for help,

in browser this works fine:
http://192.168.1.109/input/post?node=ES ... 68d01d9454
even this
http://192.168.1.109/emoncms/input/post ... 68d01d9454
http://192.168.1.109/input/post?node=ES ... 68d01d9454

but in rules I have tried many combinations and have not been able to make it works
examples i tried
SendToHTTP 192.168.1.109,/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234664c68d01d9454
SendToHTTP 192.168.1.109/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234664c68d01d9454
SendToHTTP 192.168.1.109/input/post?node=ESP_9&fulljson='{"temperatura":77.7}'&apikey=f9a6bad9744c5b7234664c68d01d9454
SendToHTTP 192.168.1.109,emoncms,input,post?node=ESP_9&fulljson='{"temperatura":77.7}'&apikey=f9a6bad9744c5b7234664c68d01d9454
SendToHTTP 192.168.1.109,/input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234664c68d01d9454

please, i need help
thanks

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Send data to Emomcms from rules

#2 Post by TD-er » 18 Jan 2021, 16:55

See for more info: https://github.com/letscontrolit/ESPEasy/issues/2724

So for example first the line you tried and next the line how I think it should be:

Code: Select all

SendToHTTP 192.168.1.109,emoncms,input,post?node=ESP_9&fulljson='{"temperatura":77.7}'&apikey=f9a6bad9744c5b7234664c68d01d9454
SendToHTTP 192.168.1.109,`emoncms,input,post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234664c68d01d9454`
The last parameter of "SendToHttp" is the URL and since it has both a comma and quotes, you should wrap the entire parameter in quotes which are not used in the parameter.

jvm1000
Normal user
Posts: 11
Joined: 11 Feb 2017, 14:23

Re: Send data to Emomcms from rules

#3 Post by jvm1000 » 18 Jan 2021, 19:28

thanks TD-er for you answer but no way

i tried in rules
in rules
// this work on brouser http://192.168.1.109/input/post?node=ES ... 68d01d9454
SendToHTTP 192.168.1.109,'/emoncms/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234774c68d01d9454'
SendToHTTP 192.168.1.109, '/emoncms/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234774c68d01d9454'
SendToHTTP 192.168.1.109,`/emoncms/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234774c68d01d9454`
SendToHTTP 192.168.1.109, `/emoncms/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234774c68d01d9454`

// this work on brouser http://192.168.1.109/input/post?node=ES ... 68d01d9454
SendToHTTP 192.168.1.109, /input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454
SendToHTTP 192.168.1.109, '/input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454'
SendToHTTP 192.168.1.109, "/input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454"
SendToHTTP 192.168.1.109,"/input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454"
SendToHTTP 192.168.1.109,/input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454


in log
31553: ACT : SendToHTTP 192.168.1.109,'/emoncms/input/post?node=ESP_9&fulljson={'temperatura':77.7}&apikey=f9a6bad9744c5b7234774c68d0
31565: SendToHTTP connection failed
31571: ACT : SendToHTTP 192.168.1.109, '/emoncms/input/post?node=ESP_9&fulljson={'temperatura':77.7}&apikey=f9a6bad9744c5b7234774c68d
31583: SendToHTTP connection failed
31589: ACT : SendToHTTP 192.168.1.109,`/emoncms/input/post?node=ESP_9&fulljson={'temperatura':77.7}&apikey=f9a6bad9744c5b7234774c68d0
31605: SendToHTTP connection failed
31611: ACT : SendToHTTP 192.168.1.109, `/emoncms/input/post?node=ESP_9&fulljson={'temperatura':77.7}&apikey=f9a6bad9744c5b7234774c68d
31627: SendToHTTP connection failed
31654: ACT : SendToHTTP 192.168.1.109, /input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454
31666: SendToHTTP connection failed
31670: ACT : SendToHTTP 192.168.1.109, '/input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454'
31682: SendToHTTP connection failed
31685: ACT : SendToHTTP 192.168.1.109, '/input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454'
31696: SendToHTTP connection failed
31700: ACT : SendToHTTP 192.168.1.109,'/input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454'
31708: SendToHTTP connection failed
31713: ACT : SendToHTTP 192.168.1.109,/input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454
31723: SendToHTTP connection failed


in rules
// this work on brouser http://192.168.1.109/input/post?node=ES ... 68d01d9454
SendToHTTP 192.168.1.109,'emoncms/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234774c68d01d9454'
SendToHTTP 192.168.1.109, 'emoncms/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234774c68d01d9454'
SendToHTTP 192.168.1.109,`emoncms/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234774c68d01d9454`
SendToHTTP 192.168.1.109, `emoncms/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234774c68d01d9454`

// this work on brouser http://192.168.1.109/input/post?node=ES ... 68d01d9454
SendToHTTP 192.168.1.109, input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454
SendToHTTP 192.168.1.109, 'input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454'
SendToHTTP 192.168.1.109, "input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454"
SendToHTTP 192.168.1.109,"input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454"
SendToHTTP 192.168.1.109,input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454


in log
88983: ACT : SendToHTTP 192.168.1.109,'emoncms/input/post?node=ESP_9&fulljson={'temperatura':77.7}&apikey=f9a6bad9744c5b7234774c68d01
88995: SendToHTTP connection failed
89001: ACT : SendToHTTP 192.168.1.109, 'emoncms/input/post?node=ESP_9&fulljson={'temperatura':77.7}&apikey=f9a6bad9744c5b7234774c68d0
89015: SendToHTTP connection failed
89021: ACT : SendToHTTP 192.168.1.109,`emoncms/input/post?node=ESP_9&fulljson={'temperatura':77.7}&apikey=f9a6bad9744c5b7234774c68d01
89033: SendToHTTP connection failed
89038: ACT : SendToHTTP 192.168.1.109, `emoncms/input/post?node=ESP_9&fulljson={'temperatura':77.7}&apikey=f9a6bad9744c5b7234774c68d0
89050: SendToHTTP connection failed
89054: ACT : SendToHTTP 192.168.1.109, input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454
89067: SendToHTTP connection failed
89072: ACT : SendToHTTP 192.168.1.109, 'input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454'
89083: SendToHTTP connection failed
89114: ACT : SendToHTTP 192.168.1.109, 'input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454'
89126: SendToHTTP connection failed
89132: ACT : SendToHTTP 192.168.1.109,'input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454'
89141: SendToHTTP connection failed
89145: ACT : SendToHTTP 192.168.1.109,input/post?node=ESP_9&csv=77.7&apikey=f9a6bad9744c5b7234774c68d01d9454
89159: SendToHTTP connection failed

no way
any idea?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Send data to Emomcms from rules

#4 Post by TD-er » 18 Jan 2021, 20:30

You forgot the port number in the sendtohttp command
host,port,URL

jvm1000
Normal user
Posts: 11
Joined: 11 Feb 2017, 14:23

Re: Send data to Emomcms from rules

#5 Post by jvm1000 » 18 Jan 2021, 21:55

Emoncms input don´t have ports

this work if you put it in a brouser like crome and there is no port
http://192.168.1.109/input/post?node=ES ... 68d01d9454

docu:
https://emoncms.org/site/api#input
Last edited by jvm1000 on 18 Jan 2021, 21:58, edited 1 time in total.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Send data to Emomcms from rules

#6 Post by TD-er » 18 Jan 2021, 21:58

Default http port is port 80.
Thus:

Code: Select all

SendToHTTP 192.168.1.109,80,'/emoncms/input/post?node=ESP_9&fulljson={"temperatura":77.7}&apikey=f9a6bad9744c5b7234774c68d01d9454'

jvm1000
Normal user
Posts: 11
Joined: 11 Feb 2017, 14:23

Re: Send data to Emomcms from rules

#7 Post by jvm1000 » 18 Jan 2021, 22:01

it is working TD-er
thanks a lot :)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Send data to Emomcms from rules

#8 Post by TD-er » 18 Jan 2021, 22:13

You're welcome...
I will try to add a hint in the log if the port was missed as that's something that's easy to overlook.

dranniki
New user
Posts: 2
Joined: 31 Jan 2021, 15:42

Re: Send data to Emomcms from rules

#9 Post by dranniki » 09 Feb 2021, 19:14

Hi. A similar situation. I'm trying to send data from the rules to open-monitoring.online.
In the browser, this works fine: http://open-monitoring.online/get?cid=1 ... 3&p4=44444.
But the rules I tried, it doesn't work.
SendToHTTP open-monitoring.online/get?cid=1288&key=io16e4&p1=11111&p2=22222&p3=33333&p4=44444
Or use the site's IP address 109.174.31.9
SendToHTTP 109.174.31.9,80,'/get?cid=1288&key=io16e4&p1=11111&p2=22222&p3=33333&p4=44444'

I need help.

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Send data to Emomcms from rules

#10 Post by Ath » 09 Feb 2021, 19:24

Does that site actually accept http protocol or does it forward to https?

Nb: your second SendTHTTP example is correct the first one is incorrect
/Ton (PayPal.me)

dranniki
New user
Posts: 2
Joined: 31 Jan 2021, 15:42

Re: Send data to Emomcms from rules

#11 Post by dranniki » 10 Feb 2021, 19:23

The site accepts the http protocol.

The rules are written correctly, but they don't work with this site.

I will try to configure another service. Can ESPEasy work with beebotte.com?, have you any experience of its setting up?

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Send data to Emomcms from rules

#12 Post by Ath » 10 Feb 2021, 19:48

dranniki wrote: 09 Feb 2021, 19:14 SendToHTTP open-monitoring.online/get?cid=1288&key=io16e4&p1=11111&p2=22222&p3=33333&p4=44444
Here's a syntax error, the SendToHTTP command needs 3 arguments, not 1
If I separate the site and the rest of the url, inserting ",80," just as below it gets sent.

Code: Select all

SendToHTTP open-monitoring.online,80,/get?cid=1288&key=io16e4&p1=11111&p2=22222&p3=33333&p4=44444
Sending the original url from the browser, I get the response 'Wrong security code' (translated by Chrome from Russian) so I assume you changed the credentials. Or you copied them incorrectly...
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Send data to Emomcms from rules

#13 Post by Ath » 10 Feb 2021, 19:52

dranniki wrote: 10 Feb 2021, 19:23 Can ESPEasy work with beebotte.com?
Beebotte redirects to https immediately, and ESPEasy doesn't support https by default, so I don't think that'll work.
/Ton (PayPal.me)

sm0k0
Normal user
Posts: 16
Joined: 24 Sep 2016, 10:41

Re: Send data to Emomcms from rules

#14 Post by sm0k0 » 04 Nov 2021, 17:02

Hi guys.
Ath wrote: 10 Feb 2021, 19:52
dranniki wrote: 10 Feb 2021, 19:23 Can ESPEasy work with beebotte.com?
Beebotte redirects to https immediately, and ESPEasy doesn't support https by default, so I don't think that'll work.
@Ath : Thats not correct, beebotte is also using non-ssl via port 1883 and ssl on port 8883. ref-> https://beebotte.com/docs/mqtt#auth

but: it looks like the content-MD5 header is required to get a valid signature and this might be an issue. ref.-> https://beebotte.com/docs/auth

This is what i'm struggeling with and wonder also if somebody has it running already properly and how exactly ??

any hint's are welcome.

thx & regards
sm0k0

Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests