It might be easier to use the MQTT Event Bus.
- Create two Groups, one for publishing commands and another for publishing updates
- Add all the Items you want to have their updates to that Group
- Install and configure the MQTT Event Bus Publisher (I hope it’s clear now that OH is publishing values) rule template (Settings → Automation → Rule Templates).
- Instantiate a rule based on that template, selecting your Groups.
That’s it. No MQTT configuration required (beyond setting up the Broker Thing). Which Item’s are publishes and whether commands, updates, or both are published is controlled based on the Group membership.