Just trying to figure out how to only allow my smartapp to be installed once on a hub. Any direction on this one would be much appreciated.
What is the use case?
I don’t believe it is possible
Well, the use case is that there’s no need to install the smartapp multiple times on a hub. Simple as that.
It connects to a local service - kind of like how the sonos connect app works. Determines devices available and manages them. But if multiple are installed, now you have multiple smartapps with possibly different states and settings, but all connected to the same service (in which there can/should only ever be one connection to and one available)
Not to be flippant, but… then just install it once.
Many SmartApp (most?) might be installed multiple times. For example, I wrote a SmartApp that interfaces with my Ubi and allows me to say: “Open the Garage Door” or “Close the Garage Door” and ST will only open or close if the door is already closed or open. But I have two garage doors, so I have it installed twice (slightly different Ubi trigger phrases).
I have a wireless 3-way app that if any switch in a group is turned on, it turns all the switches in that group on. I have this installed a couple of times as well for different groups.
There are plenty of use cases where a SmartApp needs to be able to be installed twice. And few where it should never be installed twice. Given that you control the install or not-install of apps in your environment, I’d say just don’t install it twice.
Well sure, that’s how that app works. If there are multiple of this one installed it will cause issues and things will not work as expected.
Are you worried that end users might be installing it multiple times?
@chrisb That’s correct. The hope is to get the app officially published by ST. But, if end users are able to install more than once in a location it has potential for problems. I suppose it’s possible to build in some logic - but it’d rather not have to for what (i think) should be a simple thing to deal with.
I think right now that most users who would be using a third party app like this would understand if you stated clearly in the app install process that it should only be installed once and installing more than once will cause issues.
Check out the SmartAlarm program for some great work as far as displaying a message when first being installed.