Grouping two Network interfaces into 1 item

Hello Community,

I am currently trying to clean-up my sitemap. I am using the network binding a lot to check if the online / offline state of my network. As a lot of network appliances have two network interfaces (LAN+Wifi or 2 x LAN) I often have two items for a device:

In my example I have for my NAS which has two ports the following items:

Switch          F2_SR_NA_01_Eth0_ONOFF  "NAS-01 Eth 0 [MAP(]"                             <onas>               (F2_SR)
Switch          F2_SR_NA_01_Eth1_ONOFF  "NAS-01 Eth 1 [MAP(]"                             <onas>               (F2_SR)

The example above gives me both interfaces on my sitemap. But i would like the sitemap to show me one of the 4 options
offline if both Eth0 and Eth1 are not pingable
eth0 if only Eth0 is pingable
eth1 if only Eth1 is pingable
and eth1 + eth0 if both are pingable

I was actually hoping that I can tell the visibility function to check the state of two items. But that didn’t work.

Then I thought i could take a “detour” by converting the the state of the items with a MAP into a number and summing these up. So that Eth0=ON=10, Eth0=OFF=0, Eth1=ON=1, Eth1=OFF=0. In other words i can get values of 10,11,0,1. For this i created the following items

Switch          F2_SR_NA_01_Eth0_Num    "Test Eth0 [MAP(]"                                                          (Test, NA01)
Switch          F2_SR_NA_01_Eth1_Num    "Test Eth1 [MAP(]"                                                          (Test, NA01)
Group:Number:SUM        NA01            "[%.0f]"                (Test)

My problem is that item NA01 does not give me a sum of the two items.

Does anybody have an idea how to approach this problem. Or maybe even with a more elegant solution

Thank you

rule "xxx"
    Item Switch F2_SR_NA_01_Eth0_ONOFF changed or
    Item Switch F2_SR_NA_01_Eth1_ONOFF changed
    var x = "offline"
    if      (F2_SR_NA_01_Eth0_ONOFF.state == ON && F2_SR_NA_01_Eth1_ONOFF.state == ON) {x = "online"}
    else if (F2_SR_NA_01_Eth0_ONOFF.state == ON) {x = "Eth0"}
    else if (F2_SR_NA_01_Eth1_ONOFF.state == ON) {x = "Eth1"}

Thanks, I will try this in the evening.

It worked. I just created the item

String          F2_SR_NA_01_EthX_String "Test Status"                           (Test)

Thanks a million

OK, mark as solved please.