EasyESP MQTT Contact

Hi there,
I am trying so get the easyesp working as a garage door opener. The relay is working fine, but the contact status is not shown in sitemap.
Here is my test config:
Items:
Switch switch1 “switch1” {mqtt=">[broker:/garage/gpio/0:command:ON:0],>[broker:/garage/gpio/0:command:OFF:1]"}
Contact doorstatus “Garagentor [%s]” { mqtt="<[broker:/garage/contact/door1:state:MAP(de.map)]" }

Sitemap:
sitemap test label=“test” {
Switch item=switch1
Text item=doorstatus
}

I added log all to the mosquite config so it is showing that openhab is getting something:
Button is pushed:
1523711514: Received PUBLISH from ESPClient0 (d0, q0, r0, m0, ‘/garage/contact/door1’, … (1 bytes))
1523711055: Received SUBSCRIBE from paho268617231456
1523711055: /garage/contact/door1 (QoS 0)
1523711055: paho268617231456 0 /garage/contact/door1

Hope anyone can help.
Thanks in advanced!

You need to create a map file in the transform folder:
espeasyonoff.map

NULL=NULL
-=Undefined
0=OFF
1=ON

And you need only one item:

Switch switch1 “switch1” {mqtt=">[broker:/garage/gpio/0:command:ON:0],>[broker:/garage/gpio/0:command:OFF:1], <[broker:/garage/contact/door1:state:MAP(espeasyonoff.map)]", autoupdate="false"}

or if you want to keep the item door status:

Contact doorstatus “Garagentor [%s]” { mqtt="<[broker:/garage/contact/door1:state:MAP(espeasyopenclosed.map)]" }

and the map file:
espeasyopenclosed.map

NULL=NULL
-=Undefined
0=CLOSED
1=OPEN

I tried the 2 example with 2 items
after adding your code I will get this message in openhab log
18:28:56.993 [WARN ] [del.core.internal.ModelRepositoryImpl] - Configuration model ‘test.items’ has errors, therefore ignoring it: [2,20]: missing EOF at ‘“’

EDIT: I have changed the " and the error is gone, but there is still no status availible. :frowning:

EDIT2: From openhab log:
[ERROR] [.ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘doorstatus’ for widget org.eclipse.smarthome.model.sitemap.Text

Did you create the map files in the transformation folder?

Yes the file is created. Sitemap shows a “-” but in mapping file is “-=Undefined”. Mapping Addon is installed, too.

Edit: I have changed the mapping to de.map and edit the file. Now it is working…thank you for helping vzorglub :slight_smile: