Sitemap shows empty groups!

Hi there!

I recently discovered OpenHAB in the search of an automation platform for the house I’m building.

I am using a RPi 2, with Wheezy, after finding out the GPIO binding has some issues with Jessie.

I have been reading and reading the wiki, the forums, and trying different things, but either something is wrong or I still haven’t figured this out.

If I just place a simple contact and switch for a GPIO connected led and button, it works, I’ve even started playing with rules and added a timed output connected to the same led but assigned to a different switch.

Then I wanted to start laying out the house, dividing into groups so when I start adding stuff I can keep things organized. For this I looked at the demo sitemap and tried to follow a similar approach.
The thing is, I can navigate through the group hierarchy I defined, but they show up empty when I open them. I can’t figure out what’s wrong!

The automation scheme is pretty simple. For now I just want to control the external rollershutters and the outdoor garden lighting.
I want to leave room for expansion to add some contacts, control the gates, and build up the system in time.

My intention is that the sitemap provides quick access to the rollershutters, individually and with a general switch, and then a switch for the outdoor lighting, and after that a floor plan to add items to, in time.

Here are my files and the resulting output. “Estores” is portuguese for rollershutters, I wanted all rollershutters to be accessible when clicking the Estores group, but it shows up empty, as does every other group - Jardim (garden) and Divisoes (house compartments) also are empty.

items:

Group Tudo
Group gDivisoes     (Tudo)
Group gJardim         (Tudo)
Group gEstores         (Tudo)
Group gBlackouts     (Tudo)
Group gPortoes        (Tudo)
Group gClima         (Tudo)
Group gEstado        (Tudo)
Group gSensores        (Tudo)

Group GSala                "Sala"                  <sofa>         (gDivisoes)
Group GCozinha            "Cozinha"                 <kitchen>     (gDivisoes)
Group GWCCom            "WC Comum"                 <bath>         (gDivisoes)
Group GCorredor            "Corredor"                 <corridor>     (gDivisoes)
Group GSuite            "Suite"                 <bedroom>     (gDivisoes)
Group GWCSuite             "WC Suite"                 <bath>         (gDivisoes)
Group GGabinete         "Gabinete"                 <office>     (gDivisoes)
Group GQuartoMeio         "Quarto do Meio"         <bedroom>     (gDivisoes)
Group GQuartoPonta         "Quarto da Ponta"         <bedroom>     (gDivisoes)
Group GGaragem             "Garagem"                 <corridor>     (gDivisoes)
Group GLavandaria         "Lavandaria"             <corridor>     (gDivisoes)



Group:Switch:OR(ON, OFF)         Luzes                 "Todas as luzes [(%d)]"                                 (Tudo)
Group:Switch:OR(ON, OFF)         Climatizacao         "Aparelhos ligados [(%d)]"                 <heating>         (Tudo)
Group:Switch:OR(ON, OFF)         BaixaEstores         "Baixar todos os estores [(%d)]"                         (Tudo)
Group:Switch:OR(ON, OFF)         SobeEstores         "Subir todos os estores [(%d)]"                            (Tudo)


Number   temp_ext   "Temperature [%.2f °C]"   {weather="locationId=home, type=temperature, property=current"}
Number   hum_ext      "Humidity [%d %%]"        {weather="locationId=home, type=atmosphere, property=humidity"}


Contact     MotionSensor             "Button [%s]"            { gpio="pin:18" }
Switch       RaspiLED                  "LED"                    { gpio="pin:4"}
Switch       Pisca

Switch         LuzExterior             "Luz Exterior"             { gpio="pin:8"}    (gJardim, Luzes)

Contact PortaoGaragem             "Portao da garagem [MAP(en.map):%s]"        (gPortoes, gSensores)
Contact PortaoFora                 "Portao de fora [MAP(en.map):%s]"            (gPortoes, gSensores)

Switch Shutter_all (gEstores)

