Locally running SmartApps - Not so bad!

We’ve been given a new way to run device drivers locally using Edge. But what about SmartApps? After all, when the dreaded time comes, all Groovy-based SmartApps running on SmartThings’s infrastructure are also going to become extinct.

Is the rules engine going to become so powerful and flexible that SmartApps will no longer be needed, or only in the most extreme cases? What if I have a unique automation that requires a SmartApp? What are my options?

I’ve been spending some time checking out how to develop and run SmartApps going forward, and thought I’d share my findings:

  • AWS is certainly an option but there are a couple gotchas:
    – you’d want to keep your execution within the ‘free-tier’ threshold, or you are going to end up with a monthly bill to Amazon (this is exactly what Samsung is trying to get out of!)
    – there are limitations to what your SmartApp can do unless you have access to a certificate authority
  • Glitch is a no-go: it’s fine for demonstration purposes, but the apps don’t stay ‘live’
  • Run it on your own internet server
    – I think very few people are willing or capable to set up and manage an internet server. Do you really want to take on the security headaches? Do you really want to pay your ISP more each month for a fixed IP address? Do you have access to a certificate authority?
  • Use a secure tunnel app like ngrok and run SmartApps on your own local computer

This last option sounded like a possible solution for me, but I was still pretty hesitant about having one of my computers accessible from the internet. However, as I learned more about ngrok and tried it out, I’ve concluded it’s a great way to go. This is not a commercial for ngrok by any means. In fact there are other similar solutions available, but I haven’t tried them, so can’t comment. Besides my security concerns, I wondered if ngrok would actually stay ‘up’ permanently, since it’s often promoted more as a development & demonstration tool and not for ‘production’ use, but I’ve been running it now for several months without a hiccup.

As far as the SmartApps themselves: they require the SmartApp SDK and can run on nodeJS. I have a Raspberry Pi where I’m running two SmartApps and the setup has been pretty solid.

There is a lack of nodeJS example SmartApps, so getting going with your first one takes a bit of effort, but once you figure things out, developers will find it fairly easy to implement.

While I realize there are relatively few people that will actually get into writing SmartApps, I wanted to share that there is a nice way to run them locally on your own network without too much hassle. Just keep in mind that although the SmartApp code itself is running locally, it still is dependent on a cloud connection back to SmartThings servers.

3 Likes

My main issue with writing SmartApps has been in trying to come up with a requirement for one. I haven’t succeeded yet.

I’ve had web hosting for a long time now and I am happy enough with the idea of using that. I just stick to PHP. It’s more me than JS/TS. However so far I have only found a use for API client apps.

hi will cast web api still work after the groovy thing goes ?

Subscribing to device states is really the key thing you can’t do as an API client. You can poll, but that has it’s own problems.

I don’t know what that is, sorry.

cast web api runs on my raspberry pi and there is an app on smartthings that makes google home devices talk etc.

1 Like

Got it. You should reach out to the original developer and see if he’s going to re-do this for the new platform. It could probably be simplified by moving his SmartApp to the Pi. Depending on what his SmartApp does, maybe he wouldn’t even need it - just implement an Edge driver that talks to the Pi directly. Depends on if he needs to subscribe to other device states.

i will do thanks

I keep holding out hope that the advanced rule creator a ST staff mentioned on these forums many months ago will come to fruition, but I’m running out of patience and he no longer works for ST. https://routinecreator.smartthings.com/ Has been dormant for many months so I’m guessing it’s been abandoned.

Home Assistant Yellow arrives next month (allegedly), so it will be interesting to see if it’s friendly enough to use that a non-developer like me can create advanced automations without setting up a server, writing code, etc.

3 Likes

Yes! I was just thinking about this today and wondering whatever happened to it. Between likely staff cutbacks (this is after all a non-revenue producing organization) and staffing shortages that are plaguing all companies, I think things are in tough shape.

It’s a shame they don’t leverage the community more to get some of these things over the goal line. Someone might be happy to take this up if they can’t do it. After all it’s just an html front end to the API (he says ignorantly… :grin:).

3 Likes

Home Assistant is friendlier than it used to be, that’s for sure.
They’ve really made great strides with making the application more user friendly.
It’s not as simple as doing something in the ST app though.

While I love that fact that SmartThings with Edge drivers supports every zigbee device I currently have/use without the issues I encountered with other hubs, the one thing that annoys me is that the rules (Routines) interface is so simplistic and limiting.

When Hubitat was my main home automation hub, I could create a single rule that would do what I wanted for a particular light. Similar when I was experimenting with Home Assistant.

In SmartThings it takes three or four separate routines to do what I did in Hubitat or HA with a single rule.

I would love to have an easy to use interface that doesn’t require me to have in-depth knowledge of the APIs, so I could create more complex rules/automations.

With Groovy going away at some point, I haven’t bothered trying to get HubConnect working so that Hubitat and SmartThings could work together.
I’m not willing to pay for Nabu Casa to connect SmartThings to Home Assistant, and I’m not confident in my capabilities to set up the webhook myself.

1 Like

Routine Creator seems to be in closed beta stage. Has that site been like that for how long? I remember reading about this some time ago, but haven’t though about it since.

It’s said that for many many months, possibly even over a year.

1 Like

We’ve reached out, and it isn’t happening, so anyone with the requisite skill set and inclination is free to take this on.

Tried to send you a direct message but you have your public profile blocked, so that seems to prohibit me from doing that…

Do you have any idea how many people are using that driver? Are there other options available? I have Alexa, so not familiar with it.

I direct messaged you, I’m guessing by now you have a secretary to deal with your inbox, that will hopefully pass it on to you

1 Like

I run Homebridge on a Raspberry Pi locally, to connect ecosystems to Apple’s Home app and Siri. Currently, there is a groovy-based SmartThings plug-in tat works well, but the developer is ticked off at Smartthings and will it convert it to the new Smartthings platform. So, unless I can find somebody else that is trying to create a new plug-in, I am looking into doing it myself.

A homebridge plug-in runs on a local machine (Raspberry Pi in my case). What I am not getting is how to meet the requirement that the smartapp be https-accesible via a public url. This just does not make sense in the context of code running on a local machine. Yes…I could make a publically available secure server…but a random user that wants to use my plug-in?

Am I mising something? Should I be looking at something other than a smartapp as the solution? There was no such requirement with the groovy plug-in.

There is Some discussion of homebridge integration alternatives in the following thread:

[RELEASE] Homebridge SmartThings v2.0 - #326 by JDRoberts

Thank you!!! I found and am using the Smartthing Plugin by @iklein99. It works well, though it does not yet support all device types (e.g. Thermostat). It is not a SmartApp, so clrarly I was going down the wrong path.

1 Like

Yeah, in the old architecture customers could run smartapps for free in the groovy cloud provided by Samsung. So that encouraged a lot of people to write and share custom smartapps. Plus the original version of routines in the smartthings app were much more limited than they are today, so there was a greater need for custom smartapps.

In the new architecture, the free groovy smartthings cloud Will be shut down, so anyone who wants to use a smartapp has to host it themselves, either through a hosting service or on a local server device. That’s a lot more complicated for nonprogrammers. So there’s a lot less energy going into the creation of custom smartapps right now except, of course, from device manufacturers, although a lot of those are hoping that matter will solve that issue for them.

Anyway, I think there will continue to be a lot of integrations and a lot of different rules options, it’s just most of them won’t be smartapps. For example, see the following thread:

Replace Groovy with Automations—what’s your plan?

1 Like