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:
ZoneTacker Sensor XYZ doesn't make sense to me. In the list of devices, you also have:
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 **
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.
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!