Service Status Standalone Widget

A dynamic standalone widget that shows only those services that are offline. The widget assumes that all the Items indicating status are Switch Items or String Items where “OL” indicates online (support for the NUT binding’s online status for an UPS).

The configuration assumes a single Switch Item that is the roll-up of all service status Items. For example a Group:Switch:OR(OFF,ON) which will be OFF if one or more of that Group’s members are OFF. Other options are supported as well, such as a Switch populated via a rule. This controls the header text.

The second parameter is a comma separated list of Item tags that indicate that an Item represents a service status. The Item must have all the listed tags to be included. Semantic tags can be used (e.g. Status,Power) or you can define your own custom tag(s).

Screenshots

Changelog

Version 0.1

  • initial release

Resources

uid: rlk_all_services
tags:
  - card
  - services
props:
  parameters:
    - context: item
      description: All Services Status Item, ON means all services are online
      label: Rollup status
      name: rollup
      required: true
      type: TEXT
    - context: tag
      description: Comma separated list of Item tags that indicate a service status
      label: Service Item Tags
      name: tags
      required: true
      type: TEXT
  parameterGroups: []
component: f7-card
config:
  title: '=(items[props.rollup].state == "ON") ? "All Services Online" : "Offline Services"'
slots:
  default:
    - component: oh-list
      slots:
        default:
          - component: oh-repeater
            config:
              fragment: true
              for: item
              sourceType: itemsWithTags
              itemTags: =props.tags
              filter: items[loop.item.name].state != "ON" && items[loop.item.name].state != "OL"
            slots:
              default:
                - component: oh-list-item
                  config:
                    icon: f7:wifi_slash
                    iconColor: red
                    title: =loop.item.label
                    item: =loop.item.name
                    badge: OFFLINE
                    badgeColor: red
1 Like

It seems your Widget is what I like, but I dont get it working.

I have network Items (switch status ON/OFF) called “Paul” “Erwin” and some other, all are in a Group “Online”. (Host “Erwin” is currently offline )
In an old Sitemap the Group “Online” is Off and if I open the group one Host is Offline as expected

In your Widget I added the groupItem “Online”, you wrote:
“The second parameter is a comma separated list of Item tags that indicate that an Item represents a service status.”

But where do I have to place the Items? Or what are “Item tags” ?

My current “Edit Widget Code”/YAML:

component: oh-repeater
config:
  fragment: true
  for: item
  sourceType: itemsWithTags
  itemTags: =props.tags
  filter: items[loop.item.name].state != "ON" && items[loop.item.name].state != "OL"
  groupItem: Online
  listContainer: true
slots:
  default:
    - component: oh-list-item
      config:
        icon: f7:wifi_slash
        iconColor: red
        title: =loop.item.label
        item: =loop.item.name
        badge: OFFLINE
        badgeColor: red```

network.items

Group:Switch:OR(OFF,ON)    Online // online Services    

Switch                      Paul                        "HostState Paul"                                                        <network>   (Online)            { channel="network:pingdevice:paul:online" }
DateTime                    Paul_lastseen               "Paul WLAN lastseen [%1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS Uhr]"          <time>      (FG_TimeLineRRD)    { channel="network:pingdevice:paul:lastseen" }
Number:Time                 Paul_ResponseTime           "Paul responsetime"                                                     <time>      (FG_TimeLineRRD)    { channel="network:pingdevice:paul:latency" }

Switch                      Erwin                       "HostState Erwin"                                                       <network>   (Online)            { channel="network:pingdevice:Raspi_Erwin:online" }
DateTime                    Erwin_lastseen              "Erwin lastseen [%1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS Uhr]"              <time>      (FG_TimeLineRRD)    { channel="network:pingdevice:Raspi_Erwin:lastseen" }
Number:Time                 Erwin_ResponseTime          "Erwin responsetime"                                                    <time>      (FG_TimeLineRRD)    { channel="network:pingdevice:Raspi_Erwin:latency" }

network.things

network:pingdevice:paul                                     [ hostname="10.1.1.161", macAddress="00:00:00:00:00:01", retry=1, timeout=5000, refreshInterval=60000 ]
network:pingdevice:Raspi_Erwin                              [ hostname="10.1.1.124", macAddress="00:00:00:00:00:0", retry=1, timeout=5000, refreshInterval=60000 ]

The widget needs two things.

  1. The Group which is used to determine if all are online or one or more is offline. This manages the title of the widget (“All Services Online” when ON and “Offline Services” when OFF
  2. Tags which are used to identify those Items that are to be shown when they are not ONLINE

You need to add a list of Item tags to tell the widget which Items are relevant and should be shown when they are OFF.

Nowhere. You probably want them to be a member of the Group but that’s not necessary.

1 Like

Thank you very much, great work.

I never used the Tags before, still migrating from an old 2.x instance.
I tried to configure it in the repeater component but I had to put my Group-Name “Online” at “Rollup status” and the Tag “ServiceChek” behind “Service Item Tags”

now working Widget Code Sample:

component: widget:rlk_all_services
config:
  rollup: Online
  tags: ServicCheck
slots: null

Sample line with a tag

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Type                      ItemName                    Description                                                             ICON        Group               Tag             Channel
Switch                      Paul                        "HostState Paul"                                                        <network>   (Online)            ["ServicCheck"] { channel="network:pingdevice:paul:online" }

It works like a charm! :+1: