Suggestion for Smartthings API structure

Probably most of us believe in the cohesion and consistency design principle that modules should do one thing only, and each thing should be done by only one module.

Looking at the Smartthings API as a newbie equipped with a new hub and some lights, a motion sensor, a couple of dimmers, from different manufacturers (Samsung, Hue, IKEA) the first thing I expected the API to provide was access to:

  • devices

Sorry, can’t think of anything else to add to that list…But that’s my point. Surely that’s one thing a module can do, and should only be done by one module. So there is a /devices endpoint to handle that. :+1:

Alongside, there are also /apps, /installedapps, /schedules, /subscriptions, /scenes, rules, etcc…

That’s also fine. An API can have many modules, but if I really only want to do basic things with my devices, I wonder if I really need to know anything about these. :thinking:

Along with the “cohesion” principle, is also the “minimal coupling” principle. And this is where the current design seems to couple the functionality of devices I want to employ with the need to also make use of /subscriptions and /schedules, and in consequence /installedapps and /apps.

All I want to do is to use the API to turn lights on/off, to listen to events from buttons and sensors.

Why do I even need to end up getting involved with /apps?

At least with /schedules, I can ignore them, because I believe I am at least as capable of unleashing 80% of the power of cron as Samsung.

Likewise with /rules, I can implement as much boolean algebra as Samsung can. I don’t need YARE (Yet another rules engine)

But with /subscriptions, I have to work within a SmartApp, which entails going through the lifecycle phases, etc. All I want to do is to host an endpoint where I can receive an event notification, so why force me into the TOWIS (The only way is smartapp) solution? The only validation necessary for a SmartApp is registration of a valid https url. Why can’t we support the registration of a simple notification endpoint, without all the ritual of getting my phone out and swiping for my app and installing and configuring and wondering what I did wrong when I get the catch-all “Network Problem, try again”, and eventually learning that “try again” actually means “try rewriting your code”. Why do I even need a smartphone to develop a server base application? (Good example of excessive coupling, if ever there was one)