I've only skimmed this thread but if I've understood, you may want to look at an "experimental" setting in Zigbee2MQTT. By default it only publishes a single topic that has a complex JSON object in it. But you can change the setting to also publish each setting individually. Can't remember the setting name but I have it on for my setup and it works really well and you can then just subscribe to what you want instead of having to get everything each time.
You can use msg.payload.brightness in downstream nodes.
But if you really want to get rid of the other data, a change node can set msg.payload to msg.payload.brightness. That should give you msg.payload == 254.
i want to get the MQTT request in to a sequence and i dont think that will be a problem
my problem is that how do i initiate the "state" request
at the moment i a using a inject node but in the working sequence it till have to be triggered some how and the injectnode dont have an input trigger so i need to use a different node i think
the sequence is
button press - switch - currentstate on/off - here i want the inject MQTT - read MQTT state - bla-bla-bla
can i use a service call instead if an inject node ?
i tried current state but that one wants an entity
I am sooo not the right person to answer your question.
i have only been trying to use Home Assistant since late last year
but why i started using it was a recomendation from friends who was using it and the fact that i wanted to try and automate stuff in my home.
before that i was using Wago and Siemens Logo in my garage and garden to automate but i wanted to go all in.
I am no tecky coder so HA was a good option for me to begin with.
It integrates all i can think of i need and want to automate in to one platform.
anything from my kitchen hood, lighting, curtains, zigbee, wifi, z-wave, BT, garagedoor, ESP, Vacumcleaner to where are the kids at the moment.
it is easy to get the basics working, but i wanted to do a bit more and that is where i ran in to problems with MQTT
if you wanted to use an physical button how would you do it ?
I have a couple of LED capacitive touch buttons connected to ESP8266s, the whole assembly can fit in a little plastic case about 4cm square. The buttons are discussed here
The ESP runs Tasmota and uses MQTT to send button press messages.
Very home brew and cheap.
I have half formed plans to replace them with battery powered ESPs which can deep sleep between presses. The current ones can't do this because the capacitative buttons need power so deep sleep is not an option.
The nicest commercial buttons seem to be Flic but too expensive at $30.