OH2: status of multiple items in one item

Tags: #<Tag:0x00007f173866b600> #<Tag:0x00007f173866b538> #<Tag:0x00007f173866b448>

Hi,

looking to create one virtual item which summarize the status of multiple network items.

What I have done:

Switch Network_WAN_Online “Network Online Status” { channel=“network:pingdevice:Network_WAN:online” }
Switch Network_Router_Online “Network Router Online Status” { channel=“network:pingdevice:Network_Router:online” }
Switch Network_RepeaterUG_Online “Network Repeater UG Online Status” { channel=“network:pingdevice:Network_RepeaterUG:online” }
Switch Network_RepeaterEG_Online “Network Repeater EG Online Status” { channel=“network:pingdevice:Network_RepeaterEG:online” }

Now, I am looking for an items, which shows me at one, if all pingdevice are available.

If possible I would like to use something with groups to avoid many hardcoded things.

I don’t have no clue how to solve.

Kind regards in advance
André

Look at the documentation for Group Items I think the Group status has options to do what you wish.

1 Like

Ok. Thanks.

How to access the value of this function?

Switch Network_Online “Network Online Status” { channel=“Group:Switch:EQUALS(“ON”) gNetworkStatus” }

does not work as an virtual items (looks like it does not work).

Thanks!

Whilst creative, it doesn’t work that way!

Add a new Group Item into your Items file like this

Group:Switch:OR(ON,OFF) gNetworkSwitch

Then put your original Items back, but add the group reference to each:

Switch Network_WAN_Online "Network Online Status" (gNetworkSwitch) { channel="network:pingdevice:Network_WAN:online" }

You can then use gNetworkSwitch as if it’s a normal Switch Item!

1 Like

That was my point. This forum is not a substitute to Reading The Fine Manual (documentation).

To be fair to the OP it looks like they did read the documentation, but just misinterpreted it. Easily done, I think: openHAB is complicated, the documentation is therefore complicated, and if English isn’t your first language there’s added complication.

If I know the answer to the question I prefer just to give working examples, with a pointer to the documentation for further reading. That way they can get the satisfaction of something working, and if they’re so inclined they can read on to understand and extend it.

3 Likes

Thank you both!

I miss, that I can just use Group:Switch:AND(ON,OFF) gNetworkStatus as an switch item and don’t need to create an separate item.

With an “AND” works - as required.

Ah, yes, of course! I adapted a light switch example, hence the OR, but yes, you want AND!

1 Like

it works well, accept I have an items which turns off…

The groups stays in status “off” also when the respective items comes back to “on”.

Does anybody have an idea? Do I need something special on this group?

Thanks in advance!

Rgds
André

Is this a different Group and Items? Can you share their configuration?

Are you sure, or is that your UI does not update?
Your events.log should tell you what happens to the Group when your Items change.
Some browser/app/UI combinations are not so good at spotting Group state changes.

Hi @rossko57,

sorry for not answering long time.

I did some tests:

  • It is not the UI
  • while creating some scenarios and controlling via event.log it looks like, that the status goes “off”, if something went offline (which is fine), but when the device comes back online - the status of the group does not change back to “on”. If the status of the group stays off, whatever happens with the devices

may be, i need to change something on the item definition of the group?

Group:Switch:AND(ON,OFF) gNetworkStatus

Any ideas?

Thanks in advance.

Rgds
André

When this happens, is there another device in your Group which is OFF? Your Group will ONLY be ON if ALL your devices are ON, but will be OFF if ANY of your devices are OFF.

1 Like

Maybe we could see what it looks like, too?

I know.

I just tried. I put put one device manually on/off (by changing IP adress).

Rgds

other idea. what means the retry within

“Thing network:pingdevice:Network_Router “Network Router” @ “Netzwerk” [ hostname=“192.168.1.1”, retry=3, timeout=5000, refreshInterval=900000 ]”

?

Could it be the case, when the ping failed for more than 3 times (retry = 3). It will never again tried?

Rgds
André

Hi @rossko57, hi @hafniumzinc,

short update - it works during the week quite stable.

I just re-created relatet things, items and the group an re-initiated everything related. Whatever went wrong - now it works!

Thanks for your support!!!

Rgds
André