Hello. New here.
I’ve owned Smartthings hub for about a year after moving over from Iris. I have a number of devices connected to the hub.
I am just now getting around to trying some custom automation.
I have a GE/Jasco Z-Wave Smart outlet that works fine through the app.
I have some surveillance cams plugged into this outlet. I have a monitor written that will email me when cam is on fritz so I can bounce the cam outlet via ST mobile app.
My objective is to capture email alert and trigger an automated power cycle of my z-wave smart outlet.
I have created a SmartApp and I can successfully powercycle the smart outlet there.
I’ve also been able to powercycle the outlet via curl command with the supplied temporary bearer token.
I need to automate the capture of the bearer token as i dont want to have to login manually each time to gather the latest bearer token.
I am using this guide here: https://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/authorization.html
It lists my first step is to obtain auth code. I built my GET like so:
The redirect URL was specified as an example to use when i setup my smartapp oauth settings.
When I run a GET on URL above, i get a full response including http formatting, content, etc.
When i drop my auth code request URL into chrome, i get taken to a page where i have to select my location (Home (15 devices) then i have to select the device, which my smart outlet is named “cams”.
Once i select these things, i then have to click a button named authorize. I then get redirected to my redir URL which contains the code i need in the URL. Obviously its a 404. URL=localhost:4567/oauth/callback?code=xxxxx
Is there a better way to do this? What should redir URL be?
It seems to me like maybe i need to specify the device more appropriately in my smartapp. When i run simulator on my smartapp, i also have to select location and device there too.
is there a better way to specify the device without having to select the device each time?
Maybe this will help with my auth code issue.
Thanks in advance.