Convert slider value in MQTT message


I have a slider in my dashboard which outputs a number between 1 - 100. I would like this number to be included into mqtt message:


The number after level I would like this to variable from the slider while keeping the others intact.

Anybody or a way to do this?

what does "included" mean in your case ? Is that a completely new message - or and existing message and you want to add (or change) the level value ?

I want to change the value of level, if it's the entire message that needs to be changes makes no difference to me at this point

for a complete message then either a simple template or function node would do the trick, for example:


Have you considered the option of using separate topics, so your/topic/state, your/topic/level and yourtopic/temperature? Then you won't need to merge them when publishing or split them up when subscribing.

Thank you all for this help, worked perfect :slight_smile:

@Colin - The topics are different. They depend on the remote, the bulbs, etc...

Not sure why that invalidates my suggestion, it is up to you of course.

I understand your idea now, and that would also work. Depends on what I want to do offcause :slight_smile: