Zone Updates for Smartthings

Contribute source code here. Anything not accompanied by source code will be removed.

Zone Updates for Smartthings

Postby yhax » Mon Jan 28, 2019 2:18 pm

Not sure if anyone would find this useful so I've left it in my own branch instead of creating a PR in the main AD repo (also, I haven't created a PR yet because there is more I want to address first).

Something that has driven me nuts is this business of hardcoding zones (I still see people expanding zones, it's now up to 20), once they are hard coded you still have to map everything through the app, the names don't make sense etc etc. So I went ahead and took a stab at fixing the problem. There is still quite a bit left to do, and to get this working requires some work.

First, this is what it currently looks like today:

Image

ZoneTacker Sensor XYZ doesn't make sense to me. In the list of devices, you also have:

Image

which is unfriendly. With the changes I've made, it will look like this after you are done:

** Note: the mapping is automatically generated from the new changes, I did not enter in any of these **

Image

So to get this to work (I've updated the readme.md in the branch), I assume you've set your zone names on the panel. In a future update, I'd like to be able to set the zone names directly from the AD webapp. It's tricky but I think it can be done.

Assuming your zone names are setup properly, you are going to generate a groovy file which has all the zones and status numbers automatically. As for the mappings, when you generate the file, it adds a column to the zone database with a smartthings id to map to. I.e. Sensor 9 is Smartthings ID 1 for example. The column adding is non destructive i.e. you shouldn't lose any data by clicking generate.

Image

Image

Full Image Link

What still needs to be done:
- All this is assuming you have zone names setup, if you don't you need to set them. Going forward, setting them through the UI would be cool.
- All of this code is in a different repo, you can't switch webapp repo's. If the AD folk are ok with me adding an override repo url textbox, this could be addressed (it's a bit tricky). For now, you would need to manually overwrite your files with whatever files are different between AD/master and myrepo/this_branch.
- Haven't gotten around to dealing with if you add another zone manually or edit one.

Anyways, for now I'll try keep my forked branches in sync as often as I can, and please add any issues you find or requests through the github pages. I work on this once in a blue moon but I'll try get to any bugs / requests when I can.

The readme has a section you need to follow about where / when to paste the generated file, and also about setting your api key.

ST Branch with the updated readme

Webapp branch

If you do decide to try it out, please remember to backup your stuff. If you tried it, and hate it, you can remove the DB column with:

Code: Select all
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE zones_backup(id, zone_id, name, description);
INSERT INTO zones_backup SELECT id, zone_id, name, description FROM zones;
DROP TABLE zones;
CREATE TABLE zones(id, zone_id, name, description);
INSERT INTO zones SELECT id, zone_id, name, description FROM zones_backup;
DROP TABLE zones_backup;
COMMIT;


(nothing will happen if you leave the column in but always good to clean up)

Enjoy!
yhax
newt
newt
 
Posts: 7
Joined: Sat Jan 06, 2018 11:58 am

Re: Zone Updates for Smartthings

Postby mathewss » Mon Jan 28, 2019 2:38 pm

Looks good! I will put some time in at my own house and switch to your branch to help test.

Did you notice my last update regarding timeouts and adding zones? I have not looked over all of this yet but one issue I had was being able to create devices and having it timeout on my session in the ST cloud app.

To solve this I had it send the instruction to add the zone async back to itself. Seems to be working not sure if it is relevant but at least now if you need to create 30 zones it will work.

Another problem I need to figure out and if you see any data please let me know is how to have the virtual sensors be most visible to other apps. Such as allowing Amazon Echo or other ST interfaces to see all of the zones and switches for the system. This comes down to the device type.

Also I am going to be turning on the DISARM button at some point or making it able to be turned on/off. I believe it may be possible to even allow for some user feedback such as a code to activate a button. Some way to make it secure to disarm the panel via some external system through ST.

Thanks for your contribution I look forward to trying it out.

Best
Sean M
mathewss
Moderator
Moderator
 
Posts: 188
Joined: Fri Dec 06, 2013 11:14 am

Re: Zone Updates for Smartthings

Postby yhax » Tue Jan 29, 2019 11:45 am

mathewss wrote:Did you notice my last update regarding timeouts and adding zones? I have not looked over all of this yet but one issue I had was being able to create devices and having it timeout on my session in the ST cloud app.


Completely missed that! I'll integrate the handler with my changes, probably this evening. Thank you!

mathewss wrote:To solve this I had it send the instruction to add the zone async back to itself. Seems to be working not sure if it is relevant but at least now if you need to create 30 zones it will work.


Good to know! I've been testing with just under 25 zones, but I'll create a few more.

mathewss wrote:Another problem I need to figure out and if you see any data please let me know is how to have the virtual sensors be most visible to other apps. Such as allowing Amazon Echo or other ST interfaces to see all of the zones and switches for the system. This comes down to the device type.


I haven't really tried to do something with that but if you have some more info on the issue / replication steps, I can definitely dig. I had an alexa app/skill in the catalog for a while, so fairly familiar with that end of things.

mathewss wrote:Also I am going to be turning on the DISARM button at some point or making it able to be turned on/off. I believe it may be possible to even allow for some user feedback such as a code to activate a button. Some way to make it secure to disarm the panel via some external system through ST.


That would be really handy, thank you! I think for now my plan is to 1) incorporate your timeout change, 2) I'd like to get arm instant back, I know I had it working at some point but it was probably hacky 3) lastly, I want to build a IFTT type thing into the webapp. There are a bunch of things I find I can't do in ST. If this AND that, check this, and do that, and maybe that etc... I know there are some other apps out there that do that, but I don't really want my secrets / tokens out and about more than they need to be.

Thanks again!
yhax
newt
newt
 
Posts: 7
Joined: Sat Jan 06, 2018 11:58 am

Re: Zone Updates for Smartthings

Postby yhax » Wed Jan 30, 2019 5:36 pm

Async changes are now integrated in my zone.updates branch. Thanks!
yhax
newt
newt
 
Posts: 7
Joined: Sat Jan 06, 2018 11:58 am

Re: Zone Updates for Smartthings

Postby mathewss » Tue Feb 19, 2019 11:55 am

Sorry for the late reply. I have my Hubitat but have not installed it yet. I have some work to do on the driver over the next few days so I will keep you posted if I make any changes. One question came up that I need to verify. Is it possible to have multiple AD2Pi's attached to a single ST or HU? Hub.

I am going to try and ponder this a little today. I think the only issue is the Name so something simple like a Prefix setting would resolve this. Any thoughts on Hubitat?

Best
SM
mathewss
Moderator
Moderator
 
Posts: 188
Joined: Fri Dec 06, 2013 11:14 am

Re: Zone Updates for Smartthings

Postby mathewss » Tue Feb 19, 2019 8:06 pm

I just put a small change on the dev branch of AlarmDecoder-smartthings. I think it will effect the Hubitat driver code. I added a filter to the LocationHandler that filters messages so it only listens to ones for its MAC address. I also made it easier to run multiple services by assigning it a small name change via config vars in the service code. I have no idea if this works the same way on Hubitat yet so let let me know and I will read your diff.

Best
Sean M
mathewss
Moderator
Moderator
 
Posts: 188
Joined: Fri Dec 06, 2013 11:14 am


Return to Code Contributions

Who is online

Users browsing this forum: No registered users and 11 guests

cron