[ST Edge] Using driver package as a local home automation SmartApp?

So, let’s assume I write/compile a single comprehensive driver package covering as many of my devices as possible. I only have 12 different Z-Wave types and most are close cousins. Unfortunately, some proprietary devices will still require a cloud interface. If I can’t get device information (name, Z-Wave network ID, etc.) dynamically, I can build a static copy into the driver package. It’s my house and my hub, This is not to share (without modification). I can add derived capabilities which are displayed on certain devices. Any other global preferences or custom display would go in virtual devices. All 3rd-party integrations continue to work. I could use the Rules API or just hardcode logic in Lua. Almost everything runs local on a single box. All can be backed up. Tell me why this won’t work. I’ve posted some leading questions below.

The purpose of a driver is to integrate Zigbee, Z-Wave, or LAN devices into the SmartThings platform.
A SmartApp (not SmartApp Connector) is used to build complex automation using different integrated devices.
Some of the differences between Drivers and SmartApps are:

  • You cannot make requests to the SmartThings API using a driver, but it is possible using a SmartApp (and its Access Token)
  • A SmartApp can receive inputs from the user and use them as a parameter for their installation. When working with SmartApp Connectors you can create a custom onboarding page for the devices but they will run in the Cloud.

It’s not clear what isn’t working in your case, also, it seems the questions you mentioned are missing. Can you share more info, please?

2 Likes

It’s all code, so you are able to build additional logic into your driver. You could create a “device” that does nothing more than setup configs for this “app” and runs on the hub. I would look out for doing too much work on the hub though.

I’m asking theoretical architectural questions. I’m looking for potential roadblocks before I waste time on something that’s not even possible.

  • You cannot make requests to the SmartThings API using a driver, but it is possible using a SmartApp (and its Access Token)

What if the driver has a valid Access Token generated elsewhere? Is there some mechanism that prevents API calls from within the hub? In that case, I would at least need to create an external proxy for occasional API calls.

I think the point you’re missing is that I’m proposing a one-off solution for personal use. Others could use my framework, but they’d need to configure (hardcode) for their own use. Assume that all my devices have already been added to the hub using some minimal Edge driver. I can then build my complete device list into my driver package. Not just the types, but the actual device specifics. I would then need to transition each device to my driver package. That would be the single pain point.

Speaking just for myself, it seems pretty early to evaluate what rules engine processing will be available locally once the transition is complete. But since both Routines and Recipes from the Rules API Are intended to run locally in the new architecture, I’m not quite following what specific advantage you’re expecting to get from your custom edge driver.

Or do you just not believe that the official features will end up running locally?

3 Likes

Drivers cannot make REST calls outside of the hub. You can use REST apis within the LAN, but not call out to the internet. To support something like that, you would need to setup a forwarding service on your LAN. I think @TAustin has a driver that does this and runs on a local Rasberry Pi.

1 Like

If you want to reach the internet anyway in your app, why not use IFTTT?

Yes, pretty configuration could introduce some bloat, but the core logic is going to be running on the hub one way or another. I think my setup is pretty tame. I just don’t like how all the logic is scattered all over the place. I currently have 41 physical devices and the majority are not part of any elaborate logical relationship.

He has Two projects that might be relevant depending on the details of the use case.

  1. an edge driver that issues local post/get
  1. A project that uses a local raspberry pi as a direct-connected device.

The third that @nmpu might find useful is what @blueyetisoftware mentioned: if you want to be able to access urls outside of your LAN, you can use my forwarding bridge server, which is a simple Python script that runs on any always-on computer (Pi/Linux, PC, Mac). This includes the ability to issue any SmartThings RESTful API from an Edge driver.

2 Likes