Begin coding

im pretty new to openhab2, and having everything running on a raspberrypi. have my Lifx lights binded and working correctly… which is pretty much it… but my question is… where do/did yall start learning write codes and exc for this? like is there a template or something that can make small changes or videos to learn from? any and all suggestions are welcomed.

What’s your concret problem?
Do you want to to write rules/scripts?

I can tell you that when I started, the best reference for me was the Demo configuration. It got me familiar with how openHAB configuration is laid out, I started making small changes to see how they affect the sitemap or rule behavior, and then used those templates to create my own original sitemap/rule-set. It’s a good starting point I recommend to everyone who’s not familiar with openHAB yet.

After that, this community is the next best thing. When you have a particular problem/idea, come create a post on this forum, and you’ll likely get an answer very quickly.

As for YouTube videos, I would recommend yoyoTech, MK-SmartHouse and my own channel (BKHobby), but I’ve only started my openHAB basics series, and haven’t touched on the topic of rules yet. I do have some videos that deal with specific functions using rules (e.g. lighting scenes, LED strip control, etc…)

Welcome to the openHAB environment and good luck!


I’ll second bartus’ advice. Start with something that you know works (Demo config) and start to explore by making small changed or additions here and there. Copy a Rule and change what it does. Add an Item and see if you cna make it trigger a new Rule, stuff like that. Gradually you will decide that you need to do something on your own. At that point give it a shot and when you run into a blocker come and we will be happy to help.

I look forward to your series on rules @bartus. I need to get on Youtube more to see what you all are presenting. Lots of people do better with video and I can start answering questions to links to videos, not just text.

1 Like

@rlkoshak - rules are definitely not an easy topic to tackle in video (without making it boring) but with most of my videos, my idea is to break the topic up into smaller chunks and reference either specific posts here on the forum or OH documentation entries. I think it’s just another avenue to give people information they need (especially the visual-oriented people who get easily distracted when facing a wall of text - myself included!). Videos don’t replace the discussion and reference information available in the other two areas, but they augment the information with visual examples and demos, which hopefully help the viewer grasp the idea (or to know what to look for within documentation/forum topics).

I completely agree. And for some people hearing it instead of just reading it makes it click better.

thanks for everyones input, to me rules are for the most part similar to relay logic and i got that it all make sense… im just completely new with the coding part

Funny you mention relay logic - I would LOVE to have some sort of ladder designer for rules, since the flow of it makes so much more sense for me and it’s so easy to show conditional statements, and/ors, implement timers, etc…

Actually, there is a Siemens PLC binding in OH, so that’s already possible (though I personally prefer Allen Bradley’s ladder/program organization)…

Since we are discussing wants, I’d love to have a good generic state machine. So much if what everyone wants to code is just a big state machine. If we could represent it in a table it’s be so much easier for a lot of users committed to switch statements and if else statements.

It seems like every subdicipline had their own preferred way to solve common problems.v

I think that’s the point - everyone’s got their own preferences, experiences and “wants” (though to that particular person, they might seem more like “needs”)…everyone has their hammer (favorite programming tool) and to them, every problem looks like a nail, even if it might look like a bolt to someone else…As long as we provide multiple options for implementing rules (e.g. DSL, graphical, Node-Red,…), everyone will find a way to get done what they need to.

</waxing philosophical>

1 Like

Could someone please explain his setup for creating habpanel dashboards? Do you code in habpanel (browser) do you use an external IDE? If yes do you have to copy the code into the browser to test everything or can you work directly on the files? Where can you find that files?

I really want to start working with habpanel, but I can find the right starting point. I have done some things in habpanel itself but coding in the browser isn’t that much fun. There is a better way, right?