Help request - Oauth grant_type = password

Hello, I was wondering if anyone has a sample piece of groovy code that will handle picking up a token using the password version of grant_type.

This is the API documentation

I am trying to integrate Smappee with Smartthings, which I would otherwise have done through IFTTT, since Smappee has an IFTTT channel, but IFTTT does not work for us UK users.

For those who don’t know Smappee, it is an energy monitor which uses a couple of clamp sensors to report total power load and solar production. It is a very powerful system as it can detect the operation of individual devices purely from their electrical signature (e.g. it knows when the kettle is switched on and off without having a discrete sensor). It also logs total energy consumption by an individual device so you can get itemised consumption without having individual power sensors. Its data can be read in two ways, one via a cloud service, the second via a direct login to the device locally.

I’m pretty new to programming, and have achieved most things so far by adapting other code examples to do what I am trying to do … but I haven’t found anything similar to help me with this one. With help from the community, I would love to get a full Device Type and SmartApp built for Smappee.

One of my aims is to be able to use the difference in (almost) real time measures between load and solar to trigger switching a device … so I can make use of free energy production that would otherwise be lost to the grid.

My first step, is to successfully connect to the API, and pick up / refresh the Oauth token. Once I have achieved that I will have a go at picking up the location and device info that Smappee provides.

edit: I am marking this solved as I am returning my SmartThings kit due to lack of useable functions at this time in the UK. I may be back !

Sadly oauth doesn’t work yet in the UK, so it won’t work for now, but is coming soon.

I thought it was just grant_type=authorization_code that doesn’t work, but from what your saying it sounds like its all not working.