Need some Openhab settings for a magnetic contact

I thought you had used “frontdoor-close.png” as a filename, whereas it needed to be “frontdoor-closed.png” to work. That was the missing “d” I wanted to point you at, but you misunderstood and thought I was referring to another typo. Note the filename part behind “-” MUST literally match the name of the state.
Second misunderstanding, I was actually referring to an icon really showing a frontdoor icon, not just the generic ‘contact’ icon used to represent the status of a frontdoor. (which is what you did, I believe).

Oh dear, lots of misunderstandings today … but I see my line was incomplete, that’s why.
(well in fact it was not incomplete, but I would have needed to put it in quotes for the important part to show up - my mistake, sorry). I just corrected my previous post. Try that again, i.e. add <frontdoor>. That will make the GUI use frontdoor-closed.png and frontdoor-open.png icons (and frontdoor.png in case the item is uninitialized). And remember: no … item=frontdoor … in sitemaps file. That would override the definition in items file.
If you want to define the icon file to use in sitemaps, you would need to add icon=frontdoor to your frontdoor line in sitemap instead.

Markus, is there something weird happening today, i begin to think that my English is not enough to make my self clear understood.
Firstly, i dont want a frontdoor icon in this group! i want a simple contact icon which looks like an active open or closed window, like windows 7 :smile: and therefore i was talking about the contact icons i have in my img folder.
My OH config is like the following:
I have a group called:

Group Contacts

than the items:

Contact	Node01Door	"Usa acces [%s]"	<frontdoor>	(All, Contacts)		{ mqtt="<[mymosquitto:home/door:state:MAP(door.map)]" }
Contact	Node01Geam1	"Fereastra dormitor 1 [%s]"	<contact>	(Contacts)		{ mqtt="<[mymosquitto:home/door1:state:MAP(door.map)]" }
Contact	Node01Geam2	"Fereastra dormitor 2 [%s]"	<contact>	(Contacts)		{ mqtt="<[mymosquitto:home/door2:state:MAP(door.map)]" }

and you say to add another item like this:

Group:Contact:OR(OPEN, CLOSED)Contacts "Status ferestre [%d]" <present> (Contacts)

The sitemap uses frame as @Rich shows above.

What should i do? Right now i’m very confused and i don’t know what to do or where to do?
Do i still need this item in the item file:

Number  ContactsCount "Status ferestre [%s]" <contact>

How the sitemap should look with my items?

Thanks for the patience.

Oh dear. To be honest, it’s pretty difficult to understand what you don’t understand.

First, select the ICON you want to have
If it is the “Contact” icon, you need files contact-open.png and contact-closed.png, put them in /usr/share/openhab/webapps/images/.
For my example, it was a different icon, showing presence status, called present, and the icon files were named present-open.png and present-closed.png.
There are also icons available showing a frontdoor, called frontdoor-open.png and frontdoor-closed.png

Ok, let’s assume you want the “Contact” icon.

Now you can EITHER put <contact> in items file line of your frontdoor, or add icon=contact in sitemaps file line for your frontdoor, or both.You could even omit it because for a Contact item, openHAB will use Contact icon as the default.

Or you could put <frontdoor> in items file or icon=frontdoor in sitemaps file or both. Then you have to check that frontdoor-open.png and frontdoor-closed.png files do exist in images folder.
Now so far, all of this just controls the icon and has NOTHING to do with the contacts counter that you want to see in the same GUI line on the right hand side.
BUT as what you want is to show an “OPEN” icon if ANY of your contacts is open, and “CLOSED” icon if none is open, you need the item definition to be Group:Contact:OR(OPEN, CLOSED), so your complete line must read

Group:Contact:OR(OPEN, CLOSED)Contacts "Contacts [%d]" <contact> (some_superior_group)

But “some_superior_group” may not be “Contact” as you posted, because the Group item called “Contact” (which is what you define by this line) cannot belong to itself. Understood ?
Insert All or omit it (and the brackets).

And NO line in sitemaps. You CAN add a line there, but then take care that it overrides the fields in items file.

