Control Zigbee bulb via MQTT

Hi!
After searching and testing quite a while am reaching out for help.
Problem: I have a bulb / light device attached via ZHA. I want to read and write its state via MQTT.
I’m using the MQTT integration but with an MQTT broker running on another machine. Zigbee und MQTT are working fine in general. I’m using the most recent HA version on RPi4.
Question: how can I link the state property of the bulb entity to a certain MQTT topic?

I understood how I can add (either manually or via discovery) MQTT “devices” as entities. But how does it work the other way around?

Many thanks in advance for any hint.

Try

Thank you! This solved half of the problem. I’m getting the required state information (also from sensors which is also important for another use case).
However, this is “publish only” - right? I need also to set the state via MQTT. This integration does not support subscribing to a topic.

Wouldn’t a couple of simple automations using the MQTT trigger suffice?

The action would then be to change the state of the light via a service call.

I created this one with the automation editor, because I am feeling lazy.

automation:
  alias: Light ON
  description: ""
  trigger:
    - platform: mqtt
      topic: living_room/switch/light
      payload: "on"
  condition: []
  action:
    - type: turn_on
      device_id: e1208f14bee048bc86403e4cca351c6d
      entity_id: ab3ca6b47afd35a1ce2d12608b83a3c1
      domain: switch
  mode: single

And a similar one for off.

Thank you Daryl. I think for the moment this fits my needs. If the number of device is growing significantly this might be a little bit “confusing”. On the other hand this gives me full control on the MQTT topic naming and structuting which helps integrating with my other applications.

Remember that you don’t need to specify the payload, this can reduce the number of automations. You just trigger on the topic and then with some judicious choice of payloads you can use the payload in a templated action.

Thank you very much for this valuable hint. This significantly reduces the number of automations, of course.