SmartThings Community

FAQ: Github Integration How to Add and Update from Repositories


(Jimmy) #8

Thanks! For those of you that don’t even have a GitHub account, you have to first create the account and then create a repository names SmartThingsPublic.


(Jason) #9

Good point I’ll write it up and add it when I have time.


(Michael Hess) #10

I lost my github integration, I just get the enable github button now. Tried on a different browser and PC thinking it was a cache issue but same thing happens.

Any thoughts on how to get this working again?


(Rick S) #11

When I select Enable GitHub Integration from the IDE, it brings me to the page with the link, when I click on the link, it gives me a Page 404 error with a search box, if I enter SmartThings, it returns some +1200 repositories

The original instructions don’t work for me at all as I don’t see a wizard after selecting Enable GitHub Integration from the IDE

Rick


(Nate) #12

Thank you for this. It is very helpful! I don’t see what you describe here. I’m assuming I have to have added a smartapp or device. Is there a thread for how to add custom code? I’ve seen many that discuss it, but very few actually give specifics on “how to” that I can find.


(Jason) #13

(Allen Crawford) #14

Warning, I’m not a developer or Github expert, so this could be a very dumb couple of questions. But here goes anyway. I have the Github integration seemingly working BTW, but there are still a couple of things I don’t quite understand.

If I’m not developing any of my own SmartApps (currently true) then why do I even need to fork the main public SmartThings Github repo in the first place? Unless a forked repo in Github automatically stays up-to-date from the public repo I forked, then it seems like me using this forked repo would just lead to the SmartApps I consume being very out-of-date unless I also add to the IDE each individual developers’ own forked SmartThingsPublic repos where they are presumably updating their code. But that seems very inefficient assuming they are also pushing their changes upstream to the main repo. And if they aren’t doing this, then what’s the point of the main repo exactly? Basically, I’m just confused why I even need to have my own Github repo if I’m not writing any code since it seems that the SmartApps are either in the main public repo or some individual developer’s Github repo(s).

Also, I skipped the steps of cloning my forked repo because the documentation says it is optional and I (at least for the foreseeable future) don’t plan on debugging a lot of code or writing my own. However, the bolded part of those instructions concerned me a bit:

From docs.smartthings.com:
While not required to for submitting changes, this is useful so that you have a local copy of the source code (useful for grepping the source locally, using your favorite editor, etc.), and is required to update your fork from the main SmartThingsPublic repository.

Does that mean my forked copy will never get updated from the main one? Do I even care if I’m already adding individual developers’ Github repos to the IDE as well as the main public one?

I hope this all makes sense and thanks in advance!


(Jason) #15

It’s up to you whether or not you wish to fork the smartthings github repo. I did not write the docs.smartthings.com article, Step 2 was all that was “necessary” authorizing them to connect to your GitHub account.

Nope, If your using a Stock device type or smartapp you are better off adding it through the app or changing it to the smartthings device type in the ide as I believe those do auto update. Anything added through GitHub integration will require you to periodically check to see that your up to date using the color chart in the docs. The benefit of it is for an app like Rule Machine where there are tons of updates, you can easily check to see that your up to date and with 1 click get up to date vs having to copy and paste code into the IDE.

Again only step 1 and 2 were meant to be in my instructions thats why I quoted them, but I will put a note in OP in a bit.

Personal preference, Again the benefit is that you can quickly check to see if you have the current version without bugging each developer. Also it gets rid of copy and pasting turning it into a button push instead.

Hope that helps answer your questions!


(Allen Crawford) #16

Thanks for all the answers. I actually posted this in the wrong thread (had too many open) by accident. I wasn’t asking you directly any of these questions, I was just trying to better understand Github integration in general. I meant to post this in the thread where they announced the initial integration, so I might go re-post it there.

Regarding the “forked repo in Github automatically stays up-to-date from the public repo I forked” note, I was really just referring to Github only, not keeping my IDE up-to-date. Definitely understand that I have to update everything I install from Github manually myself, but yes, way better than copy/paste.

That said, I just chatted with a developer-type friend of mine that actually uses Github, so I think I understand it all now. I was just confused why anyone would fork the entire public SmartThings repo if they just wanted to add their own SmartApp since it makes it confusing in the IDE when you have to filter through the entire list of SmartApps in that particular developer’s forked repo to fine the one app you care about. Seems like doing what “bravenel” does with Rule Trigger makes more sense to me. But then I guess that repo doesn’t have the necessary relationship with the main SmartThingsPublic repo that you’d need if you ever want your app published there (a process I know nothing about yet).

I’ve also learned that you can rename your forked repos in Github so that they aren’t all “SmartThingsPublic” which makes things extremely confusing when you go to “Update from Repo” in the IDE and have several duplicately-named repos. But it would be cool if SmartThings would just add a label inside the repo settings so we could name them whatever we wish for clarity’s sake.

Thanks again!


(Jason) #17

Do you mean Can’t?

If you can, Please share =D


(Allen Crawford) #18

You can rename them within GitHub itself. Just log into github.com, go to your repository in question, click the “Settings” tab, then right at the top you can give it a different name. I had assumed doing this would break the integration with the SmartThings IDE, which would be really bad for people with popular public repos, but it actually doesn’t seem to do that.

I added my repo a second time to see if it would let me have them both and it did. I even added a SmartApp via the “Update From Repo” button with my old name (it worked) and then went to add from the new and it no longer had that app listed, proving that it is connecting to the same repo. I’ve renamed it a second time and strangely the old names still work even after if I deleted them from the IDE Settings and attempted to re-add them. So apparently I’ve got three valid repo names now. Not sure how long that’ll stick. Here’s an example where the first two are my own single, forked repo:

But, having a label inside the IDE is clearly even better since I can’t force other people to rename their repos.


[RELEASE] Device Monitor - Get Notified if Devices Stop Reporting
(Allen Crawford) #19

Follow up, just found this page that confirms the behavior I’m seeing in the IDE.

https://help.github.com/articles/renaming-a-repository/


(Jason) #20

This is what I was looking for, I thought you meant in the ide for others. Your right that it would be helpful for St to add a custom tag box that we could name in ide


#21

did you find a solution? I’m having the same 404 issue


(Michael Hess) #22

I’m still having the same issue, tried to modify the URL to what I think it should be, didn’t work. Also had a lot of little things mess up yesterday, sensors were part of smartapps that I’d never added them to, had to add and remove to get it synced and delete them. Was a PIA. It’s like someone did a partial data restore and it overwrote/mangled some stuff.


(RH) #23

Same here. This app install for me goes on the backburner again. Too much effort just to play with it.


(Jason F) #24

Thanks man! I was doing this crap all wrong and manually updating because I didn’t really get how to do the linking.


(Ryan) #25

I know this thread is a little old, but I’m hoping someone can help. I just added github integration and it appears to be correct, but none of the color changes that are supposed to be there show up. Everything still shows as just a pale, blue link color. Can someone help?


(Jason) #26

Here you go.


(Ryan) #27

Ok, help me along with this, what does that mean?

Sorry, I’m very unfamiliar with Github and its workings.