Hi Joe,
Many thanks for a great plugin.
I'm having a little bit of difficulty with the webhook proxy device setup: when I try and create an instance of a proxy I get a settings pane with no options (just save or cancel). On pressing save I get an error:
- Code: Select all
HTTPd dbell: Starting proxyDevice Device 1518360974
HTTPd Error Error in plugin execution ServerReplacedElem:
Traceback (most recent call last):
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/IndigoPluginHost.app/Contents/Resources/PlugIns/plugin_base.py", line 1179, in deviceUpdated
File "plugin.py", line 395, in deviceStartComm
AttributeError: 'NoneType' object has no attribute 'get'
I've got my server set up on the default port (5555) and can confirm it is receiving data using the setvar test. Others may wish to note that if they are using the new zsh script shell in OSX you need to escape character the ? so the command is best quoted like this:
- Code: Select all
curl -X POST "http://192.168.1.100:5555/setvar?hello=world"
{that took me an embarrassingly long time to figure out}
I've set up a trigger action as per previous posts on this page - HTTPd event -> proxy request received , proxy device dbell, set up to trigger the following script:
- Code: Select all
httpPlugin = indigo.server.getPlugin("com.flyingdiver.indigoplugin.httpd")
if httpPlugin.isEnabled():
hook_data = httpPlugin.executeAction("getWebhookData", deviceId=1518360974)
indigo.server.log("Webhook Payload:\n{}".format(hook_data))
and send a curl command like:
- Code: Select all
curl -d '{"deviceid":"HSL-XXX-XXXX", "alias":"Home doorbell", "action": "HTTP Hook"}' -H "Content-Type: application/json" http://192.168.1.100:5555/webhook-1518360974
I can see that the json data is received:
- Code: Select all
HTTPd Debug RequestHandler: POST from 192.168.1.100:57404 to /webhook-1518360974
HTTPd Debug RequestHandler: No password specified in plugin preferences, skipping authentication
HTTPd Debug POST Webhook to httpd_webhook-1518360974 = {'request': {'path': '/webhook-1518360974', 'client': '192.168.1.100', 'command': 'POST', 'headers': {'host': '192.168.1.100:5555', 'content-type': 'application/json', 'content-length': '75', 'accept': '*/*', 'user-agent': 'curl/7.64.1'}}, 'payload': {u'action': u'HTTP Hook', u'alias': u'Home doorbell', u'deviceid': u'HSL-XXX-XXXX'}, 'vars': {}}
... but the proxy does not trigger any actions - I suspect related to the error above when trying to create the proxy? I've restarted the plugin a number of times, and tried to create different proxies all with the same result.
Any advice very gratefully received!