HTTPd Plugin (useful for IFTTT Maker integration)
Re: HTTPd Plugin (useful for IFTTT Maker integration)
Hi.
I have gotten a new gadget for my "brewery". This time it is a digital air lock that will count the bobbles and do several estimations based on that. The interesting thing is that this device supports webhooks, so it should be able to interface with Indigo.
The Plaato Airlock will send a POST request with a JSON object to the webhook every 5 minutes as long as it is connected to power and WiFi.
https://plaato.io/apps/help-center#!hc-values
The big question now, is it possible to use the HTTPd Plugin to interface this device?
/Håvard
I have gotten a new gadget for my "brewery". This time it is a digital air lock that will count the bobbles and do several estimations based on that. The interesting thing is that this device supports webhooks, so it should be able to interface with Indigo.
The Plaato Airlock will send a POST request with a JSON object to the webhook every 5 minutes as long as it is connected to power and WiFi.
https://plaato.io/apps/help-center#!hc-values
The big question now, is it possible to use the HTTPd Plugin to interface this device?
/Håvard
- Attachments
-
- Capture.PNG (27.33 KiB) Viewed 4414 times
Håvard
Re: HTTPd Plugin (useful for IFTTT Maker integration)
I don't use the HTTPd plugin--but if that doesn't work for you--you may be able to use the GhostXML plugin (which also works with JSON payloads).
I came here to drink milk and kick ass....and I've just finished my milk.
My Plugins and Scripts
My Plugins and Scripts
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: HTTPd Plugin (useful for IFTTT Maker integration)
Yes.haavarda wrote: The big question now, is it possible to use the HTTPd Plugin to interface this device?
Oh, you want to know how?
FIrst, set up the HTTPd plugin. Make sure you fill in the DDNS name field. If the device is on the local LAN, and it's the only device you're using with the plugin, you can use the local address of the Indigo server instead of a DDNS name. Something like "http://<indigoservername>.local/" or "http://192.168.1.101/".
Test that the HTTPd plugin is working properly. Use 'curl' in the Terminal window to test it, don't use a browser.
Something like this with set a variable named http_foo:
Code: Select all
curl http://192.168.1.101:5555/setvar?foo=bar
Code: Select all
httpPlugin = indigo.server.getPlugin("com.flyingdiver.indigoplugin.httpd")
if httpPlugin.isEnabled():
hook_data = httpPlugin.executeAction("getWebhookData", deviceId=1375148185)
indigo.server.log("Webhook Payload:\n{}".format(hook_data))
Code: Select all
curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" http://192.168.1.101:5555/webhook-1375148185
Code: Select all
Script Webhook Payload:
Data : (dict)
payload : (dict)
key1 : value1 (string)
key2 : value2 (string)
request : (dict)
client : 192.168.1.101 (string)
command : POST (string)
headers : (dict)
accept : */* (string)
authorization : Basic aG9va191c2VyOmhvb2tQYXNzMTAx (string)
content-length : 34 (string)
content-type : application/json (string)
host : 192.168.1.101:5555 (string)
user-agent : curl/7.54.0 (string)
path : /webhook-1375148185 (string)
vars : (dict)
You'll need to parse the payload part of the webhook data for your data. That's not too hard in Python. Depends on what you want to do with it.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: HTTPd Plugin (useful for IFTTT Maker integration)
That would probably work if he wants to poll the analyzer, rather than use the webhook capability. Which honestly would seem to make more sense in this application. Webhooks are good for asynchronous event data, but they add a lot of complexity for something that's you just want to monitor on a fixed schedule.DaveL17 wrote:I don't use the HTTPd plugin--but if that doesn't work for you--you may be able to use the GhostXML plugin (which also works with JSON payloads).
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: HTTPd Plugin (useful for IFTTT Maker integration)
An excellent point.
Sent from my iPhone using Tapatalk
Sent from my iPhone using Tapatalk
I came here to drink milk and kick ass....and I've just finished my milk.
My Plugins and Scripts
My Plugins and Scripts
Re: HTTPd Plugin (useful for IFTTT Maker integration)
Thank you for your reply and input FlyingDiver
.
I was able to get your tests for work. So just need to sort out the rest. I thought that the communication was direct, but it might be a cloud thing, so then I need to open some ports etc...
But it seams as I do some sort of polling with a get funcion. GET http://plaato.blynk.cc/auth_token/get/pin. And perhaps I can use the GhostXML.
I have requested a token from Plaato, and will start play with it to see what I can make of it.
Thanks again for your support
Håvard
I was able to get your tests for work. So just need to sort out the rest. I thought that the communication was direct, but it might be a cloud thing, so then I need to open some ports etc...
But it seams as I do some sort of polling with a get funcion. GET http://plaato.blynk.cc/auth_token/get/pin. And perhaps I can use the GhostXML.
I have requested a token from Plaato, and will start play with it to see what I can make of it.
Thanks again for your support
Håvard
Håvard
Re: HTTPd Plugin (useful for IFTTT Maker integration)
Hi!
I'm trying to use this plugin for IFTTT but the plugin hangs about 1-3 times a day (need to be force quitted).
What could be the problem?
At reload:
Best regards, L
I'm trying to use this plugin for IFTTT but the plugin hangs about 1-3 times a day (need to be force quitted).
What could be the problem?
At reload:
Code: Select all
Error process (pid 91815) failed to quit after polite request -- forcing it to quit now
Stopped plugin "HTTPd 1.3.2"
Starting plugin "HTTPd 1.3.2" (pid 94636)
Started plugin "HTTPd 1.3.2"
HTTPd Starting HTTPd
HTTPd Error Certificate file missing, unable to start HTTPS server- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: HTTPd Plugin (useful for IFTTT Maker integration)
First, how do you know it's hanging? Is it just that IFTTT can't reach it? Have you tried using a local command (curl or similar) to communicate with it?DrLove wrote:I'm trying to use this plugin for IFTTT but the plugin hangs about 1-3 times a day (need to be force quitted).
What could be the problem?
Second, is there anything in the logs? Try setting debug level logging and see if that shows anything.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: HTTPd Plugin (useful for IFTTT Maker integration)
Also, I just realized I forgot to push the latest release to the plugin store (It was released on GitHub). Please upgrade to that.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: HTTPd Plugin (useful for IFTTT Maker integration)
IFTTT timeout and using Curl locally does not work until reload.
I'll try the updated version! Thank you for a quick reply!
Best regards, L
I'll try the updated version! Thank you for a quick reply!
Best regards, L
Re: HTTPd Plugin (useful for IFTTT Maker integration)
Hi.
It ran stable for a few days and then the latest release also crashed
Nothing in the log.
Best regards, L
It ran stable for a few days and then the latest release also crashed
Nothing in the log.
Best regards, L
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: HTTPd Plugin (useful for IFTTT Maker integration)
What port are you using?
Sent from my iPhone using Tapatalk
Sent from my iPhone using Tapatalk
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: HTTPd Plugin (useful for IFTTT Maker integration)
HTTP 5555.
/L
/L
Re: HTTPd Plugin (useful for IFTTT Maker integration)
Update.
Yesterday, after my reply, the plugin did not even want to start at all. It looks like it's running (startup ok in log after force quit as usual) but does not respond to HTTP-requests. Tried different ports to no avail.
This morning after many reloads and disable/enable of the plugin it is running again, but who knows for how long :/
The log (at debug level) does not show anything odd.
//L
Yesterday, after my reply, the plugin did not even want to start at all. It looks like it's running (startup ok in log after force quit as usual) but does not respond to HTTP-requests. Tried different ports to no avail.
This morning after many reloads and disable/enable of the plugin it is running again, but who knows for how long :/
The log (at debug level) does not show anything odd.
//L
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: HTTPd Plugin (useful for IFTTT Maker integration)
Ok, time to take this off the forums.
Please create a new issue here: https://github.com/FlyingDiver/Indigo-HTTPd/issues
Describe the problem with as much detail as you can (which in this case, might not be much). Then attach the plugin-specific log file and the plugin preferences file. Paths will be something like:
Please create a new issue here: https://github.com/FlyingDiver/Indigo-HTTPd/issues
Describe the problem with as much detail as you can (which in this case, might not be much). Then attach the plugin-specific log file and the plugin preferences file. Paths will be something like:
Code: Select all
/Library/Application Support/Perceptive Automation/Indigo 7.4/Logs/com.flyingdiver.indigoplugin.httpd/plugin.log
/Library/Application Support/Perceptive Automation/Indigo 7.4/Preferences/Plugins/com.flyingdiver.indigoplugin.httpd.indiPref
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177