Openhab Can Publish to MQTT Topic, but does not subscribe to it

Hi,
New User Here.
I have reprogrammed a Sonoff, and included a local toggle switch on GPIO12 that allows me to update the MQTT Topic when the switch is switched on or off. The Sonoff Also subscribes to the same MQTT topic to control its local relay (Basically a local lightswitch)

I have an OrangePI running Mosquitto, Openhab, etc.
The Sonoff is communicating with Mosquitto fine, and can Publish and Subscribe to that topic with no problems.

I also have Openhab linked to the same topic, so that you can control the Sonoff through the MQTT Topic. But I want the switch status on Openhab to reflect the current status of the physical switch (i.e. the MQTT topic. But it does not correspond.

So it looks like Publish from Openhab works,but the Openhab switch item is not subscribing.
Here is the Configuration

root@orangepione:/etc/openhab/configurations# cat sitemaps/home.sitemap
sitemap kolbehouse label="Main Menu"

Frame label="Home" {
        Text label="Home" icon="house.png" {
                        Switch item=mqttsw1 label="MQTT Switch 1"
              }
}
root@orangepione:/etc/openhab/configurations# cat items/home.items
group All

//Switch mqttsw1 "Switch 1" (All) {mqtt=">[mosquitto:/bedroom2/switch1:command:on:1],>[mosquitto:/bedroom2/switch1:command:off:0]"}

Switch mqttsw1 { mqtt=">[mosquitto:/bedroom2/switch1:command:OFF:0],>[mosquitto:/bedroom2/switch1:command:ON:1],<[mosquitto:/bedroom2/switch1:state:MAP(binary.map)]", autoupdate="false" }

The Commented out switch item is the one that is controlling the mqtt topic fine, but not receiving from it.
The 2nd / Uncommented one is something I read on this topic, but binary.map is not on my system anywhere, so it is not working.

Thanks

Hi Peter,
I assume you are using openHAB 1.x with the MQTT binding?
This link gives could information on receiving inbound messages from MQTT: https://github.com/openhab/openhab/wiki/MQTT-Binding to check your basics. The example you refer to translates the state received from the MQTT device into something openHAB can read via map (I think it is called transformation in the MQTT description).

Can’t help you with the details as I cannot test right now due to holidays.

Thanks.
With that, I managed to work it out. This fixed it

Item File
Switch mqttsw1 { mqtt=">[mosquitto:/bedroom2/switch1:command:OFF:0],>[mosquitto:/bedroom2/switch1:command:ON:1],<[mosquitto:/bedroom2/switch1:state:MAP(onoff.map)]", autoupdate="false" }
transform/onoff.map
0=OFF
1=ON