NSPanel Documentation โ—† Icon overview GitHub Deutsch

PanelStatusBadge component

React component that shows the status of a panel as a coloured badge with live updates.

Features

Props

Prop Type Default Description
panelId string - Required. Panel ID for the status subscription
oContext any - Required. ioBroker admin context (socket, instance)
adapterName string 'nspanel-lovelace-ui' Adapter name for the state ID
size 'small' | 'medium' 'small' Chip size
showLabel boolean true Show the status text
showIcon boolean true Show the status icon
disableTooltip boolean false Disable the tooltip
alive boolean true Adapter alive state (disables the badge when false)

Usage

import { PanelStatusBadge } from './components/PanelStatusBadge';

<PanelStatusBadge
    panelId="panel_wohnzimmer"
    oContext={this.props.oContext}
    size="small"
    showLabel={true}
/>

Icon only, without a label

<PanelStatusBadge
    panelId="panel_kueche"
    oContext={this.props.oContext}
    showLabel={false}
    showIcon={true}
/>

Without a tooltip

<PanelStatusBadge
    panelId="panel_bad"
    oContext={this.props.oContext}
    disableTooltip={true}
/>

Status types

The component uses the central configuration from adminShareConfig.ts:

Status Colour Description
offline grey (#9E9E9E) Panel offline, no connection to the adapter
initializing grey (#9E9E9E) Panel object initialised (startup only)
connecting light blue (#03A9F4) MQTT connection being established
connected blue (#2196F3) MQTT connected, but no online status yet
online green (#4CAF50) Panel TFT is online and ready
flashing yellow (#FFC107) Firmware update in progress
setup orange (#d99800) Panel in setup mode
error red (#F44336) An error occurred (connection error, flash error, โ€ฆ)

State subscription

The component automatically subscribes to this state:

{adapter}.{instance}.panels.{panelId}.status

Example:

nspanel-lovelace-ui.0.panels.panel_wohnzimmer.status

The state holds a numeric value (0-7) that is mapped to the matching PanelStatus.

Lifecycle

Central configuration

All status configurations live in src/lib/types/adminShareConfig.ts:

This central place keeps the status display consistent across the whole adapter.

Technical details

Data flow

  1. The component subscribes to the ioBroker state via oContext.socket.subscribeState()
  2. On a state change the onStatusChanged callback runs
  3. The numeric value is converted into a PanelStatus
  4. The status is stored in the component state
  5. Rendering happens with the matching colour and the translated label

Performance

Error handling


Source of this page: doc/en/PanelStatusBadge.md ยท Project on GitHub

  Back to top