[SOLVED] Style Guide for openHAB?

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