HTTPd Plugin (useful for IFTTT Maker integration)

Posted on
Sat Nov 17, 2018 12:56 am
geoffsharris offline
Posts: 45
Joined: Nov 26, 2012

Re: HTTPd Plugin (useful for IFTTT Maker integration)

Hi,

Great concept for a plug in. I'm doing the following with user and pword substituted in the real test :

curl "http://user:pword@localhost:5555/setvar?variable=1"
<html>
<head><title>Indigo HTTPd Plugin</title></head>
<body>
<p>Updated variable httpd_1027260896 to '1'</p>
</body>
</html>

In indigo I get the following:

AuthHandler: GET from 127.0.0.1:62345 for /setvar?variable=1
HTTPd Debug AuthHandler: Request has correct Authorization header
HTTPd Debug AuthHandler: setting variable httpd_variable to '1'

The value of "variable"is unchanged in indigo. I've tried all sorts of other tests like using the id number for the variable, etc. and I can't get this to actually update any variable in indigo even though I am getting authorization and a success message.

Any ideas would be great. Running Indigo 7.2 on OS Mojave.

-Geoff

Posted on
Sat Nov 17, 2018 1:14 am
geoffsharris offline
Posts: 45
Joined: Nov 26, 2012

Re: HTTPd Plugin (useful for IFTTT Maker integration)

For those smarter than me, this will be obvious, but hopefully it will save someone some time. The app creates a folder called HTTPd and the variable passed like "foo" are listed as httpd_foo in this folder. I didn't see this and kept wondering why my "foo" variable I had set up in indigo was not updating. Hope this helps someone.

-Geoff

Posted on
Sat Nov 17, 2018 8:29 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTPd Plugin (useful for IFTTT Maker integration)

I'll update the README on GitHub so this is described better. It's in the first post of this thread, but if you get the plugin from the Store you might not see that.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Dec 27, 2018 7:11 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTPd Plugin (useful for IFTTT Maker integration)

Release 1.3.0 is now available:

Starting with release 1.3.0, the plugin supports both GET and POST methods. When a POST call is processed, the payload of the POST request is broadcast:

Code: Select all
indigo.server.broadcastToSubscribers(u"httpd_post_payload", payload)


This allows other plugins (or background Python scripts) to use the HTTPd plugin to receive HTTP requests.

See the "Broadcast and subscribe interprocess communication" section of viewtopic.php?f=2&t=17039#p126067 for more info.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Dec 28, 2018 7:22 am
racarter offline
User avatar
Posts: 468
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: HTTPd Plugin (useful for IFTTT Maker integration)

This is great! One small suggestion:

Currently I have my Netatmo webhook url set to my Indigo public IP address and a selected port, with '/netatmo' appended. This causes a debug message in HTTPd:

AuthHandler: Unknown request: /netatmo

Since it is possible that webhook messages are arriving from more than one source, one solution would be for HTTPd to pass the path as well as the message, so that subscribers to the broadcast could quickly determine if this was a relevant message for them.

Posted on
Fri Dec 28, 2018 11:38 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTPd Plugin (useful for IFTTT Maker integration)

This is why I should not do coding when suffering from jet lag. ;)

Release 1.3.1 now available. The broadcast functionality has changed. Read the README on GitHub. This fixes the "unknown request" error. Also, the broadcast data is now a dictionary so that additional information can be included.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Dec 28, 2018 12:38 pm
racarter offline
User avatar
Posts: 468
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: HTTPd Plugin (useful for IFTTT Maker integration)

Jet lag clearly in remission! Thumbs up from North Yorkshire :D

Posted on
Sat Dec 29, 2018 8:14 pm
philipbasile offline
Posts: 113
Joined: Jan 08, 2015
Location: NJ

Re: HTTPd Plugin (useful for IFTTT Maker integration)

I have the plugin installed and I'm trying to test.

two questions...
1. the user name and password configured in the plugin have nothing to do with my indigo username and password correct ?
2. why am I getting a prompt for the user name and password even though I'm including it in the url call per the example for the plugin ?

thanks

philip

Posted on
Sat Dec 29, 2018 8:37 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTPd Plugin (useful for IFTTT Maker integration)

philipbasile wrote:
1. the user name and password configured in the plugin have nothing to do with my indigo username and password correct ?
2. why am I getting a prompt for the user name and password even though I'm including it in the url call per the example for the plugin ?


1. Correct. The username/password you configure in the plugin is ONLY used for the HTTP calls back to the plugin.

2. Where are you seeing that? The plugin can't prompt anywhere (except for the config dialog).

What plugin action are you trying to use?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Dec 29, 2018 9:28 pm
philipbasile offline
Posts: 113
Joined: Jan 08, 2015
Location: NJ