Now i begin to understand but still no change in the project.
If i don’t add any line in the sitemaps how to display than the group i want to be displayed?
I tried also your suggestion “And NO line in sitemaps” and the group disappeared from the map!
All the needed icons (contacts, door, frontdoor, switch, etc) are already in the OH image folder.
I really dont know what to do … the only way it works is to use frames and another number item as Rich said case in which i cannot use the contact icon, at this moment this is the only way it works! :frowning:

A simple line like

Text item=Contacts

should do in sitemaps to make it appear.

OR you re-define the values:

Text item=Contacts icon="contact" label="closed contacts [%d]"

(note: I had forgotten that label in my previous post. I’ve edited that post to include it.
It’s required to show the number of CLOSED contacts).

For your explanation, why I said “NO line in sitemaps”: you can either explicitly place items/groups in the GUI
using lines in sitemaps, that’s what we did here. But you have to take care that parameters you put in sitemaps don’t override parameters from items file, that’s why I wanted you to have no line there.
But you can also implicitly make your group appear by explicitly referring (in sitemaps) to the group that your group belongs to.
See my example above: I defined the group Contacts to be a member of the group “some_superior_group”. You could have a sitemaps line

Text item=some_superior_group label="Superior group for Contacts, sensors, doors, whatever [%d members]"

That superior group would appear in the GUI. If you then click on that, it’ll jump to a new page to show all the members of some_superior_group, which would be at least your Contacts group (plus more, if you defined more items/groups to also be members of some_superior_group)

Are you using Designer? Does Designer show any errors? If so correct those errors. If you are not using Designer, you should.

I don’t have your full Items files, your full rules files, nor your full Sitemap so I’m very limited how I can help. Consequently I (and others on this forum) provide notional examples. It is up to you to understand these examples and customize them to work for your situation. Make sure that the Items and Groups names match those you are actually using and there isn’t a typo or syntax error. I don’t have your environment so I can’t always fully test the code that gets posted. You can’t just copy examples from these forums and elsewhere and expect them to work without understanding how to customize it and potentially correct it.

For example, in my second attempt I tried to rename the Items and Groups to match what you provided, but I didn’t rewrite the Rule accordingly because there is no functional change. When you tried to apply the second example did you update the Rule? There was no functional change in the rule so I didn’t supply it the second time but the Items changed names between these two examples as I tried to adjust to your actual Item names.

I know I’ve been harping on this, and I appreciate how difficult it is, but without even this basic understanding of how all these pieces in openHAB work together, achieving your increasingly advanced goals, understanding how to fix things when they go wrong, and asking for help will continue to be greatly hindered.

Rich if you do this every day, maybe this seems easy to understand but in my case as in the majority case (I think) on this forum it’s not so easy! We are on the beginners section.
Believe me that I’m not taking everything like it is, I’m traying to understand each part of the cod, I’m modifying some parts of it depending on my labels, or item names but be sure that I’ll not be able to make some kinda of rules so soon! I didn’t think that on your 2nd eg the rule should be changed and even if you’d say so I would not be able to change it by my self.
On wiky there is no example given like this and you see, if I can’t make it work well talking with 2 guys who know what is all about, how can I make it work reading only on git?
As a conclusion I still didn’t understand how to modify the rule or what need to be added in the sitemap :frowning:
I’ll try to add a simple text item as Markus said …

Instead of providing more code and examples I’m going to explain things in English.

Requirements:

  • Have a group of contacts
  • On the sitemap have a single entry that has a Contact icon
  • The Contact icon changes to OPEN if one or more Contacts in the group is open
  • To the right of this item is the count of all open Contacts
  • Clicking on the item opens a new tab with a list of all Contacts in the group, showing their state

Comments on Requirements
This is not an easy or straight forward thing to do in openHAB, relatively speaking. It is not designed for this use case.

A Group can only be used as a shortcut to opening a new frame when clicked on in the Sitemap. It can also act like a Switch for all the items in the Group. There is no way to put additional information on the same line as a Group on the Sitemap.

There is no way to directly get at the count of Items that are of a certain state in a Group in the Items file or in the Sitemap. You have to store the count in a separate Item that gets updated with a rule.

