Charts are working, but not showing in groups [Solved]

Hi

Sorry to bother you with my (probably) noob question.
Recently I’ve bought a TriSensor from Aeotec, the installation was easy and it works great.
However I cannot get my charts to show in my “Bathroom-group”.
On the homepage of my sitemap everything works great.

This is my sitemap “homepage”.
And this is what I see when I click on “Bathroom”.

And this is my sitemap:

sitemap fresh_corners label="Fresh Corners" {
    Frame label="Kelder" icon="cellar" {
        Group item=C_Basement
    }

/*
    Frame label="Begane grond" icon="groundfloor" {
    }
*/
    Frame label="Eerste verdieping" icon="firstfloor" {
        Group item=FF_Bathroom
        Group item=FF_MasterBedroom
        Group item=FF_KidsRoom
    }

    Frame label="Buiten" icon="garden" {
        Group item=OU_Backyard
    }

                Frame label="Verbruik KwH Boiler"{
                Switch item=C_chart_period label="Grafiek" mappings=[0="Uur", 1="Dag", 2="Week", 3="Maand"]
                Chart item=C_Basement_Temperature period=h refresh=6000 visibility=[C_chart_period==0, C_chart_period=="Uninitialized"]
                Chart item=C_Basement_Temperature period=D refresh=12000 visibility=[C_chart_period==1]
                Chart item=C_Basement_Temperature period=W refresh=30000 visibility=[C_chart_period==2]
                Chart item=C_Basement_Temperature period=M refresh=30000 visibility=[C_chart_period==3]
            }

                Frame label="Licht Badkamer" {
                Switch item=Badkamer_chart_period_licht label="Grafiek" mappings=[0="Uur", 1="Dag", 2="Week", 3="Maand"]
                Chart item=CF_Bathroom_Licht period=h refresh=6000 visibility=[Badkamer_chart_period_licht==0, Badkamer_chart_period_licht=="Uninitialized"]
                Chart item=CF_Bathroom_Licht period=D refresh=12000 visibility=[Badkamer_chart_period_licht==1]
                Chart item=CF_Bathroom_Licht period=W refresh=30000 visibility=[Badkamer_chart_period_licht==2]
                Chart item=CF_Bathroom_Licht period=M refresh=30000 visibility=[Badkamer_chart_period_licht==3]
            }

                Frame label="Temperatuur Badkamer" {
                Switch item=Badkamer_chart_period_Temp label="Grafiek" mappings=[0="Uur", 1="Dag", 2="Week", 3="Maand"]
                Chart item=CF_Bathroom_Temp period=h refresh=6000 visibility=[Badkamer_chart_period_Temp==0, Badkamer_chart_period_Temp=="Uninitialized"]
                Chart item=CF_Bathroom_Temp period=D refresh=12000 visibility=[Badkamer_chart_period_Temp==1]
                Chart item=CF_Bathroom_Temp period=W refresh=30000 visibility=[Badkamer_chart_period_Temp==2]
                Chart item=CF_Bathroom_Temp period=M refresh=30000 visibility=[Badkamer_chart_period_Temp==3]
            }
}

It seems to be doing what you tell it.
Every line on a sitemap is a widget, a display building block.
It can be confusing when some widgets have the same names as Item types, like Group and Group, but really there is no connection. Consider widget Chart and Item type … well, there isn’t a charting Item in OH.

Group in a sitemap context is widget that displays one line until you click it, then it goes away and fetches any member OH Items of the group Item you named in the definition, and displays those individually.
This is shown in your second image.

The charts you’ve made are not member Items of any group - they are sitemap widgets, not OH Items after all, so they won’t appear.

So, I guess what you are trying for is hidden charts that show when you click?

The curly brackets { } can do a bit of magic in sitemaps, modifying the behaviour of the widget that owns them. Where in a Frame widget they just set the boundaries of the box, in any other widget they give a hide/show capability. This is not obvious.

Example:


Group item=FF_Bathroom {
   Switch item=C_chart_period label="Grafiek" mappings=[0="Uur", 1="Dag", 2="Week", 3="Maand"]
   Chart item=C_Basement_Temperature period=h refresh=6000 visibility=[C_chart_period==0, C_chart_period=="Uninitialized"]
   Chart item=C_Basement_Temperature period=D refresh=12000 visibility=[C_chart_period==1]
}

Note the form Group ... { other lines } which changes the game.
What will happen here is that you’ll get the one-line display to begin with, showing the summary of your Group Item.
But when you click it, instead of showing members of the group, it will show the lines between { }. Here, that’s the charts.

The problem with that is that you no longer automatically get the group members. It’s instead of, not as well as.
You’ll have to individually specify the Items to include in the sub-display. Seems a chore, but you do get to choose the order, add colors, etc.

Group item=FF_Bathroom {
   Switch item=Bathroom_light
   Switch item=Bathroom_Fan
   Text item=Bathroom_Temperature
   Switch item=C_chart_period label="Grafiek" mappings=[0="Uur", 1="Dag", 2="Week", 3="Maand"]
   Chart item=C_Basement_Temperature period=h refresh=6000 visibility=[C_chart_period==0, C_chart_period=="Uninitialized"]
   Chart item=C_Basement_Temperature period=D refresh=12000 visibility=[C_chart_period==1]
}

It’s possible to nest { } effects. Here’s a version where you click on bathroom group to get bathroom Items, then click again to get charts.

Group item=FF_Bathroom {
   Switch item=Bathroom_light
   Switch item=Bathroom_Fan
   Text item=Bathroom_Temperature
   Text label="Click for charts" {
      Switch item=C_chart_period label="Grafiek" mappings=[0="Uur", 1="Dag", 2="Week", 3="Maand"]
      Chart item=C_Basement_Temperature period=h refresh=6000 visibility=[C_chart_period==0, C_chart_period=="Uninitialized"]
      Chart item=C_Basement_Temperature period=D refresh=12000 visibility=[C_chart_period==1]
   }
}

You have to take care matching up { } brackets, and careful indenting will help you keep your sanity.

2 Likes

Wow, thank you!
This has made things sooo clear for me, I got everything working now the way I wanted!
The guides available by openhab are a bit clumsy or overwhelming sometimes.
Thank you very much!