[SOLVED] MQTT Door Contact

  • Platform information:
    • Hardware: Raspberry Pi 3
    • OS: Openhabian
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version:

Hi there,
I have a NodeMCU with ESPEasy connected to a magnetic contact. Using MQTTfx I can confirm the mqtt topic garage/ESP_Easy/AccessDoor/Status sends the value 0 when the contact is closed and 1 when the contact is open.

In OpenHab I have the following;

Item
Contact GarageAccessDoorStatus "Garage Access Door Status [%s}" {mqqt="<[broker:garage/ESP_Easy/AccessDoor/Status:state:MAP(contact.map)]"}

Transform
0=CLOSED 1=OPEN

Sitemap
Text item=GarageAccessDoorStatus label="Garage Access Door [%s]" icon="door"

The sitemap shows the door icon and label, however I’m sure sure how to get the status of the door to display. Can anyone please help me as I’m a lost.

Thank you

mqtt

1 Like

And the transform should be on 2 lines:

0=CLOSED
1=OPEN
1 Like

Thank you sihui! Wow such a simple typo that had me stumped for weeks.
Cheers!

1 Like

Thanks vzorglub, I did have on separate lines in the actual file.
Now it’s working…thanks for the fast reply and advice.
Cheers