As @mstormi described, the icon that is displayed on the Sitemap depends on the literal state of the item. There is no easy way to change the icon for an item that has a number as its state. (You CAN create a separate icon file for each numerical value the item can be but do you really want 100 icon files to support a value from 0-99?). Therefore you need to cheat to have an icon that changes for an Item that stores a number.

Even with the tricks described below, it is not likely to work like you want because the sitemap does not always refresh frequently enough to immediately show the changes as they happen requiring you to reload the page or going into a frame and back again on the Sitemap.

What you need to do

Groups and Items:

  1. Create a Group that all the Contacts are members of. It doesn’t matter what you use for the label or icon here because we will not be using this Group on the sitemap. You may need to experiment here to make sure that the Group gets populated with the Contact state. You may need to define is as Group:Contact:OR(CLOSED,OPEN)
  2. Create your Contact items using as the icon for each and the appropriate label.
  3. Create a Number Item that will store the count of open Contacts in the Contact Group

Rule
4. Create a rule that triggers when ever the Contacts group receives an update. In this rule calculate the number of Contacts that are members of the group that are open and post it to the Number Item from step 3.

Sitemap
5. Add two copies of the Number Item from step 3 to the sitemap. Set one to visible when the Group defined in step 1 is OPEN and the other visibile when the Group in step 2 is not OPEN. For the OPEN one, set the icon to contact-open and for the other set the icon to contact-closed.
6. Create a frame under each of the two lines created in step 5 and add a line for each of the Contact items in the group.

I never said it was easy. I know it is hard. I’ve been in your place. But you are trying to do some really advanced stuff and do things on the Sitemap that it was not designed to do without understanding the basics. Its like you turned to the middle of a calculus text book but haven’t learned algebra yet and are asking us to help with your homework. Sure, you could probably figure out enough to apply some of the formulas to examples in the book, but you won’t be able to solve new problems or understand when/if you get the wrong answer or be able to generalize any advice you get from people like me who try to help.

Exactly, but you are asking for help with very advanced stuff. Building your own Arduino sensors, having a sitemap with Group counts and dynamic icons for Items that are not Switches or Contacts are all advanced. Most people start with one or two switches and grow from there. I myself haven’t even built anything with Arduino yet (my parts did just come in the mail though) and I’ve never attempted half of the things you are trying to do and I’ve been at this for almost a year. But I spent the time to learn the basics and paced myself and avoided tying to be too ambitious until I understood how to do the simple stuff.

That is what is frustrating, you are jumping to the hard stuff without being able to do the easy stuff.

Don’t misunderstand me. I completely understand the amount of work you have put into this and I know you are learning this stuff and learning it really fast. But your ambition far outstrips your current skills which makes it really really difficult to provide useful help to you in these forums. It also feels like I’m doing your homework for you. I really do believe you understand openHAB better than comes across in your postings and what you have accomplished thus far is impressive. But openHAB is a complex system built by programmers for programmers. It is not intended yet for a general audience (OH 2 is making huge advances in that area though) so in order to continue to grow and improve your home automation with openHAB you have to either come to it with strong technical skills or be willing to spend the time to learn them.

I honestly have no idea if it really needed to be changed or not. I type half of these posts from my phone and it is hard to go back and always check. In this case the rule probably doesn’t need to change. But there are some basic things that I would expect you to know at this point in your openHAB knowledge development

You should be able to look at a rule and see things like a typo in an Item name or know how to change the example Item and Group names from the example to your own.

I would expect you to know about Designer and to use it to syntax check your rules and Items files, particularly those copied from the web somewhere.

I don’t expect you to be able to code a new rule but I do expect you to understand that the names need to match between references in the rules and the items.

I expect you to know or know where to learn the difference between a Switch, a Contact, a DateTime, a Number, and a String Item and when it is appropriate to use them. Likewise, I would expect you to know the difference between a Switch, a Text, and a Group on the sitemap and when it is appropriate to use them.

