Philips Hue Light(s) show as offline

I’m using the following setup (all using the latest versions as of 5th of november 2023) all is running default:

  • RaspberryPi4
  • Docker
  • Openhab4 (in a Container)
  • Zigbee2MQTT (+ USB dongle) in a Container, (MQTT output type = attribute).
  • Mosquitto (MQTT) in a Container
  • Note: NO PHILIPS HUE BRIDGE INVOLVED.

I’ve successfully connected my lights to Z2M, see the online/offline status and can control them.
Added the MQTT binding.
OpenHab doesn’t auto-detect them, so I had to add them manually, as a generic mqtt thing an example below:

UID: mqtt:topic:Mosquitto:KantoorLamp1
label: Kantoor - Lamp 1
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: offline
  availabilityTopic: zigbee2mqtt/Kantoor - Lamp 1/availability
  payloadAvailable: online
bridgeUID: mqtt:broker:Mosquitto
location: Kantoor
channels:
  - id: kantoorlamp1onoff
    channelTypeUID: mqtt:switch
    label: Kantoor- Lamp 1 - on/off
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/Kantoor - Lamp 1/set
      stateTopic: zigbee2mqtt/Kantoor - Lamp 1/state
      off: off
      on: on
  - id: KantoorLamp1Brightness
    channelTypeUID: mqtt:dimmer
    label: Kantoor - Lamp 1 - Dimmer
    description: ""
    configuration:
      commandTopic: zigbee2mqtt/Kantoor - Lamp 1/set/brightness
      min: 0
      stateTopic: zigbee2mqtt/Kantoor - Lamp 1/brightness
      max: 254

This allows me to control the light (on/off, brightness) perfectly via OpenHAB.
However, it shows “offline”.

Any clue on how I can resolve this? Breaking my head over this for a few days now.
Tried to use with & without spaces in the light name, no difference (and why should it, controlling the lights works perfectly).

Fixed it myself already. Maybe someone can document this in OpenHAB?

Topic had to be configured as follows: {“state”:“online”}.
Found this in the Z2M logs when I was playing with switches. Doesn’t help that only after 10 min the status is changed in Z2M (and subsequently published).

UID: mqtt:topic:Mosquitto:KantoorLamp1
label: Kantoor - Lamp 1
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: '{"state":"offline"}'
  availabilityTopic: zigbee2mqtt/Kantoor - Spot 1/availability
  payloadAvailable: '{"state":"online"}'
bridgeUID: mqtt:broker:Mosquitto
location: Kantoor