[SOLVED] Style Guide for openHAB?

Hello Community,
I was playing around with node-red and noticed I could not really tell which items belongs to what.
So I started to think about Code Style, and noticed there is a Code Style Guide for openHAB but only for Development.
In my opinion there should be a Code Style Guide for common Users too.
Example: User Marie Curie has 3 Things with each 2 Channels.
Marie Curie thinks Okay I create Items for each Channel item1, item2, item3 and so on.
Later on she wants to write some rules, Nuclear explosion

Naming your items is common sense, but shouldn’t there be some sort of Style Guide ?
I would love to know your thoughts about this.

ref: http://docs.openhab.org/developers/development/guidelines.html

This topic comes up about twice a year.

The problem is beyond “use meaningful names” it is hard to come up with a style guide that works for everyone or even the majority of everyone. If you ask any two OH users you will get three or four different styles.

Unlike with the sw code that requires lots of developers to work together to write a single piece of software, each openHAB config is the product of one or a few people so often what happens is each person thinks about it comes up with their own style.

That being said, this is probably worth adding to the Beginner’s Tutorial in some way.

My personal style for Item naming used to be really complicated and thorough but I’ve reverted to:

  • starts with “a” for actuators
  • starts with a “v” for values and sensors
  • starts with a “g” for groups
  • use similar names for related items so I can use this

That’s it.

1 Like