Help, I'm ready to give up

These are three very distinct things.

As a programmer you will understand this simili.

Think of your .items files as your .h

Think of your .rules files as your .c

Think of the .sitemap as the user interface code which, if you are following MVC is separate.

So to turn around your question “In C why do I have to declare a bunch of stuff in a .h file and write functions in a .c file and what’s with all that code over there that runs the UI?” Its because they serve a different purpose.

http://docs.openhab.org/concepts/index.html
http://docs.openhab.org/tutorials/migration.html#new-concepts-things-and-channels

If you are coming from OH 1, Things and Channels replace the config stuff you used to put between { }. This needed to be abstracted to enable autodiscovery and management of everything through the UIs.

How would you propose to mix the functionality across them? For example, create behavior that triggers based on events from multiple sources? If all my zwave stuff is stuck located together, how can I let ym zwave stuff control my MQTT stuff and vise versa?

The primary reason d’etre of OH is to act as a kind of universal translator between multiple (over 150 at this point) technologies and APIs. As such it used the common architecture of layers of abstraction. If you compare it to the OSI networking model you will find a lot of parallels.

Application  Sitemap
Presentation Sitemap
Session      Rules
Transport    Items
Network      Channels   
Data         Bindings/Things
Physical     Dongles/APIs

Obviously the simili above is not perfect but I hope it is at least illustrative. These things build upon each other and the layers of abstraction allow, for example, Rules to work with any Item with no knowledge of what that Item represents nor how that Item communicates with the device it represents.

This is in the works and one of the main reasons for the Experimental Rules Engine.

And this is what the Experimental Rules Engine is intending to create. However, even with this you will still have a layer of abstraction between Items and Rules because a Rule should not know nor care what technology or device an Item is attached to.

6 Likes