I also expect you to understand that the icon of an item on the Sitemap will change based on the state of the Item, and that the change is based on the icon’s state. I expect you to know that only Switches and Contacts are supported out of the box for this type of dynamic icon.

I would expect you to look at the logs and understand at least a little bit of what you see there, in particular recognize errors (even if you don’t understand what the error means) and identify what generated the error (e.g. a binding, a rule, loading a config file, etc).

I would expect you to know how to add logging statements to a rule to show that you make it to a certain point in a rule in the logs or know what state something is in, or even see whether the rule is executing when it should even if you don’t understand the rule itself yet.

I would expect you to know the difference between the various rule triggers (e.g. difference between “received update” and “changed”).

I would expect you to know that if you are trying to create an MQTT item to look at the MQTT Binding wiki page first for help.

You assume we “know what it is all about.” I’ve never actually done most of the things you are asking to do. I do have enough experience to figure it out and make suggestions but we can only take you so far. We need you to be able to run experiments with these examples when they don’t work and when you come back for more help tell us what you tried and details about what you are seeing.

If you had more experience and knowledge with how the Sitemap works and the other stuff that I listed above, experienced earned through trial and error with easier stuff, you should be able to figure these things out yourself rather than blindly applying examples. At the very least you would be able to experiment with an example to figure out why it might not be working on your own.

I’m a professional programmer and I don’t think even I could have figured out to do what you are trying to do until I had experimented with openHAB for at least a few months and performed hundreds of little experiments. I never even figured out what the persistence bindings did and how to use them until I had my system up for several months. I certainly didn’t start with something so ambitious as my first project. I started with two z-wave power outlets and some weather stuff and experimented with that for months before moving on to harder stuff. Then I gradually added in other things (Nest, door sensors reporting over MQTT, various presence detection approaches, etc). But because I had all that experience I was able to figure out the harder stuff myself through the examples and the wiki. You are starting with a setup that is more advanced and complex in some ways than even my current configuration.

For this advanced type stuff you are almost never going to find a single example that does exactly what you want it to do. You will have to pull part of an example from here and another part from over there and merge together parts of up to several examples and probably add in some more stuff you figured out yourself that you learned just from reading the wiki.

Hi man, i appreciate that every time you come with such detailed answers related to my questions and i would like to thank you for this. I know it takes time to write all the explanation you give me and this makes difference between one simple answer which doesn’t say so much and another answer which can make you understand even a few things but you can understand something.

I see that you understood exactly what i want to do, these are my requirements.
I think that if you would attach some example based on my information posted above (items) for each step you pointed me in the section:

this answer would be the best tutorial ever. Everyone knows that the best way of learning is based on experience (examples) and practice, practice and again practice and believe me this is what i do. I really cant remember how many times i rebooted my RPi.

I have already that group in my items.default file called:

Group Contacts

here i think something is tricky! and i’m afraid i didn’t understand exactly if this group is the same group on the top of the items file or its a new different group under all my three contact items, defined as:

Group:Contact:OR(OPEN, CLOSED) Contacts "whatever text [%d]" <contact>

unfortunately i cant understand this sentence:

  • Group: this means it defines a new group?
  • Contact the type of the group?
  • OR(OPEN, CLOSED) i suppose this means open or closed
  • Contacts is the name of this group or is related to my existing group called Contacts?
  • "whatever text … this is the name of the definition the group?)
  • [%d]" ???
  • “contact” this is for sure the contact icon

I have them like above, i’ll post them again here:

Contact	Node01Door	"whatever text [%s]"	<frontdoor>	(All, Contacts)
Contact	Node01Geam1	"whatever text [%s]"	<contact>	(Contacts)
Contact	Node01Geam2	"whatever text [%s]"	<contact>	(Contacts)

I have it done by you, this one here:

Number  ContactsCount "Contacts [%s]" <contact>

here except the “[%s]” i now what it means: a number item, called ContactCounts which has the label Contacts and has an icon type contact.
I understood that i need this new item to take in account the rule which store the count of open contacts in the new group defined at point no. 1? and which brings us to the 4th point:

The only rule i can use is the one you gave me:

