Help me understand

I am currently studying the wiki and all the different blogs I come across on the subject of OpenHAB. Unfortunately, I am not a programmer, though I am a technician (windows - but I can find my way around the Linux environment and work the console enough to survive). I would like to use this thread to clarify the things that are not so clear to me while I am learning OpenHAB. Despite my best effort, as much as I pour over any documentation I can find, some things are not clear to me probably because I lack the coding background. I’m a bit lost at times with the concepts or terminology. I am willing to put in the effort, but I need guidance from others more experienced. Any help is welcome and appreciated, even if it is nothing else than a link that will point me in the right direction. I would ultimately like to write a guide in layman’s terms to enable any windows user (most of us out here) to find his/her way around without technical skills. It would be better for the project if the instructions were laid out in a language and manner that would enable a non technician to comfortably and effectively take charge of OpenHAB.

Please help me understand in layman’s terms.

note: my current install: is OpenHAB 1.8 on raspberry pi

the demo.items file contains:

Group:Switch:OR(ON, OFF)

What do the colons represent, and how do I read this in plain english?
`

What version of openHAB are you trying to implement/learn?

I currently have the latest V1.x of OpenHAB installed on a raspberry pi.

While openHAB 2 is still in beta, it is now really stable and it might be a better option for a “non technician”, and this is also the future.

Take a look at http://docs.openhab.org

These are also still a work in progress but you might find them helpful.

P.s. I am running openHAB 2 sucessfully in a Windows 7 environment.

Thank you for this clarification.

This is what Ihave in my personal notes: " groups are defined by function, device type, or location for the things that we want to control together or at that location (or time?).
In the sitemap, the content of a group can be displayed from a menu by specifying the GroupName as the item: " Group item=GroupName". This displays all the items that belong to the group.

Please correct me if I’m wrong.

I don’t recall having come across columns in group definitions, so I don’t know what hat is. I can’t find it in the wiki.

Usually there’s a period for devs to catch up on the upgrades. I did not go with V2 because I was concerned that I might no be able to make things work, thinking the older version would be a more beaten path with more documentation and proven experiences.
Do bindings and the rest of the setup work the same?

Depending of what binding you are talking about, you might actually find it easier.

I started with openHAB this year and decided to go with openHAB 2 and I have not been disappointed. That said you have to be patient and prepared to put up with the ocasional issue, but as I said above the platform is now very stable.

MikeD,
I looked around the V2 wiki wiki pages to get a quick sense of the changes and see the available bindings to find out if the ones I am trying to work with first are supported. I will install a copy of V2 also and learn to work with both.

Based on the admittedly biased selection of users who post to this forum, I would guess that the majority of users are running openHAB on some sort of Linux, with the majority of those users running it on a Raspberry Pi.

I admire your goals, they are the same goals of the openHAB Documentation effort. I would encourage you to post this “guide” in the form of tutorials to the Tutorial and Examples tag and/or contribute to the openHAB 2 documentation. At a minimum (if you stick with openHAB 1.x) you can edit the wiki pages.

The syntax and meaning of this Group definition is covered in the wiki here:

In addition to that old posting of mine @sihui posted which explains the uses of a Group, the specific meaning of the above is:

  • Group This is a Group type Item
  • Switch When treating this Group Item as if it were an individual Item, treat it like a Switch. Thus, if you send an ON command to this Group, openHAB will forward that ON command to all the members of the Group. This works best if all the members of the Group are Switches also.
  • 'OR(ON, OFF)` The state of a Group Item is the aggregate of all the members of said Group. There are a number of ways openHAB can calculate this aggregation. In this case the OR aggregation was chosen. “If ANY of the members have a state of ON, the Group’s state will be ON, otherwise its state will be OFF.” If you defined is as OR(OFF,ON) that would mean “If ANY of the members have a state of OFF, the Group’s state will be OFF, otherwise its state will be ON”. AND(ON,OFF) means “If ALL of the members have a state of ON, the Group’s state will be ON, otherwise it will be OFF.”

This is correct but not complete. This is how I would define it.

