How to display items disabled if device is offline

Hi,
I have several tasmota devices with configured LWT topics. These devices can be online/offline freaquently. Is it possible to have the controls which belong to the device displayed as disabled in the sitemap? What other options can I use to understand the device is offline?

1 Like

Hi Serhiy,
as far as I know, there is no way to mark controls as disabled or “grayed-out”.
But you can make the controls invisible if the device is offline:
Disable a Oh-button - Add-ons / UIs - openHAB Community

It’s possible.
Just have an item that represents the status of your tasmota device (e.g. link it to the LWT topic as its stateTopic) and use that item in your disabled: config.

config:
  label: test
  sidebar: true
blocks:
  - component: oh-block
    config: {}
    slots:
      default:
        - component: oh-grid-row
          config: {}
          slots:
            default:
              - component: oh-grid-col
                config: {}
                slots:
                  default:
                    - component: oh-toggle-card
                      config:
                        item: TestSwitch1
                        disabled: =items.TestSwitchEnabled.state == "OFF"
              - component: oh-grid-col
                config: {}
                slots:
                  default:
                    - component: oh-toggle-card
                      config:
                        item: TestSwitchEnabled
masonry: null
grid: []
canvas: []

OP is asking about sitemaps so the approach will be a little different.

@svh, unless a new feature has been added to sitemaps that is not in the docs, the best approach for this is going to be to create the status Item like @JimT describes. Then you’ll have two entries in your sitemap for the Item, one with the control enabled (e.g. Switch element) and the other one with the control disabled (Text element). Use the status Item to control the visibility of each sitemap element so one is only shown when the status says it’s online and the other only when the status says it’s offline.

1 Like

@Mandrill Yes, thanks, I’m aware about this option but was hoping to find better approach :slight_smile:

@JimT Haven’t managed to switch to the new lyaout yet :frowning:

@rlkoshak Another option I was considering is to change signal level icon (which shows rssi) to off. But did not get how to properly use 2 data sources for dynamic icons. It should be available in OH4?

I don’t think that’s possible in sitemaps.

not sure if it helps or if it’s 100% what you want…

I have e.g.

            Text	item=NW_TPAP			        valuecolor=[NW_TPAP==ON="green",			            ==OFF="red"] visibility=[NW_TPAP!=ON]
            Text	item=NW_TPAP					valuecolor=[NW_TPAP==ON="green",					    ==OFF="red"] visibility=[NW_TPAP==ON]
            {
                Webview url="/static/inject_autolinker.html"  visibility=[Flag_System==OFF]
                Text item=NW_TPAP_URL
            }

which results in:
grafik
or
grafik

the real “controls” are one sublevel below and can just be accessed, when item is online.

for “just” disabling a control I also did not find any solution in the past.

2 Likes