Graphing in sitemap

You just need to add Group_Temperature_LivingRoom to your persistence line in addition to Group_Chart*. I know of no other workaround right now but can confirm that doing so will persist the value of Group_Temperature_LivingRoom.

1 Like

@rlkoshak Where on Github should I report this issue and who to contact to get the documentation updated on this issue?

Also I do not quite understand this:
Chart item=Heating_LivingRoom_Setpoint period=W refresh=30000 visibility=[chart_period==1]

Why can we use chart_period and not chart_period.state? and is it legal to combine two items in the statement?

Chart item=Heating_LivingRoom_Setpoint period=D refresh=30000 visibility=[chart_period+chart_selection==11]
Chart item=Heating_LivingRoom_Setpoint period=W refresh=30000 visibility=[chart_period+chart_selection==12]
Chart item=Heating_LivingRoom_Setpoint period=M refresh=30000 visibility=[chart_period+chart_selection==13]
Chart item=Heating_LivingRoom_Setpoint period=Y refresh=30000 visibility=[chart_period+chart_selection==14]
Chart item=Heating_BedRoom_Setpoint period=D refresh=30000 visibility=[chart_period+chart_selection==21]
Chart item=Heating_BedRoom_Setpoint period=W refresh=30000 visibility=[chart_period+chart_selection==22]
Chart item=Heating_BedRoom_Setpoint period=M refresh=30000 visibility=[chart_period+chart_selection==23]
Chart item=Heating_BedRoom_Setpoint period=Y refresh=30000 visibility=[chart_period+chart_selection==24]

For the last part (using the sum of variables for visibility) I’m using a separate proxy-variable which gets set to the sum of variables by a rule, which gets triggered by any change of those variables.

visibility=[chart_period+chart_selection==11]

This is not allowed. Please keep in mind, that we are talking of states, not numbers, so how to “add” ON and CLOSED? If the Items are of type number, the visibility takes a look at the state anyway.

However, there is absolutely not reason to summarize some states. Just use a Boolean and:
visibility=[chart_period==1 && chart_selection==10]

The reason, why there is no .state is, this is the sitemap. You can’t refer to details of an item other than it’s state in a sitemap. (Well, that’s not correct… but correct in matters of condition)

The openhab-docs repo is where you can file an issue.

Because in the sitemap you do not reference the .state, one the Item. The docs state the syntax for visibility is

visibility=[item_name operator value, item_name operator value, ... ]

So it does say that you only use the Item name, not Item.state.

Also, based on the line above and one of the examples

visibility=[Day_Time=="Morning", Day_Time=="Afternoon", Temperature>19]

So yes, you can use more than one Item to control the visibility. However, they are treated as OR meaning if any one of the comparisons are ture then the element will be visible.

In the third example above, a control for a lawn sprinkler will be visible if it is Morning, OR if it is Afternoon, OR if the temperature is above 19 °C. Combining multiple conditions, for example Morning AND above 19 °C is not supported. To control visibility based upon combining multiple Items, or on more complex conditions, consider defining and using an additional Item that is set by a Rule.

However, you cannot do math in the visibility clause. You can only perform boolean operations.

Is that supported now? The docs imply that isn’t allowed but there have been a lot of changes and I’m not sure the docs have kept up.

Ouch! You’re right, sorry… messed that up (The wish was father to the thought…)

1 Like

Ok, so I will create a new rule:

rule "Update graph"
when
    Item chart_period changed or chart_selection changed
then
   chart_visible.sendCommand(chart_period.state + chart_selection.state) 
end

And the sitemap:

Chart item=Heating_LivingRoom_Setpoint period=D refresh=30000 visibility=[chart_visible==11]
Chart item=Heating_LivingRoom_Setpoint period=W refresh=30000 visibility=[chart_visible==12]
Chart item=Heating_LivingRoom_Setpoint period=M refresh=30000 visibility=[chart_visible==13]
Chart item=Heating_LivingRoom_Setpoint period=Y refresh=30000 visibility=[chart_visible==14]
Chart item=Heating_BedRoom_Setpoint period=D refresh=30000 visibility=[chart_visible==21]
Chart item=Heating_BedRoom_Setpoint period=W refresh=30000 visibility=[chart_visible==22]
Chart item=Heating_BedRoom_Setpoint period=M refresh=30000 visibility=[chart_visible==23]
Chart item=Heating_BedRoom_Setpoint period=Y refresh=30000 visibility=[chart_visible==24]

Yes, this version is better, though not correct, as it’s not possible to sumarize states :wink:
Please try

chart_visible.sendCommand((chart_period.state as Number) + (chart_selection.state as Number)) 

instead.