[SOLVED] MQTT v2 Switches Shows Text value

  • Platform information:

    • Hardware: RPI 3b+
    • OS: Raspbian Stretch
    • Java Runtime Environment: Oracle
    • openHAB version: 2.5 M1
  • Issue of the topic: I have some items connected to tasmota mqtt switches.
    Everything works fine but for what ever reason the switches on the sitemap shows a text representation of the status and i have no idea where it is coming from because i’m not using any formatting what so ever.

  • Thing configuration:
    Thing mqtt:topic:avatar_plug1 "Avatar Plug1 MQTT" {
    Channels:
    Type switch : PowerSwitch [ stateTopic="stat/avatar_plug1/POWER" , commandTopic="cmnd/avatar_plug1/POWER" ] }

  • Items configuration:
    Switch Livingroom_AP1_Plug1 "Baby Camera" <camera> {channel="mqtt:topic:avatar_plug1 :PowerSwitch"}

  • Sitemap configuration
    Switch item=Livingroom_AP3_Plug1

The outcome is having this “ON/OFF” text next to the switch in sitemap for some reason:
image

Any help here to identify where it is coming from?

I have tried to clear cache, add formatting to item label ([%s]) and remove it, nothing works to remove this textual representation

What you want is to use an empty formatter in your label, [], square brackets only, to suppress the state text.

1 Like

Wow… that simple :slight_smile:

But is there a reason why it happens in the first place!? if i have already identified the channel type to be Switch why it is still perceived as String!?

It’s not perceived as a string. A switch has a state ON, which is represented on screen as the letters O and N.

Most of the UI widgets allow display of state alongside the graphic, e.g. 55% beside a dimmer slider. If you don’t like the default, your means of control is the [formatter].

I’m just wondering because i have many other switches from different channels (zwave, zigbee, …etc.) which doesn’t show this “ON”/“OFF” status at all without using formatters.

Only these ones with MQTT is doing so.

The binding can influence the Items defaults as a part of discovery. Some bindings do that, some devices don’t provide useful info, etc.

Many thanks for your feedback and solution :slight_smile: