Smart App Engine At Home

I am not sure if this topic belongs here, in the development forum, or in the general forum, but here goes. I have two lamps on each side of my bed. Each of these lamps are controlled via a Zwave module under the bed causing my wife and I to have to go to our iPhone each time we want to turn on or off the lamp. When going to sleep that is OK, but when walking in the room it is a pain to have to find the cell phone, find the SmartThings app, find the lamps, and turn them on.

So, as a solution I have a switch where you walk in the room that no longer controls anything. I put a ZWave switch here with nothing connected to the load. I wanted to use the switch as a trigger in an custom written SmartApp to then control the two lamps. The application works flawlessly with one exception. Sometime when the switch is pressed, the lamps come one within five seconds which is tolerable. Other times however, it will take up to a minute for lamps to respond. I don’t know where the delay comes from, but I am assuming it is from the one centralized resource in the system, the SmartThings server.

So, it seems to me that an option to both lower the compute requirements for SmartThings and to speed to response of SmartApps in the home would be a distributed architecture where there was an option to run a SmartThings engine on my home computer. I have a computer that is up 24/7 and would be ideal for this. SmartApps would be downloaded to this machine and all of my SmartApps would run there. Certain events would have to be forwarded from the central server to this home server (e.g. smartphone based leaving or arriving events). Depending on how clever you wanted to be, the center server could take over for the home server when it was down as long as the hub could still talk to the center server. Depending on the current architecture of the SmartApps engine, it does not seem like this would be that difficult to do.

As an alternative, it seems like some simple application capability (much less than the overall server) could be deployed to a local computer instead of the server ( checkbox on the smart app for local deployment ). The Smartthings IDE could check that the features used met some subset for local deployment, and the app could be deployed locally. When the hub saw the switch event, it would forward to both the SmartThings server and the local PC running apps. Since the app was locally deployed the server would not respond in any way, but the local machine could run the app and perform the operations.

Anything like this in the works ??? Thoughts ???

Thanks

Quick question: have you seen any of the discussions about hub v2? This new hub (shipping now) supports local processing of SmartApps and I think it will cover your needs here.

3 Likes

The V2 hub is already intended to provide this capability. Specifically the Smart Lights app will be the first smartapp to run locally, for just this purpose.

Smartapps themselves are dependent on proprietary smartthings infrastructure, and cannot be run on other devices. It’s either in the smartthings cloud, or, with V two, locally on the smartthings hub (although this is not available to all smartapps at launch.) so the issue can’t be solved as you suggest.

You have several options for this.

Option 1: The V2 Hub

First thing to consider: just get the V2 hub. It’s entirely possible that would solve this problem without making any other changes. Smartthings is well aware that the cloud introduces delay for some use cases, and they designed the V2 hub specifically to move some processing local.

Option 2: Use Z-Wave Association

Alternatively, If the lights are Z wave and the switch is zwave, you can probably use zwave direct association between the switch and the lights. This will allow them to talk directly to each other without going to the hub at all. (So this option works with both the V1 hub and the V2 hub.) It is part of standard zwave. The only thing is that the hub will not know that the lights were turned on, so the status tiles will be incorrect in the mobile app. If you have a Minimote, it can do the association between the switch and the lights, provided all the devices support the association command set.

In any case, run a Zwave Repair and talk to Support

In any case, it’s probably a good idea to review your network to see if it can be optimized in any way. The first thing would be to run a Z wave repair. That can be particularly helpful if you added the devices at different times, for example if you’ve had the lights for a while and then added the switch later. Support@SmartThings.com can help you with this. It’s just a utility that you can run. I run it once a week, a lot of residential homeowners run it once a month. You should definitely run it after adding any new devices.

Last Resort: Switch Controllers

Since you suggested operating your own server, it may be that smartthings is not the best choice for you. You could look at openhab, Homeseer, or even Vera. All three offer more local processing options than smartthings does. Of course they also require significant programming skills.

So those are just some of the options. It’s likely you can improve the situation that you have, it just depends on what kind of approach feels comfortable to you.

I have pre-ordered the Smart Hub V2.0. While I would like to use a system where the processing is all local, one of the strongest features about the Smarthings for my use is that fact that it (mostly) just works. I only have to jump in and write code myself when I want something very specific to my needs. The low overhead of running Smartthings, event to do fairly complicated things is a great advantage. Having said this, I will be the first to admit that I have not evaluated the alternatives in any detail.

When I get my V2 hub, I’ll see if it gives me the ability to solve my problem and reply.

Thanks

Another note, the suggestion to run the ZWave repair seems to imply that there is a suspicion that the delay is within my house. Given that the ZWave network is almost completely idle and that the variability of the response can be from 15 seconds to a minute (or longer), I suspect that the variability is coming from the Smarthings servers and not from within the house. In any case, I did the ZWave repair and tried again with no change in behavior of the application. I really think the delay is within Smarthings server.

As to the comments about the Smarttings proprietary infrastructure, it is the Java VM running groovy code that has access to a set of APIs that interface with my local hub and associated hardware. I don’t know anything about the architecture of this infrastructure so I cannot comment on how easy or hard it would be to refactor the code, but it is possible to run this engine on my local PC in a Java VM and still protect their proprietary code. However, in their shoes I would do what they are doing as well. Push some of the decision making power to the hub. This gives the improved response time desired, a single platform in the customers home to support (vs every configuration of windows XP through Windows 10, linux, and possible Mac OS), and should in the long term reduce the compute load required at their server (just tracking decisions made running rules to make decisions).

Thanks
Jack Butch Griffin