rule "Update ContactsCount"
when
Item Contacts received update
then
val numOpened = Contacts.members.filter(contact | contact.state == OPEN).size
ContactsCount.postUpdate(numOpened)
end

so here in a few words i understood that whatever item that is in the group contacts receive an update to OPEN it post the count on the open contacts … but honestly i don’t know what means each word from this sentence if you take it separately …

Here i have again your example:

Text item=ContactsCount icon="contact-open" visibility=[Contacts.state=="ON"]{
}

and the second one:

Text item=ContactsCount icon="contact-closed" visibility=[Contacts.state=!"ON"]{
}

The both items refers to the ContactsCount item from the item file, have open and closed contact icons and the visibility which is new to me but as i understood refers to the rule and have the operators == and =!.
I really don’t know what these operators do but as far as i could see on wiki the second one should look like this != no =! as you made it!
eg. here:

visibility=[Weather_Chart_Period!=ON]

First text item:

Frame {
Text item=Node01Door
Text item=Node01Geam1
Text item=Node01Geam2
}

and the second item:

Frame {
Text item=Node01Door
Text item=Node01Geam1
Text item=Node01Geam2
}

These are the steps i did before your comment and the only thing that appears on the sitemap is the number item ContactCounts which count the open contacts but it doesn’t take in account this new group or it doesnt use the open or close contact icons described in the two text items that use visibility:

Group:Contact:OR(OPEN, CLOSED) Contacts "whatever text [%d]"

My examples from above are the examples. I’ve really just described in English what the code of my examples do.

Yes, you are telling openHAB that the thing defined on this line is of type Group

One of the cool things that a group can do is act like a Switch or a Contact on your sitemap and in your rules. Thus you can set a Group item configured to be a Switch to ON and all of the items in the group will turn on, for example. In this case we want the Group to act like a Contact. I don’t know for sure if this is required. It is just a guess because I don’t have enough information to understand why the example doesn’t do anything. One possibility is that the rule isn’t firing so configuring the Group as a Contact is an attempt to address that maybe/maybe not problem.

I admit I don’t know for sure exactly how this works. Per the wiki, Groups are allowed to have a summary clause which sets the state to some combination of the states of the members of the Group. Here we are telling openHAB to make the Group’s state the result of an OR so that if any member of the Group is OPEN, the Group’s state gets set to OPEN. By swapping the OPEN and CLOSED in the OR clause you can change it so it is CLOSED if any member of the Group is CLOSED.

This is something I learned through experimentation and once I get some time I hope to study the code and update the wiki. I don’t think this is documented very clearly in the wiki right now.

This is the name of the Group. My steps assume you don’t have anything you need to make your requirements happen. So this line would replace your existing Contacts Group definition line.

This is the label for the Group. If you put the Group on your Sitemap and don’t define a label there this is what will be used.

So on the Sitemap the label has a left hand part and a right hand part. The part of the label inside “” gets put on the right hand side. The “%d” is a typo and should be “%s” and this basically means put the Item or Group’s state here. There are all sorts of things you can do to format numbers and date times but I don’t have a good place to point you to. For the most part you have to look for examples to format the stuff as you want it.

So in this case on your sitemap the Group will show up as

whatever text                                   OPEN

If you wanted to you could change it some, maybe add the word is to appear on the right:

"whatever text [is %s]"

will become

whatever text                           is OPEN

Maps can be useful here if you don’t want the state as it is stored but instead want to use a different language or make it lower case.

Correct

See my explanation above for the “[%s]”. Your understanding is correct.

Lets break it down:

rule "Update ContactsCount"

This is how you start a rule. The text in quotes is the name of the rule. If there is an error the logs will say “Error executing Rule Update ContactsCount” making it easier to find where problems might be.

when
    Item Contacts received update
then

Rules are event based. They get triggered when something happens. See the Rules wiki page for all the different triggers. In this case we are saying to trigger the rule any time the Contacts Item receives an update. An important distinction here is that this rule triggers even if the update doesn’t change the state of the Item. In this particular case the Item is actually a Group and since Groups get updated every time there is an update to any of its members the rule will get triggered for any updated to any of the Items in the group.

