IDE for configuration and deployment

For now, I was writing my configuration files (myItems.items, myThings.things, …) with notepad. Writing javascript rules without any checking.
Even more pita was the deployment using pscp from commandline to copy the files to my Raspberry Pi (/home/pi) and then via putty/ssh moving the files to the correct directory (e.g. /etc/openhab2/items).
Backup is another issue, some items/things are in the openHAB database and not in the config files, the widgets for HabPanel are another place…

As I’m used to it, I could use eclipse IDE. Any recommendations?

Did you already try

with

https://marketplace.visualstudio.com/items?itemName=openhab.openhab

Javascript is supported as language, but the openHAB specific stuff isn’t available yet.
I have not yet tested the remote development features.

I have git version control configured for my config folder and use that to manage backup, environment and an local config. (I think this is a relative common approach here.)

My initial setup including backup config & deploy workflow: openHABianPi Initial Setup

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