[SOLVED] MQTT GarHAge Help

Hi there everyone,

I’m a complete noob so please go easy on me.

I’ve managed to get a Nodemcu loaded with GarHAge (https://github.com/marthoc/GarHAge) working with the Mosquitto MQTT broker loaded on my RaspberryPi3 which is also running Openhab2. I can publish the command ‘OPEN’ to the topic /garage/door/1/action using MQTT.fx and the Nodemcu triggers the attached relay. Fanstastic!
I can also get the Openhab item bellow;

Switch GarageDoor1 {mqtt=">[broker:/garage/door/1/action:command:ON:MAP(binary.map)],>[broker:/garage/door/1/action:command:OFF:MAP(binary.map)]" }

to send a the command OPEN to the same topic, however nothing happens. The word ‘OPEN’ is displayed in subscribe section of MQTT.fx but the Openhab log says the command is ‘ON’ instead of ‘OPEN’ which makes me think I’m doing something wrong with the MAP file which contains the following;

key=value
ON=OPEN
OFF=CLOSE

Please help me, I think I’ve searched every MQTT topic on this forum to work out what I’m doing wrong.

If anyone else has used the GarHage code, I’d be interested to hear how you got it to work with Openhab.

Cheers

Correct, your item is a switch which can the states of ON and OFF
The binding will transform the command with a transform so you only need ONE binding definition and let the transformation do the work:

Switch GarageDoor1 {mqtt=">[broker:/garage/door/1/action:command:*:MAP(binary.map)]" }

Thank you, that worked perfectly! Also realized I needed to remove the / in front of garage in the topic and it works! Thanks again.

Please tick the solution, thanks