NOTE: there is a weirdness in how openHAB processes Group updates so be aware that the rule may be triggered multiple times for a single update to an Item. In this case that doesn’t matter.

val numOpened = Contacts.members.filter(contact | contact.state == OPEN).size

This line is declaring and populating a variable to hold the number of members of Contacts that are OPEN.

“val” means that this is a variable that will not change once we assign it. If you need to assign a value to it again later on you would use “var” instead.

“numOpened” is the name of the variable. Sometimes you will see some words between the val or var and the variable name that defines its type. In this case we don’t need to do that.

“=” this means that what ever the code on the right evaluates to gets assigned to numOpened.

“Contacts.members.filter” gets all the members of the Contacts Group and filters them. This means that at the end we will have shorter list of just the items that match a certain criteria.

“filter(contact | contact.state == OPEN)” this is the filter method. It is saying I only want those items whose state is OPEN.

“.size” gives me the number of items that the filter returned.

ContactsCount.postUpdate(numOpened)

This line sends numOpened to ContactsCount.

end

This denotes the end of the rule.

Actually the visibility has nothing to do with the rule. This is a sitemap only thing and it is a way to set whether something appears on the sitemap or not based on some criteria. In this case the first one only appears when Contacts.state is set to ON. You are correct, the “=!” should be “!=” and that means “not equal” so that line will only appear when Contacts.state is anything except ON. That was a typo, one that I think Designer should have caught.

The full set of operators are:

  • == equals
  • != not equal
  • < less than
  • greater than

  • <= less than or equal
  • = greater than or equal

This is vital information. If you see the counts then the Group and rule is working. When you originally said “nothing happens” there was an infinite number of things that could have gone wrong. This narrows it down significantly. I assume that the count in ContactCounts is correct?

The new group does not appear on the Sitemap in this example. It is only there to help populate ContactCounts and it is not intended to be added to your sitemap so you will not see it.

Because you can’t put the count on the same line as a Group we have to fake the behavior of a group on the Sitemap using Frames. Because you can’t have an icon that changes (easily) on a Number item we have to fake that behavior using visibility.

I’m still not sure what you are seeing. Maybe if you posted a screen shot.

Here is another attempt to type it in. As I retype it I do see some typos:

Text item=ContactsCount icon="contact-open" visibility=[Contacts.state=="OPEN"] {
    Frame{
        Text item=Node01Door
        Text item=Node01Geam1
        Text item=Node01Geam2
    }
}
Text item=ContactsCount icon="contact-closed" visibility=[Contacts.state!="OPEN"] {
    Frame{
        Text item=Node01Door
        Text item=Node01Geam1
        Text item=Node01Geam2
    }
}

Notice the change in the visibility clause.

I told you somewhere above that the frame method its working together with the rules and the number item BUT without the active contact icon. Using this method i can see only the grey icon but is working well, is counting the contacts!
This method is based on these items:

Contact	Node01Door	"whatever text [%s]"	<frontdoor>	(All, Contacts)
Contact	Node01Geam1	"whatever text [%s]"	<contact>	(Contacts)
Contact	Node01Geam2	"whatever text [%s]"	<contact>	(Contacts)
Number  ContactsCount "Contacts [%s]" <contact>

and this sitemap:

Text item=ContactsCount icon="contact-ajar"{
Frame {
Text item=Node01Door
Text item=Node01Geam1
Text item=Node01Geam2
}
}

and also the only rule you posted.
It looks like this:


and to see its working the next tab where only one contact is open!

BUT as you see in the site map i changed the simple contact icon with the contact-ajar. Its not doing anything, i use it 'couse is more interesting that the grey one…

The second try is with the new group or(open, closed) like this:
items:

Group Contacts
Contact	Node01Door	"whatever text [%s]"	<frontdoor>	(All, Contacts)
Contact	Node01Geam1	"whatever text [%s]"	<contact>	(Contacts)
Contact	Node01Geam2	"whatever text [%s]"	<contact>	(Contacts)
Number  ContactsCount "Contacts [%s]" <contact>
Group:Contact:OR(OPEN, CLOSED)Contacts "Status ferestre [%d]" <contact>

