Door Contact via MQTT not working in BasicUI

Hi,

I have a Problem to get my contacts via MQTT to be displayed is BasicUi.

Here is my item

Contact	Wohnzimmer_TerassentuerAufZU "Wohnzimmer Terassentür"	{mqtt="<[mosquitto:edomi/out/status/Wohnzimmer/Reed/TerassentuerAufZU:state:MAP(contact.map)]"}

The contact sends 1 or 0

Here is my transformation “contact.map”


0=CLOSED  
1=OPEN

Here is my sitemap string

Text item=Wohnzimmer_TerassentuerAufZU label="Terassentür [%s]"  icon="door"

My Problem is that only get “CLOSED” in BasicUI
If i send “1” the state dosen’t update or displayed in Basic UI.

Please any Idear?

I can say that it not a sitemap problem.

The rest api also dosen’t update.
So my mqtt item config with map is the problem.

Any idear how to change it?

Here a few questions that hopefully may help isolate your problem:

  • did the MQTT binding start correctly and established a connection to your broker (log-files will indicate this)
  • using MQTT-spy or similar, does the sensor post the expected updates to MQTT
  • are the topics to which the sensor posts and the subscription of the item identical
  • if the item is re-defined as a string or number item and no maps are used, does it indicate the expected value (0 or 1)

H lipp_markus
thx for help!

  • Yes mqtt ist working.
  • I trigger not with the real sensor. I use MQTT.fx to publish the payload

But your tipp was good.
When i change the item to “String” the mapping works as aspected. Number dosent worked.
Find out via RestApi
The question ist now:
How do I deal with this in the sitemap for basicUI :rofl:

Are you sure there are no stray spaces at the end of your lines in the mapping file?