I have connected 2 Tradfri switches and two different LEDs from IKEA to my Zigbee2MQTT and subsequently to my Openhab. I can control the Lights from Openhab and also from the switches (by binding them in zigbee2mqtt).
My problem is: When I use the (IKEA hardware) switches to turn the lights on or off, change brightness etc. Openhab doesn’t realize that. I have set up rule with a cronjob that simply runs a mosquitto_pub to get the current values:
I found serveral posts about creating an item and binding it to the mqtt, but these are apparently all for MQTT 1. Since I got MQTT 2 that doesn’t work.
I suppose you would set up MQTT (v2) Things and channels to listen for button presses, link to Item(s).
Then a rule triggered by button Items can predict the effect and update the light Items directly. Or invoke your light status refresh code.
It’s all a bit of a kludge, I’d be looking to have the IKEA lights report when they change.
I have bound the switch to a certain group in my zigbee2mqtt configuration. But I have now found the config-option
advanced:
report: true
in the configuration.yaml. Now it works automagically