The sitemap is the last one you posted today and the same rule used for the first method.
The result is below:


As you can see the Status CONTACTE (with the contact-ajar) disappeared and no counting at all.

OK I now see. It wasn’t clear what icon was not working and where.

Your second example is completely broken. When you added the last line in your Items (“Group:Contact…”) you now have two “Contacts” Groups. You can’t do that. Each Group must have a unique name. If you did this in Designer it would have underlined both Group lines in red and tell you you can’t do this.

You probably also have errors in your logs complaining about the duplicate Group name. Throw this example out.

In your first example, everything works except for the icon changing. This is because ContactsCount is a number instead of OPEN and CLOSED. This is why we have to fake this behavior using visibility.

Now it might be possible that checking the Contacts Group’s state isn’t working in the visibility condition for the previous examples so lets see if this works:

Text item=ContactsCount icon=“contact-open” visibility=[ContactsCount>0] {
Frame {
Text item=Node01Door
Text item=Node01Geam1
Text item=Node01Geam2
}
}
Text item=ContactsCount icon=“contact-closed” visibility=[ContactsCount==0] {
Frame {
Text item=Node01Door
Text item=Node01Geam1
Text item=Node01Geam2
}
}

Now this is a very important. You will not see the icon change on your phone immediately. You will have to reload the sitemap, reload the app, or go into a new tab and come back to see the icon change. Its a problem I and others have noticed. There is no solution to this limitation. It works pretty well on the web page though.

No, it simply doesn’t want to work. If i delete the

Group:Contact:OR(OPEN, CLOSED)Contacts "Status ferestre [%d]" <contact>

in the items file and on the sitemap i use only the example you posted last time (this one with the visibility modified) the tab don’t appear in the sitemap so no icon, no label, no count, nothing!
You said my second eg is completely broken, what should i do? delete it? delete the Group contacts on the top of the item files, modify it (how?)? move it on the sitemap?
I have OH designer but i’m not using it because i dont know how to get into RPI files. I’m using Mobaxterm and i open OH files with notepad++ so when saving i’m saving directly on my RPI and so i can refresh the webpage.

Delete

Group:Contact:OR(OPEN, CLOSED)Contacts "Status ferestre [%d]" &lt;contact&gt;

from your Items file. You cannot have two groups with the same name.

We are not putting Contacts on your Sitemap so you don’t need any of that extra stuff on that line either.

One More Time. I do not know how to be any more clear.

Items:

Group Contacts
Contact	Node01Door	"whatever text [%s]"	<frontdoor>	(All, Contacts)
Contact	Node01Geam1	"whatever text [%s]"	<contact>	(Contacts)
Contact	Node01Geam2	"whatever text [%s]"	<contact>	(Contacts)
Number  ContactsCount "Contacts [%s]" <contact>

Rules:

Leave unchanged.

Sitemap:

Text item=ContactsCount icon="contact-open" visibility=[ContactsCount>0] {
    Frame {
        Text item=Node01Door
        Text item=Node01Geam1
        Text item=Node01Geam2
    }
}
Text item=ContactsCount icon="contact-closed" visibility=[ContactsCount==0] {
    Frame {
        Text item=Node01Door
        Text item=Node01Geam1
        Text item=Node01Geam2
    }
}

The Contacts Group should NOT be on your sitemap. You should have only ONE Group with the name Contacts.

Man this is exactly what i did and not only once, ten times, with reboot, without reboot, NOTHING, this fake group (with two frames) whatever you want to call it, there’s no way to make it appear in the sitemap! Please see picture 3279 above, is the same … this is not going to work …

I don’t know what you are doing differently. I’ve implemented this exactly like this but with my items and it works.

Maybe it’s because my OH version, I have 1.7.0 …
I will try to make this for some switch items to see if it’s working based on the same principle, maybe I’ll have luck with them but believe this is what I’ve done the last three or four days, trying and trying and nothing. At least the first method it’s working even if the icon it’s not changing its state.
Anyhow it’s becoming really frustrating to hear that the same config works for you and doesn’t for me! How is this possible? …
However thanks for all the time spent here for me and for the help you gave me.