Rollershutter Shutter_WCComum             "WC Comum"                    (GWCCom, gEstores)
Rollershutter Shutter_WCSuite             "WC Suite"                    (GWCSuite, gEstores)
Rollershutter Shutter_CozinhaRua        "Cozinha - Lado Rua"        (GCozinha, gEstores)
Rollershutter Shutter_Sala_TV             "Sala - Lado TV"            (GSala, gEstores)
Rollershutter Shutter_Sala_Meio         "Sala - Meio"                (GSala, gEstores)
Rollershutter Shutter_CozinhaJardim     "Cozinha - Lado Jardim"        (GCozinha, gEstores)
Rollershutter Shutter_Corredor             "Corredor"                    (GCorredor, gEstores)
Rollershutter Shutter_Gabinete            "Gabinete"                    (GGabinete, gEstores)
Rollershutter Shutter_Lavandaria        "Lavandaria"                (GLavandaria, gEstores)
Rollershutter Shutter_Garagem           "Blackout Garagem"            (GGaragem, gEstores)
Rollershutter Shutter_Suite                "Suite"                        (GSuite, gEstores)
Rollershutter Shutter_QuartoMeio         "Quarto do Meio"            (GQuartoMeio, gEstores)
Rollershutter Shutter_QuartoPonta         "Quarto da Ponta"            (GQuartoPonta, gEstores)

sitemap

sitemap gpio label="GPIO"
{
    Frame label="Hoje"
        {
            
            Text item=temp_ext
            
        
        }
        
    Frame label="Rasperry Pi GPIO"
         {
           Switch item=RaspiLED
           Text item=MotionSensor
           Switch item=Pisca
         }
 
 
    Frame label="CASA"    
        {
            Group item=gEstores     label="Estores"         icon="rollershutter"
            Group item=gJardim         label="Jardim"          icon="garden"
            Group item=gDivisoes     label="Divisões"      icon="house"    
        
        }
 
 

}

rules:

rule "LED"
when
  Item MotionSensor changed
then
  if (MotionSensor.state == OPEN) {
    RaspiLED.sendCommand(ON) }
  else {
    RaspiLED.sendCommand(OFF) }
end

rule "Test"
when
    Item Pisca received command ON
then
    var i = 0
    while((i=i+1) < 3) {
        sendCommand(RaspiLED, ON)
        Thread::sleep(10000)
        sendCommand(RaspiLED, OFF)
        Thread::sleep(10000)
        sendCommand(Pisca, OFF)
    }
end

I can only post one image, but clicking on any of the CASA group items leads me down the group hierarchy but in the end they are empty - no switch’s, rollershutters, nothing.

What happens if you put an Item on the sitemap individually?

One note about using Groups on the Sitemap. It sounds like a great idea when you first start all out but you will quickly find that as soon as you want to do any sort of customization of how your Items appear (e.g. you have a Switch but don’t want it to be changeable on the sitemap, or you have a label you want change the color of based on the Item’s value, or you want to have a certain Item only be visible when a certain Item is in certain state) you will have to abandon Groups because you can do none of that when using Groups on your Sitemap.

That doesn’t mean Groups are not useful in other ways. They are INCREDIBLY useful. Just not for Sitemaps, in my opinion.

That being said, the order of definition segments for an Item is fixed. You must define the Group memberships before the binding configs (i.e. the { } stuff). The proper order for an Item definition is

Type Unique_Name "Label" <icon> (Groups) { bindings }

Label, icon, Groups, and bindings are optional, but the order is not.

1 Like

Thank you!

Yes, you are right, I had accidentally put the group after the binding on a switch, I think it was causing all the problems. So for now it’s working! :slight_smile:

Thank you also for pointing out the “shortcomings” of using groups in sitemaps. If not by using groups, how else would you suggest making a hierarchy that I can navigate through and still allow for the things you mentioned?

The layout of the house is pretty simple and I only added binding for the GPIO to test if it’s working and because I wish to keep hardware cost to a minimum.

What I must implement for now is the shutter control and outdoor lighting, as all the motors and local wall switches will be routed to an electrical box where I need to set up the raspberry and any other hardware I will use. Eventually I would like to expand the system using things like Hue, Wemo, etc. but that will be over time, after I finish construction.

Any idea on how to implement a general open/close all the shutters?
Thanks again!

Use

Text item="blah" {
}

That will create a subpage to click through just like a Group.

Here is where Groups are really useful. Put all the rollershutters into the same Group and send the command to the Group. That command will be forwarded to all of the members of the Group.

You will probably want to define the Group as a Dimmer:

Group:Rollershutter:MIN allShutters

You could also use MAX or AVG to aggregate the states of all the shutters for the Group’s state.

If you put allShutters on your sitemap the same as you would an individual shutter, it will work just like an individual shutter only any changes will go to all members.

1 Like