"Groups are a way to collect one or more Items together and treat those Items as one unit. Each of the Items who are members of the Group share some trait in common that makes it useful to be able to treat them all as one unit. Reasons to put items into the same Group includes but is not limited to:

  • Simplify sitemap creation as putting a Group on the sitemap using the Group tag will cause all of the members of the Group to be places on the map
  • Control a group of like Items with one control (e.g. turn off all the lights by sending one command to a Group)
  • Specify which type of persistence is applied to individual Items without listing each Item in the persist files
  • Aggregate the states of a lot of Items (e.g. Group:Switch:OR(ON,OFF) for all your presence switches to see if anyone is home"
1 Like

In my reading, I had missed this somehow. I found this syntax in the group definition:

Group:itemtype:function itemname ["labeltext"] [<iconname>] [(group1, group2, ...)]

That is my objective.

in my case, the most documented tutorials I found were on blogs that documented pi installs. After reading, it seemed easier to me to go that route. I didn’t even bother looking at anything else.

Thank you for your plain english explanations. They’re exactly what I needed. Much appreciated.

I think I understand now. It means:

"send an OFF switch signal to all items in this group if at least one of them is ON"

Not quite. A Group has a state like any other Item. By using “Switch” we are saying that the Group Item’s state can be ON or OFF. So what that means is

“The Group Item’s state will be ON if one or more of the members of the Group is ON, otherwise the Group Item’s state will be OFF.”

This is useful to get an aggregate state for a bunch of Items. For example, I can just check my gPresence state to see if anyone is home because it is defined as:

Group:Switch:OR(ON,OFF) gPresence

Thus, if any of the members of that Group are ON (I have switches that represent all the ways I detect whether someone is home or not) gPresence will be on. Therefore I can do a simple if(gPresence.state == ON) to determine in rules whether or not anyone is home without needing to check ALL of the Switches to see if any one of them is ON.

Similarly I use a Group:Number:MIN gBatteries to see the minimum battery level of all of my battery powered devices. This Group Item’s state will be the minimum of all the Number Items that are members of the Group. So I can see at a glance whether any of my batteries need replacement.

To send a command to all members of the Group, you send a command to the Group. You can do this from the Sitemap (e.g. Switch item=gAllLights), from a Rule (e.g. gAllLights.sendCommand(OFF)), or through the REST API.

In this context, as far as the Rule or sitemap is concerned, there is nothing different about a Group from any other Item.

then I think it means:

The Group:Switch:OR(ON,OFF) is used to set the value of gPresence.
Do I have it right this time?

That is correct.

I am still writing a simple tutorial, but I am at my wits end reverse engineering this thing, and believe me, it’s not for lack of googling and trying.
At this point, I feel I have some understanding of the way OH works.However, somethings are still not clear.
I understand the file structure, the dynamic loading of the configurations,what an item is and how it fits in the architecture, the role and structure of the sitemap, the configuration of the binding. Armed with that, I started working on squeeze as my first piece of equipment to test. I added the IP of the server and the mac of the player to the config file, copy and pasted some of the example I read, made the corrections based on the forum discussions, but no go. At this point, I just want to establish communication and verify that I successfully reached the player by using a simple on/off switch on the sitemap to turn the unit on/of. I’m not sure what to do.
My first question is: do I have to have a rule?
2nd: is there a way to test connectivity to the squeeze server?
3: how do I create a single item to turn it on/off?
4. what do I used in the sitemap file to display the button?

I just need to be sure, because at this point, I’ve tried too many things. I’m missing something, and I’m not sure what. Please help me fill the wholes. I need to understand the concepts and process, I’m not just interested in making it work, reason why I did not other with my config files. I can work it out from the examples, once I have the understanding.

I don’t know Squeezbox so can’t say for sure, but you shouldn’t need a rule for this.

First check the logs. You should see something in there from the squeeze binding when OH starts. then make sure you can ping the server from the command line.

From the wiki page it would look something like this:

Switch sq_test_play        "Play"       { squeeze="player1:play" }

All of the valid commands are on the wiki page.

Per the wiki page, to use buttons instead of toggles for switches you use MAPPINGS:

Switch item=T_D_Garage1 label="Garage Door 1" icon="garagedoor-closed" mappings=[ON=Open]

If you want more than two states, use a Number Item instead of a Switch.