I’m on 1.7.1 but this should work with 1.7 too.

It is really odd.

Just for completeness here is my configuration without changing anything. Maybe one of us is making a typo above that is causing your problems and seeing this will make it clear.

I’ve confirmed this works (see screen shots below). However, I want to reiterate that on your phone, the icon will not change automatically like it does on the web.

To orient you, I have five doors with sensors, three entry doors and two garage doors. I also do lots of stuff with groups so you will see lots of groups on my items that are not relevant to this capability so I didn’t include them below. My en.map file will map “OPEN” to “open” and “CLOSED” to “closed”.

Items:

Group gEntryCounts
Number N_D_NumOpen
Contact N_D_Front "Front Door [MAP(en.map):%s]" <frontdoor> (gDoorSensors, gAlarmSensors, gEntryCounts) { mqtt="<[mosquitto:entry_sensors/main/front_door:state:Default]" }
Contact N_D_Back "Back Door [MAP(en.map):%s]" <frontdoor> (gDoorSensors, gAlarmSensors, gEntryCounts) { mqtt="<[mosquitto:entry_sensors/main/back_door:state:Default]" }
Contact N_D_Garage "Garage Door [MAP(en.map):%s]" <door> (gDoorSensors, gAlarmSensors, gEntryCounts) { mqtt="<[mosquitto:entry_sensors/main/garage_door:state:Default]" }
Contact N_D_GarageDoor1 "Garage Door 1 [MAP(en.map):%s]" <garagedoor> (gDoorSensors, gRemindDoorSensors, gGarageSensors, gEntryCounts) { mqtt="<[mosquitto:entry_sensors/main/garage/door1:state:Default]" }
Contact N_D_GarageDoor2 "Garage Door 2 [MAP(en.map):%s]" <garagedoor> (gDoorSensors, gRemindDoorSensors, gGarageSensors, gEntryCounts) { mqtt="<[mosquitto:entry_sensors/main/garage/door2:state:Default]" }

Rule:

rule "Update number of open doors count"
when
    Item gEntryCounts received update
then
    val numOpen = gEntryCounts.members.filter(door | door.state == OPEN).size
    N_D_NumOpen.postUpdate(numOpen)
end

Sitemap:

Text item=N_D_NumOpen label="Open Doors Count [%s]" icon="door-open" visibility=[N_D_NumOpen>0] {
    Frame {
        Text item=N_D_Front
        Text item=N_D_Back
        Text item=N_D_Garage
        Text item=N_D_GarageDoor1
        Text item=N_D_GarageDoor2
    }
}
Text item=N_D_NumOpen label="Open Doors Count [%s]" icon="door-closed" visibility=[N_D_NumOpen==0] {
    Frame {
        Text item=N_D_Front
        Text item=N_D_Back
        Text item=N_D_Garage
        Text item=N_D_GarageDoor1
        Text item=N_D_GarageDoor2
    }
}

Screenshots:
Count with all doors closed

Frame that opens when clicking on “Open Doors Count”

Count with two doors opened

Frame that opens when clicking on “Open Doors Count”

I really don’t know whats going on here. I deleted my OH 1.7.0 from my PC and downloaded the 1.7.1 version. I used your example and the same result … below is the print screen … nothing appear on the web.

I think is has to be something small we are missing, is there any special addon that needs to be in the addons folder? it has to be connected through Mqtt to my Arduino board or if you just start up the server on the PC and accessing the localhost it has to display the Number N_D_NumOpen frame?
Maybe in the sitemap you have another group or maybe in the items file there is some special setting …
I see that the items you posted belong to more than main group called gEntryCounts, maybe you have some other special functions declared in one of the other groups.
Right now i know for sure that this is not happening because of the OH version. However i’ll remove this version i have from my RPI and i’ll download the latest one and i’ll try to test it with everything connected (contacts, sensors) to see what’s happening, maybe will work, if not i really dont know what else to do, maybe to go to the church and pray to Good to make it work because i cant :pray: