Starting to develop my own app

Hi all frustrated or liberated developers,

I am starting to enroll in st dev to integrate non compatible devices that have their on app and even api.

I am asking you to guide me where to start from.

1/ create a connection to the app that controls the device.

Where do I start from?
this one or this one ?

2/ Once connected my first aim is to retrieve a state from a sensor.
Naively i suppose i can get the logs or events or functions of the manufacturer, then map them to the ST smartapp then to the DTH if i amright ?

MANYMANY THANKS

Could this be a start?

Or is this better ?

It looks like you have picked out a ‘Directly Connected’ device. In ST terms that is really about having devices based on microcontrollers communicating directly with the ST cloud using MQTT.

What you are describing sounds more like a ‘Cloud Connected’ device in ST terms and I think you might want in particular to investigate the ‘Schema’ connection as that is all about creating a mapping to a third party API.

What you probably need to do is to stop thinking about device handlers in the DTH sense. The legacy DTH model is very much about integrating devices that attach via the hub using Zigbee, Z-Wave or indeed using LAN connections. It could be (ab)used to handle cloud connections and direct connections to more intelligent devices but it was never the most elegant solution. There will be a replacement for device handlers and I would imagine the basic concepts will remain, but it doesn’t make sense applying them for device integrations that don’t go anywhere near a hub.

EXACTLY, thank you pointing me in the right direction.
having read this awsome article, i understand it will be hard to understand the concept !

Probably, i also can grab an existing code on github that uses schema connection. If you have a suggestion i take it !
All the best 4 2021

I found this tuto but i am worried about the visual studio part !

I HOPE VISUAL STUDIO IS NOT MANDATORY !!!

1 Like

Hi, @mattrix! If you choose the path of ST Schema (cloud-connected device), here’s a post that can help you begin with this kind of integration. Either way, I’ll be around in case you have any questions.

@nayelyz
@jody.albritton

I am so gratefull you pointed that tutorial, however i get some newbee error.

Let me reexplain my aim is to switch on/off a smart plug that is cloud connected to smartlife app.

So i followed this tutorial and i could see my created device in the ST->My Testing Devices
When i click it, i choose a room, then i get a blank screen “Cannot GET /oauth/login” with the url of the remixed glitch app at the top of the window.

Here is the glitch connector env file

Here is the glitch oauth env file

Hi, @mattrix! Don’t worry, here we support each other. :handshake:
At the Schema Connector (server.js, line 22), there is a comparison to validate the ACCESS_TOKEN_PREFIX as follows:

server.post('/', (req, res) => {
  if (accessTokenIsValid(req, res)) {
    connector.handleHttpCallback(req, res)
  }
});

As you configured this variable only in the OAuth server, the generated token has this prefix but it’s not recognized by the connector because it has an empty value. They must match to pass the validation.

2 Likes

@nayelyz
Thanks for tryin to help but it seems i don’t manage to understand what s wrong or what/where i should add something to match.

As this tutorial is incomplete it s very frustrating.

No problem, the picture below is your environment variables configuration at the OAuth Server, I was wrong before, the one with an empty value for the ACCESS_TOKEN_PREFIX is that one.
This server generates a Token to validate the access, a random String, for example, ghueo. As the Schema Connector has this prefix configured, it is expecting something like: B71325EF:ghueo.
If you add the same value (marked in red), the OAuth process should be successful.

Am gratefull for your help but this tuto must be for gurus as i get the same blank screen error.

i also tried this tuto on my rpi


Even though i did all what is asked and installed al from fresh rpi, i cannot see the device in ST

Are the people writing the tutorials not testing them before ?