Best way to link lots of state(s) in one item to separate items

I’ve got the NSPanel working nicely now over MQTT, but I am still pondering the best way to keep things in sync with OH items.

The panel can send and receive lots of different messages relating to openhab items. The panel itself knows nothing of OH or it’s items.

image

Pressing this button simply sends

{"button":{"pid":10,"bid":1,"state":1}}

Apart from buttons I have lots of other components that will send other things like this

{"media":{"action":"play","volume":40}}

and so on. The user will know what OH item he want to related it to. So ‘somewhere’ they need to enter this relationship in a way that is most easy to manage.

Is there a really slick clever way of doing this?

I also need the same doing back, if they move the volume in the item, then I want a mqtt publish of

{"sync":{"media":{"volume":50}}}

There will be a lot of items effected by this. So I’m just wary of going down a route and creating loads of bloat when there is a smarter way.