You’ll want to got to the device settings in z2m → reporting tab → add a new reporting entry to report onOff to the coordinator.
Admittedly I haven’t configured that reporting myself - just waiting for the next z2m update. In the meantime, I’m using an HA automation that would trigger on mqtt events using a wildcard, zigbee2mqtt/+/action, and then simply publish an mqtt message to force the coordinator to query/update the onOff state for the device triggering the action. (Got this working before I realized the reporting option wasn’t set up, so just sticking with this for now)
alias: System - Light Switch Action
description: ""
trigger:
- platform: mqtt
topic: zigbee2mqtt/+/action
condition: []
action:
- service: mqtt.publish
data:
payload: "{\"state\":\"\"}"
topic: "{{ trigger.topic | replace('action', 'get') }}"
mode: single