[SOLVED] MQTT Inbound Configuration for External Control

I have a light item which is controlled over MQTT. I have made an external button control which also works through MQTT to turn on/off the lights. The sitemap turns on/off the lights correctly and my external button turns on/off the lights correctly as well, however, I’ve noticed that the status of the lights does not update on the OpenHAB sitemap when I toggle it through my external button control. The external button publishes to the topic /home/patio/pergolaLights/out. Here is my item configuration:

Switch pergolaLights "Patio Lights" <light> {mqtt=">[mosquitto:/home/patio/pergolaLights/out:command:ON:1],>[mosquitto:/home/patio/pergolaLights/out:command:OFF:0],<[mosquitto:/home/patio/pergolaLights/out:state:default]" }

Is this how my inbound item configuration is supposed to be, or does it have something to do with autoupdate that I didn’t include in the item configuration?

<[mosquitto:/home/patio/pergolaLights/out:state:default]

I gess that the payloads are 0 and 1
You need a transform to OFF and ON.

Create a file called** onoff.map** in the transform folder with the follwong contents:

0=OFF
1=ON
OFF=0
ON=1

Then change you item to:

Switch pergolaLights "Patio Lights" <light> {mqtt=">[mosquitto:/home/patio/pergolaLights/out:command:*:MAP(onoff.map)],<[mosquitto:/home/patio/pergolaLights/out:state:MAP(onoff.map)]" }

Any outbound OFF or ON will be changed to 0 or 1
Any inbound 0 or 1 will be changed to OFF or ON