Switch , mappings and MQTT

Hi guys.

What is the correct syntax , if any , to handle key mappings with mqtt.
I have a switch that I want to contort with the following settings , ON , OFF , AUTO,

What i have tried is
I the “items” page
Switch key123 { mqtt="<[broker:switch10/status:MAP(sw10.map)],>[broker:switch10/1:command:ON:1],>[broker:switch10/2:command:OFF:2],>[broker:switch10/3:command:AUTO:3]" }

and then in the site map
Switch item=key123 label=“Light Controle” mappings=[KEY1=“ON”, KEY2=“OFF”, KEY3=“AUTO”]+

But the MQTT commands is not been sent,. Am I doing it correctly or is it even possible?
Best regards
Paul

I believe Switches can only have on/off status. Try defining your item type as a String.

1 Like

Thank you for the reply but will I be able to pass a value to the MQTT broker if the type is a string?

Yes. Mqtt takes numbers, strings, json…

Had the same problem, and this resolved it. Thanks