IDE for configuration and deployment

With Visual Studio, how do you copy the files over to the rpi?

I use the build in console to pull the git changes. But there may be more comfortable features available.

And for correctness:
Visual Studio != Visual Studio Code

Do I understand correctly:
You use git to syncronize the config folders on your home server (running system) and on your developement computer?

Yes. I am using git as kind of version control/backup anyway and pull changes in my live System.

Or I am working on my live system (Network share) directly for smaller changes and then push them to GitHub as backup.

1 Like

I like that!
I’ll have to dig into git, how to do the setup…

Maybe there is already some tutorial here. I didn’t search yet.

Yes, good for a start - but I’ll want to dig deeper…

Another alternative to git, or as I use it, in addition to git, is VSCode has a remote SSH extension that lets you open folders on another machine (i.e. the one running openHAB) through ssh. This has been a game changer for be at least.

Prior to that extension, most people shared their config and userdata folders using samba or NFS and mounted them to their local machine to edit. openHABian still comes configured to enable this.

But I still use got on my home servers to back up and keep a history on my changes to my oh config. I backup everything in the conf folder and everything in userdata except for cache, temp, and the jsondb backups folder. It’s all text so very git friendly.

And to help with HABPanel, it gets saved to userdata/config/org/openHAB/HABPanel.config I believe.

If you are used to eclipse, you can figure out VSCode easily enough. And you will probably be like me and surprised at how much it does with so little overhead.

I use a server called Gogs which is pretty nice. You can also run your own insurance if GitLab and Bitbucket I think. It if you don’t care if you have the nice weather based UI, there are tons of tutorials for how to set up a simple git server.

Follow my link posted above - if you have a look at my git setup you will see that you can push your changes via git from inside VS Code to your openHAB server - and you will find a link to a very good git tutorial / online ebook which I was using as source for getting started with git :wink:

really good stuff Felix, thank you much

1 Like

Git is also working with eclipse, so I don’t yet see a benefit of using Visual Studio.

Questions on git:
Where to host the repository? Of course, if having a server hardware it should go there, but my system is development PC + Raspberry Pi.
Initial check-in, from which copy to make my initial commit.
Any other pitfalls?

One possible benefit would be the Vscode openHAB extension.
But you have to try that and make your own decision if it brings benefit for your workflow.

Yes, the standard git setup would be to host a repo to which your raspi and your PC would sync.
I’m not doing that - I’m using the raspi as server repo and push my changes from my PC / Mac directly to my raspi.

Actually Jerome, I just used the link in your post to update the OpenHAB extension for vscode and it has been awhile since the last time I updated it and wow it is great!
thank you for the work on it!

1 Like

I’m using the raspi as server repo and push my changes from my PC / Mac directly to my raspi.

Yes, I saw that from the document linked above and I was wondering why. My first idea would be to host the repo on the PC (without any thoughts). Am I missing something?

  1. I don’t want to pull from the raspi, I want to push from my PC
  2. I’m using more than one PC, so the workflow is opening VS Code on whichever PC, pulling the newest repo version from the raspi, doing some changes, pushing the changes to the raspi.

VSCode has the openHAB extension that is:

  • openHAB Item and Thing aware
  • understands and provides syntax checking and code completion for .items, .things, .persist, and .rules files
  • in my experience requires half as much ram

yeah… and way more… it gives you all the options you don’t know about or think about. it fills everything in, it rocks

Ok, I’m convinced to install Visual Studio/VS Code.

For git. You are using the config folder /etc/openhab2/ as the repository, right? So not a seperate working directory and repository on the Pi?
But then, you cannot revert back, switch between branchs?

Yes I’m using /etc/openhab2/ as repo.
Why would I not be able to revert back / switch branches? With git only the files for the currently active branch (head) are in the folder structure. Means if I have a branch testing and a branch productive I could switch to the branch testing, do some development, test that my openHAB installation is running fine with my changes, merge the changes back into the branch productive and switch back to said branch…
Or my changes are bullshit and I revert back to the last working check in…