Re: HTTPd Plugin (useful for IFTTT Maker integration)

I'm using geohopper to trigger a pushover message with the following embedded URL (sanitized)
http://username:password@myddns:9085/se ... geOpen=Yes

But I just past it into my safari browser for testing...
Even if I past this into my browser I get a username and password prompt from safari to log in like I would for a secure website.

Thoughts ?

Philip

Posted on
Sat Dec 29, 2018 9:48 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTPd Plugin (useful for IFTTT Maker integration)

philipbasile wrote:
I'm using geohopper to trigger a pushover message with the following embedded URL (sanitized)
http://username:password@myddns:9085/se ... geOpen=Yes

But I just past it into my safari browser for testing...
Even if I past this into my browser I get a username and password prompt from safari to log in like I would for a secure website.

Thoughts ?

Philip


Try doing this in a Terminal window, with the real host name.

Code: Select all
curl http://username:password@myddns:9085/setvar?ActionGarageOpen=Yes

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jan 04, 2019 7:21 pm
philipbasile offline
Posts: 113
Joined: Jan 08, 2015
Location: NJ

Re: HTTPd Plugin (useful for IFTTT Maker integration)

Joe,

So if I paste this into the browser on my mac
http://admin:password@192.168.2.11:9085/setvar?test=2

I get the following in my browser
Safari can’t open the page “‎192.168.2.11:9085/setvar?test=2” because the server unexpectedly dropped the connection.
This sometimes occurs when the server is busy. Wait for a few minutes, and then try again.

But I get this in the event log with debug turned on

HTTPd Debug AuthHandler: GET from 192.168.2.145:54610 for /setvar?test=2
HTTPd Debug AuthHandler: Request has correct Authorization header
HTTPd Debug AuthHandler: setting variable httpd_test to '2'
HTTPd Debug AuthHandler: GET from 192.168.2.145:54611 for /setvar?test=2
HTTPd Debug AuthHandler: Request has correct Authorization header
HTTPd Debug AuthHandler: setting variable httpd_test to '2'
HTTPd Debug AuthHandler: GET from 192.168.2.145:54612 for /setvar?test=2
HTTPd Debug AuthHandler: Request has correct Authorization header
HTTPd Debug AuthHandler: setting variable httpd_test to '2'

the variable does get set.

when I do the SAME THING on my iPhone (where I really want this to work) even while Im on the local network I get a login prompt (image attached)

why do you think that happens ?

Thanks

Philip
Attachments
httpdtest.png
httpdtest.png (62.06 KiB) Viewed 4256 times

Posted on
Fri Jan 04, 2019 7:24 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTPd Plugin (useful for IFTTT Maker integration)

Testing the plugin using a browser is not recommended. Use curl in a terminal window.

In any case, are you using the latest version of the plugin, which was released 4 days ago? I fixed a bug that was causing it to not return a complete web page. Which curl doesn't care about, but browsers do. But then, Webhooks like IFTTT don't care either.

What are you trying to do in your iPhone browser with the plugin?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jan 04, 2019 7:54 pm
philipbasile offline
Posts: 113
Joined: Jan 08, 2015
Location: NJ

Re: HTTPd Plugin (useful for IFTTT Maker integration)

Thanks for replying SOOOO fast !

Ok so I want indigo to be more interactive so here is what I'm trying to do.
I'm on the way home, and I get a message from indigo saying...
Hi, it looks like your on the way home would you like me to open the garage door ?
I response yes and indigo opens the garage door.

Heres how.
I'm using the Beacon plugin with Geohopper for geolocation and the pushover plugin for issuing popup messages on my iPhone.
When I cross a geofence 2 blocks from my house the geohopper app on my iPhone sends a webhook to the beacon plugin running on indigo
The beacon plugin fires a trigger turning on the outside house lights if its dark out and issues a pushover alert.
The pushover plugin alert can include a URL Link with a title
it shows up in the pushover alert as a nice underlined YES link just like on a web page.
title is YES
the link is http://admin:password@MyDDNSaddress:908 ... arage=TRUE

Your HTTPd plugin sets the OpenGarage variable in indigo to TRUE
An on variable change trigger in indigo checks the OpenGarage variable and opens the garage door.

Once this all works there are so many ways to leverage this for interactive communication between indigo and my iPhone.

Posted on
Fri Jan 04, 2019 8:26 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTPd Plugin (useful for IFTTT Maker integration)

So, are you using the latest version of the plugin?

Also, the screen shot you show doesn't have the login info in the URL. If you put it there but either Pushover or Safari stripped it out, then you've got a problem.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 6 of 10 1 ... 3, 4, 5, 6, 7, 8, 9, 10

Who is online

Users browsing this forum: No registered users and 0 guests