Closed jcwren closed 4 years ago
You need to install the classic SmartThings app.
On Automation -> SmartApps -> NodeRed
You will see there where to put your nodered installation address and where to select the desired devices to report events. Only the selected devices will send messages. And they will only send messages for the events they have been selected.
If you don’t see the NodeRed app there, click on add button -> My Apps -> NodeRed Webhook
As you did a local installation you must select the local option below the address field. And, you must inform the port you want to use if it is different then 80.
Regards, Otávio Ribeiro
Got that. And I see where I enter my address. According to the instructions, it should be "https://xxx.com/smartthings/webhooks". xxx.com is my web server, running on Apache. There's no webhooks handler there. NodeRed is running on NodeJS, and would normally be on port 1880. So I imagine I could point it to "https://xxx.com:1880/smartthings/webhooks", but I'd have to open a hole in the firewall for port 1880, exposing the NodeRed UI, which is a Really Bad Idea, and supposedly what webhooks takes care of.
But even so, if I go to xxx.com:1880/smartthings/webhooks, there's no handler there either. SOMETHING must have to be installed in either Apache or NodeRed to add the handler for that.
I looked at the code on the SmartThings site, and ran your application in the simulator, and I see where it's trying to make the request to xxx.com/smartthings/webhooks, but there's just nothing at my end that's set up to handle it. That's the part I'm missing.
I also don't really understand what the local option is for. What is a "local installation"? NodeRed is running on my machine, so I guess it could be considered "local". But this same machine is on the internet, just like my other servers at my web hosting provider (where I can't install NodeRed, but it would be "local" there also). So what does this switch do?
you can click the local address option. In which case you can use http with your nodered local ip address and port.
somethings like that:
http://192.168.xx.xx:1880/smartthings/webhook
but this will only works with the local address option checked.
regards
OK, thanks. I give up. I still can't find out what provides the "smartthings/webhook" support in either Apache or NodeRed. I understand that's where your application in SmartThings is making the request to, but not what's required to provide the URL support on my end.
If you have installed this package within your nodered than you don’ t need to do anything else.
It’s already there. This endpoint is provided by this package.
regards...
one more thing. You can not access the /smartthings/webhook from your browser because it does not answer to GET (which is the default verb when using a web browser). It only answers to POST requests. You can use postman to simulate a POST request at this endpoint.
regards
OK, knowing that node-red-contrib-smartthings
is what provides the path was helpful. Although I know you can't use GET to actually do anything, it's a good test from a browser to see if NodeRed is at least responding to the path.
I ended up mostly solving the security issue. I used Apache's mod_proxy_http
, redirected ONLY requests to the /smartthings/webhook
path to the NodeRed installation, and then qualified it with doing a reverse look-up on the requesting IP address to make sure it came from an Amazon AWS server.
So all that's working properly now. Thanks!
You have a good point about the GET verb and it was so easy to fix that I released the 0.0.17 with this feature.
Now, if you access the endpoint with your browser you will se a message that the plugin is up and running.
thanks for the feedback, regards, Otávio Ribeiro
I'm running node-red on my local server. Installed the node-red-contrib-smarthings package, and no problem sending events, but now I want to receive. Installed SmartApp, etc, as per the instructions. But I don't get this part:
Where provides the
smartthings/webhook
handler? Node-red is running on port 1880 on my local machine. My firewall forwards ports 80 and 453, but certainly not 1880. Is there supposed to be an apache module installed that forwards this somehow? I've been Googling on this, and have yet to find an answer.Seems this was asked in [#13] a couple weeks ago, and then the OP closed the post without bothering to indicate if he gave up, found a resolution, or what.
It might help to update the README.md to indicate where the
smartthings/webhook
comes from, and a link to information about installing it, etc.Thanks!